Skip to content

Responses gateway rejects DONE after successful completion #1157

Description

@bcdonadio

Observed behavior

While investigating #1154 with an actual synthetic Spark compaction request, a coherent standard Responses request was accepted (HTTP 200 / SSE) and upstream emitted a successful response.completed, but LCM's gateway left requestCompleted false and returned no summary.

The investigator found the successful terminal event was followed by the standard [DONE] SSE sentinel in the same chunk. The gateway observer rejects remaining bytes after a terminal event, treating that terminator as invalid trailing stream data.

Expected behavior

A valid completed response followed by the protocol's [DONE] stream terminator should complete successfully. Continue rejecting extra semantic events, malformed terminal state, failed/incomplete responses, and unexpected data after completion. Preserve byte/chunk bounds and cancellation.

Root cause

Reported by the #1154 issue owner from live synthetic provider evidence and source inspection: src/llm/codex-responses-gateway.ts:523-530 rejects bytes remaining after the terminal event. This rejects a normal terminator together with genuinely invalid trailing content.

Baseline: a824d63d31876fc1fcca960f32a621b4392cf615. The #1154 protocol-normalization probe received actual upstream acceptance, exposing this subsequent failure. No production source was changed for that probe.

Reproduction / regression test

Feed the public gateway a synthetic SSE stream containing a valid response.completed event (response status completed, error absent/null), followed by data: [DONE]\n\n. Cover same-chunk and split-chunk delivery. Verify waitForCompletion() succeeds and requestCompleted is true, while invalid/extra semantic events still fail closed.

Exact sanitized live evidence and any follow-on probes will be linked from #1154's implementation evidence; do not publish credentials, private capability URLs, or user transcripts.

Environment

This is distinct from #1154's initial HTTP 400 Lite rejection, but blocks end-to-end verification after that rejection is repaired.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    Priority

    High

    Effort

    None yet

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions