Skip to content

[PR] fix: preserve Google stream errors across loop rounds - #6631

Merged
ranxianglei merged 2 commits into
ranxianglei:masterfrom
Afloat16:2026-11-13_google-stream-errors
Nov 14, 2026
Merged

ranxianglei merged 2 commits into
ranxianglei:masterfrom
Afloat16:2026-11-13_google-stream-errors

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Fixes #6629

Problem

The Google adapter treats a top-level provider error as ordinary metadata marked firstRoundOnly. On the first round this forwards an error as client framing and prevents the loop's existing zero-output retry. After a proxy-tool continuation the same metadata is suppressed, so the client loses the provider's code, status and explanation and receives only a generic no completion event error.

Change

Classify non-null Google error envelopes through the loop's existing error event before candidate/metadata handling. Preserve the numeric code, status and message in the error description, flush already received text and usage, and stop consuming content from the failed response.

The existing retry budget and error-envelope policy are retained. A failure before any output can use the existing single retry; a failure after visible text does not replay that text. Final failures use the existing Google 500 / INTERNAL loop-error envelope, with the upstream code and status retained in its message. No new retry policy or configuration is introduced.

Validation

  • The new nine-case regression suite gives 6 failures and 3 passing controls against unchanged master e1f31ad9d5b47500362699a9867819b861c7de96; all 9 pass with this change.
  • Real loopback HTTP cases verify a transient first-frame error recovers on exactly one retry with identical request bytes, repeated errors stop after that one retry, and an error after acp_status preserves its cause without replaying visible text.
  • Parser cases cover SSE and JSON-array streams, ignored content after a terminal error, and retention of reported usage and text. Controls cover absent/null errors, safety feedback, signed function-call reconstruction, and byte-for-byte provider-error forwarding on the separate plugin-owned path.
  • 59 related tests pass, including Google compression, signed parts, truncation handling and protocol error emission.
  • A separate integration worktree applying [PR] fix: parse and rewrite complete core-loop SSE payloads #6619, [PR] fix: forward complete Google response frames once #6623 and this patch has 73 passing tests, including multiline SSE, complete Google frames, signed parts and the new errors.
  • Type checking, the complete build, unused-export and test-import-graph guards, and whitespace checks pass.
  • The zero-token Codex prerequisite check finds the CLI and built artifact, but its configured local upstream is unreachable. The real Codex lifecycle E2E was not run. Full regression remains the remote CI verdict on the pushed head.

No kernel, config surface, persistence format, version or plugin-path implementation changes.

@ranxianglei ranxianglei changed the title fix: preserve Google stream errors across loop rounds [PR] fix: preserve Google stream errors across loop rounds Nov 13, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

Superseded by #6677 (merged as 3858b6956, 2026-11-14).

Landed into master via the real merge commit f344793213e (Merge Afloat16/2026-11-13_google-stream-errors (PR #6631)), so your original commits are preserved verbatim in master history — only hashes of the batch wrapper changed, your authorship and commit messages are intact.

The fix for #6629 is now in master. Closing this PR as superseded — thanks for the careful, well-tested fix.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Google stream errors lose their cause after a proxy-tool continuation

2 participants