Repository navigation
[PR] fix: separate parallel CC subagent runs into their own lanes via msgid store matching (#6011) - #6067
[PR] fix: separate parallel CC subagent runs into their own lanes via msgid store matching (#6011)#6067ranxianglei wants to merge 4 commits into
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.8898-pr.6067.8f88accThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6067.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…s gate (#6067) ClaudeSidechainRow (identity-claude.ts) and fingerprintMessage (identity-harvest.ts) are used only inside their own files; the CI gate requires dropping the leading export for INTERNAL_ONLY symbols.
(ai: vllm-qwen/qwen3.8-27b) Duplicate screening: not a duplicate — a complementary follow-up. GitHub #6067 (this PR, closes #6011) and GitHub #5726 (external contributor feriaref, closes #5724) attack the same symptom family (parallel CC Task-subagent runs colliding onto one compression lane → sub-lane cache-hit collapse), but through different mechanisms: #5726 widens the content discriminator (approach "A", works today, no client dependency, separates from the first divergent cell); #6067 keys forked lanes off host-minted msgids + adds a Claude sidechain projection (approach "C-wire + C-jsonl", separates from round 1 even on byte-identical content, but needs msgid carriers ⇒ harvest on). They are complementary and stack per the KDD #11 ladder (msgid > order > hash): the id rung fires first when ids are present, the content widening stays as the fallback when ids are absent. #5726's own review thread concluded "merge A first, C-wire as a follow-up" — #6067 is exactly that follow-up. Both should land; neither supersedes the other. Labels: bug · claude-code · scope/wiring · p1 (parallel CC subagents collide onto one lane → sub-lane hit-rate collapse ~68.7% vs main ~95.0%; cost explosion plus concurrent-run state trampling ⇒ top of the p1/p2 band, consistent with the #5726 family rating). Independent re-review (read all 848+/67− diffs; did not copy existing thread conclusions)Direction — correct, root-cause (疏 not 堵). The lane-key derivation never consumed msgids: fork-exit keys were content-derived ( Regression sweep — clean (verified against live master
Test teeth — both halves covered, positive + negative: resolver suite T1 (fails pre-fix: 3 runs collide) / T1-control (pins the exact bug without ids) / T2 (no cross-bind) / T3 (bounded split on compaction) / T4 (raw-rescue precedence) / T5 (restart) / T6 (malformed degrade) / T7 (aux never anchors); sidechain suite covers bind-by-fingerprint, wrong-content→null, identical-text-ambiguous→whole-turn-null, unstructured-degrade-while-main-intact, and per-thread continuity + store-rewrite detection. Meets gate discipline #3617 (both directions) and §7.4 criterion 2. CI (live, head Findings (non-blocking)
结构化八问
收工判定:方向正确、diff 干净(全为本 PR 目的)、回归面受控且已披露、测试两半均有牙、CI 进行中 0 失败。触碰身份/会话绑定逻辑 → §7.4 人工审批范畴,不适用自动合并。CI 转绿后可合,由你执行;Finding 1 建议顺手惰性化或补披露,不强求本轮。 |
ff1de9d to
11c4c18
Compare
…s gate (#6067) ClaudeSidechainRow (identity-claude.ts) and fingerprintMessage (identity-harvest.ts) are used only inside their own files; the CI gate requires dropping the leading export for INTERNAL_ONLY symbols.
Conflict resolved and rebased onto current master — merge state went dirty → blocked (conflict gone; "blocked" is just the branch-protection gate waiting on required checks). No design decision was needed; this was a purely mechanical rebase + conflict resolution. 七问 summary
|
…d store matching (#6011)
11c4c18 to
9943e44
Compare
|
(ai: vllm-qwen/qwen3.8-27b) Verdict: REQUEST_CHANGES — the head implements the design the owner rejected in-thread (2026-11-10T01:17Z); independent verification confirms all three rejection points against the code. The agreed redo (same branch, in place) is the right path; this review pins down what the new head must satisfy. Independent verification of the owner's three points
Additional findings (required in the redo)
No fix commits were pushed: the branch is mid-redo by the author (in-place rewrite announced in-thread ~1h ago) and pushing now would fork the active working tree. Findings 1–3, 5, 6 are resolved by the planned redo itself; finding 4 belongs in the seam files the redo rewrites. All are carried here as conditions and will be verified line-by-line when the new head lands. What is sound (keep in the redo)
Conditions for the new head
Hard rules: no kernel/ changes (verified — the body's 中文八问
判定:REQUEST_CHANGES —— 当前 head 不可合;等原地重做的新 head 落地后按上述条件逐项复审。 |
[bot] 🏷 Review complete → REQUEST_CHANGES (head 11c4c18): the shipped design is the owner-rejected one — parallel skeleton-anchor ledger instead of the standard sessionId+msgid unified-store matching chain, fp16-truncated mint key, compaction-fragile 16-anchor window; all three rejection points independently verified in code, plus one extra finding (eager per-message sha256 ahead of the harvest gate costs every production CC request CPU while the feature is off). No fix commits pushed — branch is mid-redo by the author; full review with five redo conditions posted on the PR: #6067 (comment) . Awaiting the in-place redo head for re-review. No kernel/ changes; merge stays human-gated per §7.4. |
… review) The handle.ts caller computed fingerprintMessageTexts(openaiLike) eagerly on every client-provided-id request before calling harvestIdentity, so all CC traffic paid sha256 over full message texts even with harvesting off everywhere (rollout 0%, no env). IdentityHarvestCtx.messageFingerprints becomes computeMessageFingerprints, a lazy provider invoked only after every registry gate passed AND the claude adapter matched a file containing sidechain rows; files without sidechain rows never hash at all. Pure lazification, zero semantic change; adds the negative-direction gate test (provider must not run while gates are off, #3617 both-directions discipline).
…review) The redo indented item 3 'Availability.' by three spaces, so GFM parses it as a nested list under item 2 'Data locality' — a rendering regression of the very list this section documents. Restore column-0 sibling indent as on master.
|
(ai: vllm-qwen/qwen3.8-27b) Re-review at head Merge stays human-gated per AGENTS.md §7.4 — identity/session-binding logic is never auto-merge territory. Note: this account IS the PR author, so GitHub rejects a formal review verdict here (self-review forbidden); this comment carries the full review in its place. All five v1 findings verified against the new head (
|
Review complete at new head cb2c9ce: APPROVE — all five v1 findings verified resolved against the redo (unified-store msgid matching with full anchor-ledger revert, full-id mint keys, pin-gate extension, compaction-proof retired-row matching, consistent docs/tests); two small findings fixed on spot on the PR branch (lazy fingerprint hashing behind registry gates + docs list-indent restore, commits 3495d00/cb2c9ce; targeted 34/34 + typecheck clean, CI green at pre-fix head 9943e44); full review posted as PR comment (formal review API blocked: bot account is the PR author) and merge stays human-gated per §7.4 — #6067 (comment) |
(ai: vllm-qwen/qwen3.8-27b) Status closeout — nothing new to act on. This wake was the mirror-sync echo of the APPROVE review posted above (full eight-question review lives in that comment / on PR #6067); no new owner input arrived. Re-verified against live state just now:
Review position stands: APPROVE — all five v1 findings verified resolved against the redo (unified-store msgid matching with the parallel anchor ledger fully reverted, full-id mint keys, pin-gate option B, compaction-proof retired-row matching, docs/tests consistent). Merge stays human-gated per §7.4 (identity/session-binding logic never auto-merges) — yours to execute once CI is green. |
….md (#6067 review) The shared-discipline bullet described the role check as a bounded "spot-check up to 4 positions". The 4-position window existed only at file creation (34dbcc2) and was removed by d29c73c (#5865); current behavior is a full role-sequence check over every position where both sides expose a role (rolesAlign, src/identity-harvest.ts). Doc-only.
(ai: vllm-qwen/qwen3.8-27b) Verdict: APPROVE (head Process note: the bot account is this PR's author, so the formal GitHub review API rejects self-review; as in the previous round, this comment carries the full review. Independent end-to-end re-review (merge-base
Behavior changes disclosed (old → new):
已顺手修:docs/identity-channels.md:85 把共享纪律写成 “boundary role spot-check up to 4 positions” —— 4 位窗口只存在于文件创建时(34dbcc2d04),d29c73c1cf(#5865)已移除,现行行为是全序列角色检查;已改为与 CI (mirror cache, new head Merge: human-gated per §7.4 (identity/session-binding logic — auto-merge forbidden). No config surface added; no kernel changes. 八问:
判定:可合并(APPROVE),合并按 §7.4 由人工执行(身份/会话绑定逻辑,禁自动合并)。 |
(ai: vllm-qwen/qwen3.8-27b) Status after process restart: nothing lost or blocked — the full APPROVE review (with 八问 and the 已顺手修 receipt, commit 2acea50) is posted above and the coordination line is filed on #4599. CI on head 2acea50: 0 failures. Only remaining step is the human merge (§7.4, identity/session-binding logic). No further action needed from anyone else. |
Closes #6011
Problem
Claude Code standalone (proxy mode) runs many parallel Task subagents under one conversation id. All of them share byte-identical first user cells (Task boilerplate), so the D1-B discriminator (first user message fragment) is identical across runs — every subagent request lands on ONE persona lane
<rawId>|sub:<fp16(tag)>:<fp16(disc)>. Concurrent runs merge into a single session: cache-prefix thrashing (in the reporter's log the sub lane is ~31% of input volume and ~74% of non-cached cost), birth-time preflight stalls, cross-run contamination.How (three parts)
1. Acquisition — the Claude adapter projects sidechain threads out of the transcript JSONL:
isSidechain: truerows are grouped into chains byparentUuidback-walk from tail rows, and a sidechain request binds to exactly one chain only when its full-tail content fingerprints match that chain's tail (and the main-thread tail does not). Ambiguity or mismatch ⇒ whole turn degrades (no ids), never guesses. Gates unchanged: rolloutidentityChannelHarvest(currently 0%) or envBILI_IDENTITY_HARVEST, loopback only.2. Pin-gate extension — verified-HARVEST ids now pin onto canonical rows regardless of pluginMode /
pluginLaneServerHistorycohort. The harvest registry already enforced rollout-or-env × loopback × full content verification upstream, so harvested ids are as trustworthy as stamped ones; without this, CC-standalone (proxy mode) lanes never accumulated pinned rows and store-overlap rungs could never fire for them. Stamped (body/header) traffic keeps the old double gate unchanged.3. Consumption = standard sessionId+msgid store matching — a new sub-lane rung (
trySiblingLane) fires at all three fork exits AFTER the raw-key rescue and BEFORE the legacy mint. Candidates = skeleton-table<rawId>|sub:*keys ∪ unified-store session list prefix-filtered the same way; per candidate it reads the PINNED rows (live AND retired — retire-don't-delete, so client compaction cannot erase matchability) with the existing indexedsession_id + msg_id IN (...)query. Exactly one candidate overlapping ≥1 incoming id ⇒continueon that lane; several overlap ⇒ warn + degrade to fresh mint (never guess); none ⇒ mint<rawId>|sub:m:<first inbound id>— the FULL untruncated id (host-minted uuids are unique by construction; no fp16 truncation). Requests without ids take the legacy key shapes byte-identically. No parallel ledger: the skeleton table supplies candidate KEYS only; the id truth stays in the unified store (the documented "no parallel JSON ledger is kept" principle in handle.ts).Behavior changes (old → new)
<rawId>|sub:<fp16(tag)>:<fp16(disc)>lane → merged histories, cache thrash. New: each run gets its own<rawId>|sub:m:<first host id>lane from round 1 and continues on it via store-overlap. Gated behind the harvest opt-in (off everywhere today).<rawId>|sub:<fp16(tag)>:<fp16(disc)>or<rawId>|sub:task:<skel8>even when msgids were present (ids fed only the raw rescue). New:<rawId>|sub:m:<first inbound id>. Previously-colliding strangers now separate; previously-stable lanes get new keys on their next fork. Restart-stable (same first id ⇒ same key). D1-C token lanes unaffected (the token rung precedes).Config surface
None. Rides the existing rollout
features.identityChannelHarvest(currently 0%) + existing envBILI_IDENTITY_HARVEST+ loopback-only rule. Activation is an owner action; until then nothing changes except behavior change 2 above (stamped plugin lanes).Tests
kernel-change: N/A (host-side only; kernel/ untouched)
Identity-logic change — human review required (§7.4), no auto-merge.