Repository navigation
[PR] fix: split header-less claude code subagents onto their own session lane (#4352) - #4409
Closed
ranxianglei wants to merge 1 commit into
Closed
ranxianglei wants to merge 1 commit into
ranxianglei wants to merge 1 commit into
Conversation
This was referenced Oct 23, 2026
ranxianglei
force-pushed
the
2026-10-23_claude-anthropic-subagent-split
branch
from
October 23, 2026 12:00
b60c121 to
117c331
Compare
Contributor
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.5309-pr.4409.550211fThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4409.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…ane (#4352) Claude Code builds that stamp no agent-id headers (VS Code extension) send subagent model requests under the parent session id. Their short, unrelated histories ride the parent session and destroy its fold substrate: fold-reconcile sees covered ids missing, confirms epoch destruction, and the model's compress calls die as substrate-destruction with refs recorded DEAD. The #975 two-signal gate cannot see these subagents: VS Code builds share the parent's first system block verbatim, so the main-prefix negative check fails even when the agent-id headers are present. Route claude anthropic-wire traffic (x-claude-code-session-id source, evidence allowlist in the lane-decisions registry) through the continuity-aware order resolver when the #975 gate misses: a continuing main conversation keeps the raw id on order+content evidence; a history-disjoint ride forks onto its own |sub:<fp> lane (own lock chain, own compression state); a byte-drifted system on continuing history still keeps the raw id (#1106). Gated by the existing subagentSplit knob (no new config surface); side calls and empty-system requests stay verbatim. Docs: CONFIGURATION.md/.zh-CN.md subagentSplit rows describe both paths. Tests: tests/issue4352-claude-anthropic-subagent-split.test.ts — both gate directions plus the live VS Code field shape captured in the issue comment.
ranxianglei
force-pushed
the
2026-10-23_claude-anthropic-subagent-split
branch
from
October 23, 2026 15:09
117c331 to
82e05b1
Compare
Owner
Author
|
(ai: zhipuai-lb/glm-5.3) 陈旧票清理(第三批动作①):issue [4352] 已由已合并 PR [4337] 修复。为避免重复劳动关闭本 PR;如判断有误请直接 reopen 并留言。 |
This was referenced Oct 27, 2026
ranxianglei
pushed a commit
to Mako-L/billion-context
that referenced
this pull request
Oct 28, 2026
…ane (ranxianglei#4352) Claude Code builds that stamp no agent-id headers (VS Code extension) send subagent model requests under the parent session id. Their short, unrelated histories ride the parent session and destroy its fold substrate: fold-reconcile sees covered ids missing, confirms epoch destruction, and the model's compress calls die as substrate-destruction with refs recorded DEAD. The ranxianglei#975 two-signal gate cannot see these subagents: VS Code builds share the parent's first system block verbatim, so the main-prefix negative check fails even when the agent-id headers are present. Route claude anthropic-wire traffic (x-claude-code-session-id source, evidence allowlist in the lane-decisions registry) through the continuity-aware order resolver when the ranxianglei#975 gate misses: a continuing main conversation keeps the raw id on order+content evidence; a history-disjoint ride forks onto its own |sub:<fp> lane (own lock chain, own compression state); a byte-drifted system on continuing history still keeps the raw id (ranxianglei#1106). Gated by the existing subagentSplit knob (no new config surface); side calls and empty-system requests stay verbatim. Re-applies the fix from unmerged PR ranxianglei#4409 (closed by a stale-ticket bot that misattributed the closure to ranxianglei#4337, which does not touch this path) onto current master. Closes ranxianglei#4769 (re-report of ranxianglei#4352). Tests: tests/issue4352-claude-anthropic-subagent-split.test.ts — both gate directions plus the live VS Code field shape captured in the issue comment. Docs: CONFIGURATION.md/.zh-CN.md subagentSplit rows describe both paths.
This was referenced Nov 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4352
What / why
Claude Code builds that stamp no agent-id headers (VS Code extension,
entrypoint claude-vscode) send subagent model requests under the PARENT session id. Their short, unrelated histories ride the parent session and destroy its fold substrate: fold-reconcile sees covered ids missing, confirms epoch destruction, and the model'scompresscalls die assubstrate-destructionwith refs recorded DEAD forever. The parent conversation is intact — no compaction ever happened.The #975 two-signal gate cannot see these subagents: in the live transcripts (issue comment) the parent and ALL 14 subagents send the SAME first system block verbatim ("You are Claude Code, Anthropic's official CLI for Claude, running within the Claude Agent SDK."), so the main-prefix negative check fails even when the agent-id headers ARE present. Separation must come from order+tag evidence, not prefix heuristics.
Fix
Route claude anthropic-wire traffic through the continuity-aware order resolver (#2944/#2241 — the same one dsh / codex / claude-over-Responses already use) whenever the #975 gate misses:
x-claude-code-session-id— newpersonaOrderKeyedflag on the WIRE_CLIENTS registry entry + new predicateclaudeAnthropicPersonaOrderApplies(src/session-id.ts). Every other anthropic client stays verbatim (Responses instructions fingerprint should be an allowlist (codex/claude only), not a default — generic relay clients fork on every system-prompt change #1106).<id>|sub:<fp>lane: own lock chain, own compression state, stable across successive passes of the same persona; distinct subagent systems get distinct lanes.subagentSplit: falseall stay verbatim exactly as before.personaForkedpath — the conversations map keeps the raw key owned by the main session (Subagent first token stalls 1-2min: withSessionLock covers full forward + slow flash upstream first byte #970 discipline).Behavior change (old → new)
|sub:<fp>lane.system prompt changed (11170 → 3044)→ drop → epoch →substrate-destructionchain stops firing during subagent runs; the model'scompresson parent ranges stays anchorable; refs are no longer recorded DEAD. The ~40[storage] unified shadow DIGEST DRIFTlines in the report (subagent messages written under the parent id into unified storage) are expected to disappear with the same cause — not reproducible hermetically, to be confirmed on the reporter's next subagent run.Config surface
NO new field. The existing
subagentSplit(BILI_SUBAGENT_SPLIT) semantics are EXTENDED:falsenow also disables the header-less order-resolver fallback (previously it only disabled the #975 header-pair split). Default stays ON. Rationale for not inventing a second knob: the two paths are one mechanism family ("keep claude subagent traffic off the parent session"), one escape hatch is enough. Docs updated in CONFIGURATION.md + CONFIGURATION.zh-CN.md.Both-modes reasoning
Session-keying only — no wire rewrite, no tool/nudge/summary-carrier change. Plugin mode (any
x-bili-pluginhost) is untouched: the new branch fires only when the winning conversation source IS the claude header, which plugin lanes never are (they stampx-bili-plugin-conversation, first in the source precedence). Proxy-mode claude native traffic (the affected one) runs the standard server-side compression pipeline; the forked subagent lanes simply run it under their own session state.Regression review (existing behaviors walked)
x-acp-sessionetc.) — verbatim identity preserved; negative e2e row in the new suite (two disjoint conversations under one id accumulate on ONE session, no fork minted).Tests
Targeted local runs (full-suite verdict = remote CI on the pushed head):
tests/issue4352-claude-anthropic-subagent-split.test.ts: 8/8 — gate allowlist rows (positive+negative), resolver rows incl. the LIVE VS Code shared-first-block field shape captured in the issue comment, e2e through a real server (fork + parent object untouched + opt-out + side/empty-system exemptions).npm run typecheckclean.No
kernel/changes. No config-schema or persistence-format change. Touches identity/session-binding logic → human review per §7.4.