Repository navigation
fix(#2694): scope pi-subagent child detection to system carriers - #2696
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2944-pr.2696.ed07205This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2696.tgz
npm install -g packageInstall instructions are refreshed on each push. |
… caller has no parsed body (#2696) Review hardening for #2694: when parsed was absent the gate re-parsed the buffer for the marker but checked grants against an undefined tools field, so a direct caller passing null with a valid body containing a namespaced ACP grant would be misdemoted despite the grant. Unreachable from the sole call site (handle.ts passes null only when the same buffer already failed JSON.parse), but the exported contract now holds standalone: signal and tools always read from the same parsed object, unparseable still fails closed. Regression test pins the parsed=null + namespaced-grant combination.
[bot] 🏷 Review done — one small fix pushed to the PR branch (commit Verified against live code (not just the diff):
Small fix I pushed directly (小问题直接修): in Regression audit (existing behaviors on touched paths):
Diff cleanliness: 5 files, every line on-purpose; en+zh CLIENTS sync present; dead-import removal is its own labeled commit; no lockfile/churn/version touch. Config surface: N/A. No 结构化八问:
合并判定:可合(等 CI 在新 head |
38d32e9 to
e30875a
Compare
… caller has no parsed body (#2696) Review hardening for #2694: when parsed was absent the gate re-parsed the buffer for the marker but checked grants against an undefined tools field, so a direct caller passing null with a valid body containing a namespaced ACP grant would be misdemoted despite the grant. Unreachable from the sole call site (handle.ts passes null only when the same buffer already failed JSON.parse), but the exported contract now holds standalone: signal and tools always read from the same parsed object, unparseable still fails closed. Regression test pins the parsed=null + namespaced-grant combination.
[bot] 🏷 Update: rebased onto current master ( What happened while CI ran: master moved ~15 commits ahead. Four jobs failed (test ubuntu-22/ubuntu-24/windows-22 + real-image billing e2e), all with the same two typecheck errors in Root cause (verified against Evidence this PR is clean on the rebased head:
Filed #2699 (来源 marker included, repro + suggested fix for the test file, to be coordinated with #2613's author). |
c7442fe to
9213b7a
Compare
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.254-master.4ecd82f # this exact build
npm install -g billion-context@master # always the newest merged build
|
Closes #2694
What
A main pi session whose HISTORY quoted the pi-subagents child marker (repo docs about subagents inside tool results / assistant text) was misclassified as a restricted child by the #2268 channel-fallback gate and demoted from plugin mode to the proxy-style channel — native ACP tool cards degraded to prose receipts even though
pi.subagentswas off and the session was a plain main conversation.Root cause:
detectPiSubagentChildSignalbyte-scanned the ENTIRE raw request body for<active_agent name=with no role/position awareness and accepted bare prefixes with empty names;handle.tsthen closed pluginMode on that signal. Second latent gap:exposesBiliInjectableTooldid not recurse into Responses-wire namespace wraps ({type:"namespace", tools:[...]}), so namespaced ACP grants were invisible to the capability check.Fix (decision source, not payload masking)
system, responsesinstructions, googlesystemInstruction.parts,messages[]/input[]role system|developer) — identical carrier list toestimateWireOverhead(src/server/budget.ts). History text can no longer flip the channel.toolsarrays (depth-capped at 8) so namespaced ACP grants count as grants.piSubagentChannelFallbackimport insrc/server.ts(only call site issrc/server/handle.ts).Behavior changes (old → new)
Every tightening fails toward "stay plugin mode" = the documented graceful degrade (pre-#2268 behavior), so an upstream format drift degrades safely instead of misrouting main sessions.
Tests
tests/pi-subagent-channel.test.ts: inverted the two expectations that encoded the bug (history-only marker, truncated marker); added carrier-shape coverage for all 4 wires, incomplete-marker cases, fail-closed cases, namespaced-grant walker + composition cases, and server-level case E where a pi-stamped MAIN session quoting the marker in history keeps plugin mode through the real pipeline. 15/15 pass locally; typecheck + build green on this head; full suite left to CI.Config surface: not applicable (no new/changed config fields). No
kernel/orpi-subagents/changes. No wire-format change — only which requests bili classifies into the existing proxy-style channel.