Skip to content

aiclient: preserve Responses API incomplete-response reasons - #3290

Merged
Hillary Mutisya (hillary-mutisya) merged 1 commit into
mainfrom
dev/hillarym/responses-incomplete-reasons
Nov 18, 2026
Merged

Hillary Mutisya (hillary-mutisya) merged 1 commit into
mainfrom
dev/hillarym/responses-incomplete-reasons

Conversation

@hillary-mutisya

Copy link
Copy Markdown
Contributor

Summary

  • Include incomplete_details.reason in Responses API incomplete-output errors for both ordinary responses and response.incomplete stream events.
  • Continue rejecting incomplete output even when partial text is present; absent, blank or malformed reasons retain the existing generic error.
  • Add 11 offline regression cases and document the diagnostic-only behavior.

Motivation

The generic incomplete-response error hides whether a provider stopped for max_output_tokens, content_filter, or another reported reason. Preserve that diagnostic at the adapter boundary without turning partial output into a successful response.

Behavior and compatibility

For a nonempty string reason, errors now read Model response is incomplete (reason: max_output_tokens). Streaming still throws and non-streaming still returns a failed result. Missing response envelopes and missing or malformed reason metadata still fail with Model response is incomplete.

No model routing, request limits, response acceptance, credential handling, or retry policy changes. This does not increase output budgets or retry incomplete responses.

Reviewer guide

Validation

Local Windows validation at dab6dbf7aecede923c79d14041e6945f3af371b4; commands run from ts:

Check Command Result
Full workspace build pnpm run build PASS
Offline adapter/client regressions `pnpm --filter @typeagent/aiclient run jest-esm --runInBand '--testPathPattern=(providerAdapter openai)[.]spec[.]js$'`
Changed formatting pnpm run prettier:changed PASS
Lint ratchet pnpm run code-lint -- --ratchet --base origin/main PASS: zero new violations
Complexity ratchet pnpm run code-complexity -- --ratchet --base origin/main --cyclomatic 25 --cognitive 30 --new-file-cyclomatic 25 --new-file-cognitive 30 PASS
Circular ratchet pnpm run code-circular -- --ratchet --base origin/main --exceptions-file tools/scripts/code/circular-baseline-exception.json PASS: no new cycles
Debt gate pnpm run code-debt -- --gate --base origin/main PASS
Patch whitespace git diff --check PASS

The first local circular scan could not run its checkout hook because Git LFS was absent from its process PATH. Rerunning with the existing portable Git LFS dependency available passed, without bypassing hooks or changing the gate.

Tests use synthetic provider responses; no live inference was performed. CI results are separate from these local checks.

Risks and rollback

Consumers matching the complete generic error string will now see an appended reason when one is provided. The existing error prefix is unchanged. Reverting this PR restores generic messages; no migration is needed.

Include provider incomplete_details.reason in both non-streaming and streaming failures while continuing to reject partial output. Keep generic failures for absent or malformed reasons and cover both paths with offline regressions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@hillary-mutisya
Hillary Mutisya (hillary-mutisya) merged commit b1c9c75 into main Nov 18, 2026
109 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant