Repository navigation
[PR] fix: recognize the claude code title sidecar so it never claims the raw session id (#5136) - #5137
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.7426-pr.5137.8b19ae9This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5137.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。本 PR 即 #5136 的修复 PR(Closes #5136);在途 PR 中无其他触碰同一机制(CC title sidecar 认领原始 id 锚点)的条目。相关但分开处理:#4840/#4843(Claude Desktop 通知分类器,同机制家族但客户端与症状不同——usage 污染、无 fork,且其 system 文本非 标签:bug / claude-code / scope/wiring / p2 —— 缺陷类;主会话压缩状态本身没丢(|sub 车道折叠正常),问题是按 id 查会话命中近空标题车道、主车道标题错乱;能用但有明显错位且有绕行,不升 p1。 CI 现状(head f690e09):静态门禁全绿(static-gates/kernel-guard/lane-guard/unused-exports/config-surface-guard/lock-sync/docs-* 等);test 分片 1 红(windows-latest, node 22, shard 1)+ 10 片运行中。master 当前自身为红(#4599:hermetic data-root 集群 #5107/#5115/#5120,ci-fixes@cf99d93 已 49/49 全绿,载体 PR #5133 等人工合并)。我会核对那一片红的签名是否为继承性失败,若是则把 ci-fixes 并入本分支重跑。 代码审查进行中,结论随后补。 |
(ai: vllm-qwen/qwen3.8-27b) Review 结论:可合(需人工合并——触碰身份/会话绑定逻辑,§7.4 human-only)。diff 已独立通读(4 文件,+383/-5),关键路径逐段核过,未照抄 issue 侧描述。 我做的验证动作:
八问:
行为变更披露(独立核对,与 PR 正文一致):旧(v0.1.209)标题调用在 raw id 下走完整管道——计入请求统计、认领锚点、导致主会话永久分叉;新:识别为 side request → 字面 id 解析 + passthrough,kernel 状态不变、不计入会话统计。受影响人群仅限「CC 会话源证据 ∧ 精确一次性标题形状」的字节,其余流量逐字节不变(负向行已钉死)。 测试有效性:断言有牙——预修形态 raw key requests=1/会话数=2,修后 0/1,负向对照(仅回退 handle.ts 接线即红)作者已验证;真值表正反双向(#3617 纪律);live race 测试走真实 server + mock SSE、hermetic 状态 + randomUUID + port 0,deterministic。小缺口(不拦):responses/google wire 的标题形状只有单测级钉住、无 live e2e(CC CLI 只走 anthropic wire,可接受)。 CI:静态门禁全绿;test 分片红为继承性(master 自身红,#5133 载体等待人工合并期间),已并 ci-fixes 重跑,等新 head 全绿即可合。 |
|
(ai: vllm-qwen/qwen3.8-27b) Off-by-one issue reference found while fixing the sibling PR #5136 (its reporter @kuviki flagged the same class of mistake there): This PR's body says Suggested correction: Not editing this PR myself — that lane owns it; flagging so the merge doesn't leave #5135 unclosed. |
(ai: vllm-qwen/qwen3.8-27b) 已核实并修掉。先查证(只读 API):上游 #5135 = 本 PR 修的原 bug([Bug] 0.1.209: Claude Code CLI main conversation forks onto 已做两处修正:
刻意不动的三处:
新 head |
…aw session id (#5136) Claude Code CLI fires its session-title call ~1ms ahead of the first main turn under the SAME x-claude-code-session-id. Since #4774 (v0.1.209) that header-less traffic rides the persona order resolver, and the title call — own system prompt, single <session>-wrapped user blob, no tools, budget past the <=200 heuristic — claimed the raw id as kernel anchor on the virgin id; the main turn then arrived tagChanged and history-disjoint and forked onto a |sub:<fp> lane for the session lifetime (#2156 form: side requests must never claim the anchor). New shape predicate isClaudeCodeTitleRequest in src/server/side-request.ts (no-tools veto + exactly one user entry whose text starts with the <session> wrapper), wired into both lane gates in handle.ts behind the claude-code conversation-source evidence gate: sideRequestLike keeps it off the resolver (verbatim iding) and sideIntent routes it through the #388 passthrough (kernel state untouched). Precedents: #2503 dsh title, #4438 dsh auto-review. Tests: tests/issue5136-claude-title-sidecar.test.ts (predicate truth table + live race in both arrival orders + client-evidence negative; verified to fail against the pre-fix wiring) and row (M) in tests/side-lane-invariants.test.ts (#2170 lane-guard pairing).
…r was #5136) The bug report's upstream GitHub number is #5135; the working session had cited the mirror-side number (#5136, which upstream is an unrelated PR) in source comments, test names and the regression-test file name. Renumber all citations so post-merge references resolve to the real issue. Fixture ids (cc5136*) are opaque data and stay untouched.
0675eae to
3153398
Compare
Summary
Fixes the v0.1.209 regression introduced by #4774: Claude Code CLI fires its session-title call ~1ms ahead of the first main turn under the SAME
x-claude-code-session-id. Since #4774 routes that header-less anthropic traffic through the persona order resolver, the title call — own system prompt, single<session>-wrapped user blob, no tools, output budget past the ≤200 heuristic — claimed the raw session id as kernel anchor on the virgin id; the real conversation then arrived tagChanged and history-disjoint and forked onto|sub:<fp>for the session lifetime. This is the #2156 violation form: side requests must never claim the anchor.What changed
src/server/side-request.ts: new shape predicateisClaudeCodeTitleRequest(+CLAUDE_CODE_TITLE_SESSION_TAG) — wire-generic likeisDshAutoReviewRequest(messages/input/contents): no-tools veto, exactly ONE entry, role user, text starts with the<session>wrapper.src/server/handle.ts:ccTitleSidecar= evidence gate (claudeAnthropicPersonaOrderApplies, i.e. winning conversation source isx-claude-code-session-id) ∧ shape ∧ explicit-main veto. Wired into BOTH lane gates:sideRequestLike(verbatim iding — no anchor claim, [bug] dsh:side request 先到会抢走 persona 锚点,主会话被 fork 到 |sub:<fp>,原生 compress 永久失败 #2156) andsideIntent/sideLabel(标题生成等侧请求污染主会话状态:prepareAnthropic 缺 isTitleGen 守卫、快照无条件覆盖、survivedCount 每请求空转 #388 passthrough — kernel state untouched). Precedents: dsh 0.2.1 Alpha.2更新了检查适配情况 #2503 (dsh title), [Bug][dsh] 0.1.204: auto-review side request collides with the main session → false native-compaction rebase → aux usage skips #453 clamp → permanent upstream 400 #4438 (dsh auto-review).tests/issue5135-claude-title-sidecar.test.ts(predicate truth table, live race in BOTH arrival orders, client-evidence negative) + row (M) intests/side-lane-invariants.test.ts(dsh 回归防护:泳道判定真值表 + 侧请求不变量 + dsh e2e lane + 运行时金丝雀 + lane-guard(5 项) #2170 lane-guard pairing; import allowlist updated).Negative control: with only the
handle.tswiring reverted to pre-fix, the two race tests fail with the reported shape (title counted on the raw id, main conversation forked); with the fix, all green.Behavior change (old → new)
|sub:<fp>permanently.x-claude-code-session-idAND match the exact one-shot title shape (single<session>-wrapped user message, no tools). Every other byte of traffic is unchanged (negative rows pinned).Config surface
None. No new config field, env var, or CLI flag.
Relations
<session>-wrapped. If that shape recurs, it gets its own predicate.Closes #5135
八问