Repository navigation
fix(#2598): wire #1001 unannounced-history-rewrite detection into the google lane - #2618
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2965-pr.2618.04132a4This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2618.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review 完成——可合并(CI 全绿前我按「已审完、无拦截项」判定;当前 CI 无失败,部分 job 仍在排队)。 审查过程(证据):
结构化八问:
测试有效性:新 e2e 是真测试——修复前 diff 整洁度:3 文件 +140/-2,每行都服务于 PR 目的;chore commit 独立标注,符合顺手小修规则。 结论:可合并(待你手动 merge;CI 剩余 job 若转红我再跟进)。 |
… google lane prepare-google.ts already consumed the archive+prune channel (applyCompactionArchive) but no path ever set metadata.compactionBoundary for google-lane sessions, so the channel was a permanent no-op there: a silent client history rewrite (sid unchanged) left partially-alive blocks citing vanished ids → nudge broadcasts dead refs → compress fails → breaker (#2432/#2592 failure domain). Wire the producer trio exactly as prepare-openai.ts / prepare-anthropic.ts carry it: pre-turn knownRefsBefore snapshot (before processTurn assigns fresh refs — timing invariant, detection would otherwise read ratio 1.0), the shared protocol-agnostic detectUnannouncedHistoryRewrite gate (#1075-hardened: min incoming, overlap required, ratio < 0.5, >= 20 known refs, non-empty blocks), and markCompactionBoundary + recordConflict on detection. The consumer side (applyCompactionArchive) was already in place. Regression test: google-wire e2e variant of the #1001 openai e2e in tests/fix-1001-history-rewrite.test.ts — turn-1 preflight block, silent rewrite (keep 8 / append 16), boundary marked + consumed, blocks archived with reason, byRaw pruned without ref re-issue, folded view forwarded.
…erver split Leftovers verified unused on current master (each symbol appears exactly once in src/server.ts — its own import line): applyCompactionArchive, detectUnannouncedHistoryRewrite, markCompactionBoundary (#1001 family, now home in the lane modules), reconcileNativeCompactionBoundary (#2373/#2432 family) and REWRITE_MIN_INCOMING_TOTAL (#1001 constant). No behavior change; root tsconfig has no noUnusedLocals so CI never flagged them.
8fe5bb8 to
5cf23f2
Compare
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.270-master.f12e259 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Closes #2598
What
The google lane consumed the archive+prune channel (
applyCompactionArchive,src/server/prepare-google.ts) but no path ever setmetadata.compactionBoundaryfor google-lane sessions — the channel was a permanent no-op there. A silent client history rewrite (sid unchanged) would leave partially-alive blocks citing vanished ids → nudge broadcasts dead refs → compress fails → breaker (the #2432/#2592 failure domain).This wires the producer trio exactly as
prepare-openai.ts/prepare-anthropic.tscarry it:knownRefsBeforesnapshot (beforeprocessTurnassigns fresh refs — timing invariant; detection would otherwise read ratio 1.0);detectUnannouncedHistoryRewritegate (detectUnannouncedHistoryRewrite 误判 1 条消息的侧边辅助请求(如 WebSearch),导致 Ref 映射表被洗空、编号雪崩耗尽(m99999)及 363 万 Token 溢出 #1075-hardened: ≥10 incoming, overlap required, known/incoming < 0.5, ≥20 known refs, non-empty blocks);recordConflict("unannounced-rewrite")+markCompactionBoundary. The consumer side (applyCompactionArchive) was already in place.Behavior change (disclosed)
unannounced-rewriteentries for google-lane sessions when (and only when) the detector fires.Config surface
None. No new config fields, env vars, or CLI flags.
Tests
tests/fix-1001-history-rewrite.test.ts: preflight block on turn 1 → silent rewrite (keep 8 of 24, append 16) on turn 2 → asserts boundary marked + consumed, block archived with reason,byRawpruned without ref re-issue, folded view forwarded without dead refs; turn 3 proves continued operation with unique refs.tests/fix-1001-history-rewrite.test.ts+tests/e2e-google-compress.test.ts→ 11/11 pass; typecheck clean. Full suite + codex e2e left to CI (ci.yml all-PR matrix + ci-e2e-fake.yml).Second commit (labeled minor fix, found during #2598 verification)
chore: drops five unusedsession.jsimports left insrc/server.tsby the #1440 split (applyCompactionArchive,detectUnannouncedHistoryRewrite,markCompactionBoundary,reconcileNativeCompactionBoundary,REWRITE_MIN_INCOMING_TOTAL) — each verified to appear exactly once (its own import line). No behavior change.Out of scope (tracked in the #2598 thread)
The responses lane lacks both the detector and the
applyCompactionArchiveconsumer — possibly intentional under itsprevious_response_ididentity model; owner judgment, kept as a checklist item in the issue.