Skip to content

[PR] fix: forward complete Google response frames once - #6623

Merged
ranxianglei merged 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-13_google-frame-forwarding
Nov 14, 2026
Merged

ranxianglei merged 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-13_google-frame-forwarding

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Fixes #6621

Problem

The Google loop adapter forwards the entire response frame for each text/thought part it extracts. One [text, signed thought, text] frame consequently sends all three parts three times. Per-part forwarding can also expose a sibling's original filtered text before all prose edits have been applied. Output-only frames fall through the text/call/signature dispatch and disappear.

A real loopback upstream through startServer reproduces duplicated signed thoughts in both rounds of an acp_status continuation, missing image/code output, and repeated buffered text in a real-tool continuation. A terminal tool frame can also carry its finish reason twice.

Change

Collect the structured deltas and all prose edits for a frame before choosing its single wire carrier. Keep unedited raw frames verbatim, preserve opaque and signed parts, and attach a prose-bearing frame to a text event so the loop's visible-output retry gate remains accurate. Call frames retain the existing settle-time proxy/real classification; proxy removal keeps the other output parts. The terminal stub is the sole finish carrier.

Add rawHandled to structured text/reasoning events. The loop still records every delta for accounting and the existing re-request rebuild, while the adapter owns its raw bytes. This prevents continuation rounds from synthesizing a second copy of buffered/sibling content. Anthropic's separate withheld contract remains unchanged.

The scope is client-bound frame forwarding and existing text/thought/tool replay. This does not add a new core representation for replaying opaque media/code outputs across proxy-tool rounds.

Validation

Base e1f31ad9d5b47500362699a9867819b861c7de96 (0.1.213), Node v24.22.1, repository test/storage preloads.

  • 16 new cases: 13 fail / 3 passing controls on unchanged master; 16 pass with this change. Both SSE and JSON-array transports are covered.
  • Four real HTTP proxy cases cover multi-part signed output in both rounds, buffered real-tool continuation, output-only frames, and an unchanged single-part control. Signed thought text/signatures are compared exactly on the client wire and the actual re-request; tool signatures and a single terminal are checked too.
  • 130 targeted tests pass across nine files: the new suite, Google and cross-wire adapters, both signed-thinking wires, standalone signatures, Anthropic hold/retry, the core loop, degenerate retry, and the real Google compression fixture. The latter includes proxy mode, anonymous prefix-affinity mode and plugin mode.
  • Combined with [PR] fix: parse and rewrite complete core-loop SSE payloads #6619 in an isolated worktree, cherry-pick is clean and all 40 new cases pass. The contributions repair different mechanisms: [PR] fix: parse and rewrite complete core-loop SSE payloads #6619 parses multiline payloads, while this issue reproduces with ordinary single-line frames.
  • Typecheck, production build, unused-export gate, test-import-graph gate and git diff --check pass.

These are hermetic HTTP fixtures, not a claim of live-provider testing. The local Codex prerequisite remains blocked by the unreachable upstream at 127.0.0.1:8199; the real-client four-phase suite was not run. Full regression is the hosted CI verdict on this head.

Prior work

All-state searches and contributor history distinguish #3162 / #3158 (standalone signatures), #1881 (prose filtering) and #6619 (multiline payload parsing). Their diffs retain this per-part whole-frame forwarding. The Google Content/Part reference specifies ordered parts including non-text payloads.

Topic N, Google/Gemini protocol wiring; suggested bug, p1, scope/wiring.

@ranxianglei

Copy link
Copy Markdown
Owner

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

Landed into master via the real merge commit 505b16b97cf (Merge Afloat16/2026-11-13_google-frame-forwarding (PR #6623)), 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 #6621 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 core loop duplicates complete frames for sibling text/thought parts and drops output-only frames

2 participants