Skip to content

fix(responses): reject incomplete terminal streams - #557

Open
eclipse1228 wants to merge 1 commit into
Intrect-io:mainfrom
eclipse1228:fix/responses-terminal-events
Open

fix(responses): reject incomplete terminal streams#557
eclipse1228 wants to merge 1 commit into
Intrect-io:mainfrom
eclipse1228:fix/responses-terminal-events

Conversation

@eclipse1228

Copy link
Copy Markdown

What

Reject terminal response.incomplete and response.failed SSE events from the Responses API instead of reducing them to an empty successful stop response.

Why

A Responses request can return HTTP 200 while ending unsuccessfully, for example when it exhausts max_output_tokens. Previously that stream was treated as a normal empty assistant answer, which could let the agentic loop continue from a false success state.

How

  • Capture terminal incomplete and failed events while consuming the SSE stream.
  • Preserve the provider diagnostic reason/message when present.
  • Throw after the stream is consumed so callers receive a failed run rather than an empty completion.
  • Add a regression test for an HTTP 200 stream ending in response.incomplete.

Testing

  • npm test -- --run src/adapters/codexResponses.test.ts
  • npm run typecheck
  • npm run build
  • git diff --check

The full suite could not complete locally because the existing better-sqlite3 native binary was built for a different Node ABI; the focused suite and static checks above pass.

Related discussion: #556

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