You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Google Gemini is untracked: no conversation id, so nothing is folded or compressed #866
bili terminates TLS for generativelanguage.googleapis.com and forwards the POSTs, but a Gemini conversation is invisible to everything downstream of detection. Every turn is logged as an anonymous forward while the other wires log a session-scoped processTurn:
Consequences observed on a live session: no conversation id is minted, prefix affinity never links the turns into one session, the nudge never computes growth, ACP compression never fires, and usage is not accounted. The client's own compaction is cancelled by the plugin by design (session_before_compact returns {cancel:true} for reason threshold or overflow), so with the proxy also unable to compact, nothing compacted and the context reached 339k tokens, holding large tool results (135 KB DOM dumps) verbatim.
Cause: protocol detection matched only /chat/completions, /v1/messages and /responses. Gemini's /v1beta/models/<model>:streamGenerateContent matched none of them, so protocol came back null, the kernel path was skipped, and the request was forwarded byte for byte. Client identity cannot be taken from a header here either: the client stamps a session header only for the anthropic and openai wires, so a Gemini session has to be recognised by prefix affinity over contents.
What has to be supported for this wire to behave like the others:
Detection and model resolution from the path (:generateContent, :streamGenerateContent, :countTokens), and a window entry for the Gemini 3 line.
A conversation identity for anonymous Gemini traffic, by prefix affinity over contents.
Folding and re-emission on that wire, keeping systemInstruction, the alternating roles, thoughtSignature round-trips and named functionResponse pairing valid, plus tool declarations in the flat {name, description, parameters} shape.
Usage accounting from usageMetadata (input = promptTokenCount minus cachedContentTokenCount, output = candidatesTokenCount plus thoughtsTokenCount), and the output budget mapped to generationConfig.maxOutputTokens.
The auxiliary paths: tag stripping, image estimation, in-band truncation, the fake-completion hint, countTokens, and the preflight summary call.
Expected: a Gemini session shows up in /acp panel with a conversation id, gets nudged and folded like the other wires, and reports usage instead of staying anonymous.
The fix is already filed as PR #867 (branch 2026-09-16_866-google-wire). Please review there rather than implementing a parallel change. Note its CI fails at npm run typecheck with TS2305: Module 'acp-kernel/wire' has no exported member 'GoogleRequestBody' because acp-kernel is pinned at 0.0.74: it needs a kernel release carrying the codec (kernel PR #318) plus the deps: bump acp-kernel commit this repository makes after each release.
[bot] 🏷 Review of PR #867 — verdict + what is actually blocking CI
Reviewed PR #867 head e377eb9 (5 commits, 23 files, +2425/−103) against current master. No parallel implementation touched.
Code verdict: solid. The diff mirrors the other wires' architecture faithfully and covers every item in the OP spec:
detection + model-from-path (googlePathKind / googleModelFromPath, requestModel = body ?? path at every model-keyed site);
identity via conversationSignalGoogle with the anonymous prefix-affinity fallback over contents;
folding in prepareGoogle: systemInstruction hoisted out of the fold space, coreToGoogle re-emission under role alternation, thoughtSignature round-trip through ToolCallEmit/reasoning replay, name-basedfunctionResponse pairing (the live 400 fix), flat functionDeclarations injection, nudge merged into the trailing non-model content;
accounting exactly as specified (input = promptTokenCount, which already includes cachedContentTokenCount; output = candidatesTokenCount + thoughtsTokenCount), Gemini 3 window row, budget mapped to generationConfig.maxOutputTokens;
Latent edge case in src/loop/adapter-google.ts (parseStream): the guard that keeps a text event from forwarding a chunk which also carries a functionCall part only counts calls seen before the text part in iteration order. If one chunk holds [text, functionCall] (text first), the text event forwards the whole chunk and the settle-time replay forwards it again → the client sees the text/call twice. The tag-filtered-text branch is worse: its raw keeps every sibling part, so a proxy tool call could leak to the client even when settle drops the chunk. Real Gemini streams usually isolate functionCall parts in their own chunk, so severity is low-medium, but it is a wire-fidelity hazard. Suggested fix: precompute hasCallPart over the chunk's parts and suppress raw on both branches when it is set (the core then synthesizes the frame via emitText). I can push this as a commit on the PR branch alongside the dep bump below.
Cosmetic: cloneChunk yields a content without role for finish-only chunks (harmless in practice).
CI failure — confirmed locally, and the blocker sits one step further upstream than stated. Reproduced on the PR head with acp-kernel 0.0.74: typecheck fails with ~22 errors. GoogleRequestBody is only one of them — the missing exports are also coreToGoogle, googleToCore, googleSystemText, injectGoogleSystem, conversationSignalGoogle, GoogleContent, GoogleFunctionDeclaration, GoogleSystemInstruction, GoogleTool, GooglePart (from acp-kernel/wire) and COMPRESS_TOOL_GOOGLE / DECOMPRESS_TOOL_GOOGLE / SEARCH_CONTEXT_TOOL_GOOGLE / ACP_STATUS_TOOL_GOOGLE / ACP_TOOLS_GOOGLE / ABSORB_TOOL_GOOGLE (from the acp-kernel root), plus one cascading TS7006 at src/server.ts:2269. Single root cause: the pinned kernel predates the codec.
The key point: there is no kernel release to bump to yet. Verified just now:
npm acp-kernel@latest is 0.0.75, and I packed the tarball: its dist/ contains none of the exports above, and there is no pr-318 prerelease tag either.
So the sequence is: merge kernel PR #318 (human-only) → kernel release published by CI → then the deps: bump acp-kernel commit lands on this PR. PR #867 has allow edits by maintainers enabled, so as soon as the version is live on npm I can push the bump commit (exact pin + lockfile refresh, per repo convention) to joshwapohlmann:2026-09-16_866-google-wire and re-run the checks myself.
Bottom line: code approved pending the kernel release; nothing in this PR blocks that step. Ping me once #318 is merged/released and I'll land the bump.
[bot] 🏷 Review of PR #867 — verdict + what is actually blocking CI
Reviewed PR #867 head e377eb9 (5 commits, 23 files, +2425/−103) against current master. No parallel implementation touched.
Code verdict: solid. The diff mirrors the other wires' architecture faithfully and covers every item in the OP spec: detection + model-from-path (googlePathKind / googleModelFromPath, requestModel = body ?? path); identity via conversationSignalGoogle with the anonymous prefix-affinity fallback over contents; folding in prepareGoogle (systemInstruction hoisted out of the fold space, coreToGoogle re-emission under role alternation, thoughtSignature round-trip through ToolCallEmit/reasoning replay, name-basedfunctionResponse pairing, flat functionDeclarations injection, nudge merged into the trailing non-model content); accounting exactly as specified (input = promptTokenCount, which already includes cachedContentTokenCount; output = candidatesTokenCount + thoughtsTokenCount), Gemini 3 window row, budget mapped to generationConfig.maxOutputTokens; aux paths: tag stripping (SSE and JSON-array streaming forms), inlineData/fileData image estimates, historical image stripping, in-band error/truncation frames, fake-completion hint, countTokens pruning, and the preflight summary call incl. the response-shape-driven SSE parse fix (#829 mirror case).
Two review findings:
Latent edge case in src/loop/adapter-google.ts (parseStream): the guard that keeps a text event from forwarding a chunk which also carries a functionCall part only counts calls seen before the text part in iteration order. If one chunk holds [text, functionCall] (text first), the text event forwards the whole chunk and the settle-time replay forwards it again → the client sees the text/call twice. The tag-filtered-text branch is worse: its raw keeps every sibling part, so a proxy tool call could leak to the client even when settle drops the chunk. Real Gemini streams usually isolate functionCall parts in their own chunk, so severity is low-medium, but it is a wire-fidelity hazard. Suggested fix: precompute hasCallPart over the chunk's parts and suppress raw on both branches when it is set (the core then synthesizes the frame via emitText). I can push this as a commit on the PR branch alongside the dep bump below.
Cosmetic: cloneChunk yields a content without role for finish-only chunks (harmless in practice).
CI failure — confirmed locally, and the blocker sits one step further upstream than stated. Reproduced on the PR head with acp-kernel 0.0.74: typecheck fails with ~22 errors. GoogleRequestBody is only one of them — the missing exports are also coreToGoogle, googleToCore, googleSystemText, injectGoogleSystem, conversationSignalGoogle, GoogleContent, GoogleFunctionDeclaration, GoogleSystemInstruction, GoogleTool, GooglePart (from acp-kernel/wire) and COMPRESS_TOOL_GOOGLE / DECOMPRESS_TOOL_GOOGLE / SEARCH_CONTEXT_TOOL_GOOGLE / ACP_STATUS_TOOL_GOOGLE / ACP_TOOLS_GOOGLE / ABSORB_TOOL_GOOGLE (from the acp-kernel root), plus one cascading TS7006 at src/server.ts:2269. Single root cause: the pinned kernel predates the codec.
The key point: there is no kernel release to bump to yet. Verified just now:
npm acp-kernel@latest is 0.0.75, and I packed the tarball: its dist/ contains none of the exports above, and there is no pr-318 prerelease tag either.
So the sequence is: merge kernel PR #318 (human-only) → kernel release published by CI → then the deps: bump acp-kernel commit lands on this PR. PR #867 has allow edits by maintainers enabled, so as soon as the version is live on npm I can push the bump commit (exact pin + lockfile refresh, per repo convention) to joshwapohlmann:2026-09-16_866-google-wire and re-run the checks myself.
Bottom line: code approved pending the kernel release; nothing in this PR blocks that step. Ping me once #318 is merged/released and I'll land the bump.
Activity
docs: cite the filed numbers in the native Google/Gemini wire changel…
joshwapohlmann commentedon Sep 16, 2026
The fix is already filed as PR #867 (branch
2026-09-16_866-google-wire). Please review there rather than implementing a parallel change. Note its CI fails atnpm run typecheckwithTS2305: Module 'acp-kernel/wire' has no exported member 'GoogleRequestBody'becauseacp-kernelis pinned at0.0.74: it needs a kernel release carrying the codec (kernel PR #318) plus thedeps: bump acp-kernelcommit this repository makes after each release.ranxianglei commentedon Sep 16, 2026
[bot] 🏷 Review of PR #867 — verdict + what is actually blocking CI
Reviewed PR #867 head
e377eb9(5 commits, 23 files, +2425/−103) against current master. No parallel implementation touched.Code verdict: solid. The diff mirrors the other wires' architecture faithfully and covers every item in the OP spec:
googlePathKind/googleModelFromPath,requestModel = body ?? pathat every model-keyed site);conversationSignalGooglewith the anonymous prefix-affinity fallback overcontents;prepareGoogle:systemInstructionhoisted out of the fold space,coreToGooglere-emission under role alternation,thoughtSignatureround-trip throughToolCallEmit/reasoning replay, name-basedfunctionResponsepairing (the live 400 fix), flatfunctionDeclarationsinjection, nudge merged into the trailing non-model content;promptTokenCount, which already includescachedContentTokenCount; output =candidatesTokenCount+thoughtsTokenCount), Gemini 3 window row, budget mapped togenerationConfig.maxOutputTokens;inlineData/fileDataimage estimates, in-band error/truncation frames, fake-completion hint,countTokenspruning, and the preflight summary call incl. the response-shape-driven SSE parse fix ([preflight] responses 协议 overhead 估算漏计 input[] 内的 developer/system 消息:codex 请求被系统性低估整个 system prompt #829 mirror case).Two review findings:
src/loop/adapter-google.ts(parseStream): the guard that keeps a text event from forwarding a chunk which also carries afunctionCallpart only counts calls seen before the text part in iteration order. If one chunk holds[text, functionCall](text first), the text event forwards the whole chunk and the settle-time replay forwards it again → the client sees the text/call twice. The tag-filtered-text branch is worse: itsrawkeeps every sibling part, so a proxy tool call could leak to the client even when settle drops the chunk. Real Gemini streams usually isolatefunctionCallparts in their own chunk, so severity is low-medium, but it is a wire-fidelity hazard. Suggested fix: precomputehasCallPartover the chunk's parts and suppressrawon both branches when it is set (the core then synthesizes the frame viaemitText). I can push this as a commit on the PR branch alongside the dep bump below.cloneChunkyields acontentwithoutrolefor finish-only chunks (harmless in practice).CI failure — confirmed locally, and the blocker sits one step further upstream than stated. Reproduced on the PR head with acp-kernel 0.0.74: typecheck fails with ~22 errors.
GoogleRequestBodyis only one of them — the missing exports are alsocoreToGoogle,googleToCore,googleSystemText,injectGoogleSystem,conversationSignalGoogle,GoogleContent,GoogleFunctionDeclaration,GoogleSystemInstruction,GoogleTool,GooglePart(fromacp-kernel/wire) andCOMPRESS_TOOL_GOOGLE/DECOMPRESS_TOOL_GOOGLE/SEARCH_CONTEXT_TOOL_GOOGLE/ACP_STATUS_TOOL_GOOGLE/ACP_TOOLS_GOOGLE/ABSORB_TOOL_GOOGLE(from theacp-kernelroot), plus one cascading TS7006 atsrc/server.ts:2269. Single root cause: the pinned kernel predates the codec.The key point: there is no kernel release to bump to yet. Verified just now:
acp-kernel@latestis 0.0.75, and I packed the tarball: itsdist/contains none of the exports above, and there is nopr-318prerelease tag either.So the sequence is: merge kernel PR #318 (human-only) → kernel release published by CI → then the
deps: bump acp-kernelcommit lands on this PR. PR #867 has allow edits by maintainers enabled, so as soon as the version is live on npm I can push the bump commit (exact pin + lockfile refresh, per repo convention) tojoshwapohlmann:2026-09-16_866-google-wireand re-run the checks myself.Bottom line: code approved pending the kernel release; nothing in this PR blocks that step. Ping me once #318 is merged/released and I'll land the bump.
中文摘要:PR #867 代码审查通过(实现完整、与其他 wire 架构一致;另发现一个低概率的“同一 chunk 混合 text+functionCall 时双重转发”边界问题,已给出修法,可随依赖升级一并提交)。CI 红的原因已在本地复现并确认:acp-kernel 0.0.74 缺少 Gemini codec(缺失导出远不止 GoogleRequestBody 一个)。更关键的是——目前连可升级的版本都不存在:kernel PR #318 尚未合并,npm 最新的 0.0.75 经解包验证也不含该 codec。等 #318 合并并发布后,我可以直接把
deps: bump acp-kernelcommit 推到 PR 分支并复跑 CI,届时即可合并。ranxianglei commentedon Sep 16, 2026
[bot] 🏷 Review of PR #867 — verdict + what is actually blocking CI
Reviewed PR #867 head
e377eb9(5 commits, 23 files, +2425/−103) against current master. No parallel implementation touched.Code verdict: solid. The diff mirrors the other wires' architecture faithfully and covers every item in the OP spec: detection + model-from-path (
googlePathKind/googleModelFromPath,requestModel = body ?? path); identity viaconversationSignalGooglewith the anonymous prefix-affinity fallback overcontents; folding inprepareGoogle(systemInstructionhoisted out of the fold space,coreToGooglere-emission under role alternation,thoughtSignatureround-trip throughToolCallEmit/reasoning replay, name-basedfunctionResponsepairing, flatfunctionDeclarationsinjection, nudge merged into the trailing non-model content); accounting exactly as specified (input =promptTokenCount, which already includescachedContentTokenCount; output =candidatesTokenCount+thoughtsTokenCount), Gemini 3 window row, budget mapped togenerationConfig.maxOutputTokens; aux paths: tag stripping (SSE and JSON-array streaming forms),inlineData/fileDataimage estimates, historical image stripping, in-band error/truncation frames, fake-completion hint,countTokenspruning, and the preflight summary call incl. the response-shape-driven SSE parse fix (#829 mirror case).Two review findings:
src/loop/adapter-google.ts(parseStream): the guard that keeps a text event from forwarding a chunk which also carries afunctionCallpart only counts calls seen before the text part in iteration order. If one chunk holds[text, functionCall](text first), the text event forwards the whole chunk and the settle-time replay forwards it again → the client sees the text/call twice. The tag-filtered-text branch is worse: itsrawkeeps every sibling part, so a proxy tool call could leak to the client even when settle drops the chunk. Real Gemini streams usually isolatefunctionCallparts in their own chunk, so severity is low-medium, but it is a wire-fidelity hazard. Suggested fix: precomputehasCallPartover the chunk's parts and suppressrawon both branches when it is set (the core then synthesizes the frame viaemitText). I can push this as a commit on the PR branch alongside the dep bump below.cloneChunkyields acontentwithoutrolefor finish-only chunks (harmless in practice).CI failure — confirmed locally, and the blocker sits one step further upstream than stated. Reproduced on the PR head with acp-kernel 0.0.74: typecheck fails with ~22 errors.
GoogleRequestBodyis only one of them — the missing exports are alsocoreToGoogle,googleToCore,googleSystemText,injectGoogleSystem,conversationSignalGoogle,GoogleContent,GoogleFunctionDeclaration,GoogleSystemInstruction,GoogleTool,GooglePart(fromacp-kernel/wire) andCOMPRESS_TOOL_GOOGLE/DECOMPRESS_TOOL_GOOGLE/SEARCH_CONTEXT_TOOL_GOOGLE/ACP_STATUS_TOOL_GOOGLE/ACP_TOOLS_GOOGLE/ABSORB_TOOL_GOOGLE(from theacp-kernelroot), plus one cascading TS7006 atsrc/server.ts:2269. Single root cause: the pinned kernel predates the codec.The key point: there is no kernel release to bump to yet. Verified just now:
acp-kernel@latestis 0.0.75, and I packed the tarball: itsdist/contains none of the exports above, and there is nopr-318prerelease tag either.So the sequence is: merge kernel PR #318 (human-only) → kernel release published by CI → then the
deps: bump acp-kernelcommit lands on this PR. PR #867 has allow edits by maintainers enabled, so as soon as the version is live on npm I can push the bump commit (exact pin + lockfile refresh, per repo convention) tojoshwapohlmann:2026-09-16_866-google-wireand re-run the checks myself.Bottom line: code approved pending the kernel release; nothing in this PR blocks that step. Ping me once #318 is merged/released and I'll land the bump.
中文摘要:PR #867 代码审查通过(实现完整、与其他 wire 架构一致,覆盖 OP 全部要求;另发现一个低概率的"同一 chunk 混合 text+functionCall 时双重转发"边界问题,已给出修法,可随依赖升级一并提交)。CI 红的原因已在本地复现并确认:acp-kernel 0.0.74 缺少 Gemini codec(缺失导出远不止 GoogleRequestBody 一个)。更关键的是——目前连可升级的版本都不存在:kernel PR #318 尚未合并,npm 最新的 0.0.75 经解包验证也不含该 codec。等 #318 合并并发布后,我可以直接把
deps: bump acp-kernelcommit 推到 PR 分支并复跑 CI,届时即可合并。ranxianglei commentedon Sep 17, 2026
继续
docs: cite the filed numbers in the native Google/Gemini wire changel…
docs: cite the filed numbers in the native Google/Gemini wire changel…
docs: cite the filed numbers in the native Google/Gemini wire changel…
Merge pull request #867 from joshwapohlmann/2026-09-16_866-google-wire