Repository navigation
fix(#2658): dsh native-compaction rebase fallback on anthropic/google lanes - #2664
Conversation
… lanes The #2432 dual-signal detection (checkpoint framing in resent history + decimated fold coverage -> immediate ACP rebase) only landed on the openai/responses wires. Anthropic and google lanes had the server-side refusal gate but not the post-landing recovery, so any dsh checkpoint landing there (direct bypass, allowDshCompaction, future gate mismatch) left ACP state permanently unrebased: cannot-be-anchored death spiral plus persistent prefix-cache loss (#2596). Port the identical signature and rebase to both lanes, with hermetic e2e positive/negative tests.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2889-pr.2664.9127093This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2664.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review 完成(CI 全绿 + 本地定向验证)。结论:可合并(合并动作留给人工),但有一个必须处理的关联项(#2599 重复)和两个后续协调项。 结构化八问1. 是什么问题:#2432 的「dsh 本地压缩落地 → ACP 状态立即 rebase」双信号检测只落在 openai/responses 两条 wire 上;anthropic/google 两条 lane 只有服务端拒绝门( 2. 什么原因导致的:lane 覆盖不对称——#2432/#2436 修复时只把检测器移植到了当时有流量的两条 wire,拒绝门却按 wire 全覆盖写了。anthropic 是已知真实受害面(dsh 宿主 + Anthropic 兼容上游,如 DeepSeek 官方 API 的 3. 影响范围与严重程度:触发条件 = dsh 绑定会话 × anthropic/google wire × dsh 本地压缩实际落地。命中后:该会话压缩功能完全失效直到重启(cannot-be-anchored 死亡螺旋,#2432 defect 1 完整形态)+ 持续的 prefix-cache 失效(#2596 主诉)。未命中路径零影响。google 面暂无已知流量,属防御性补齐。 4. 怎么修复的:把 openai reference(prepare-openai.ts:142-155)的同一签名+rebase 逐字移植到两条 lane——gate( 5. 是否有回归问题:无。逐项过:
6. 是否破坏缓存:否。cache key 机制零触碰;命中路径反而改善了 checkpoint 落地后的 cache 稳定性(rebase 让头部重新稳定)。非命中路径无变化。 7. 是否改了设计方向:否。是把既有 #2432 机制补到剩余 lane,恢复 lane 对称性;数据流、边界不变。 8. 是否引入了新的配置:无 config/env/默认值变更;无 wire-shape 变更;无 kernel 变更;无版本号改动。 关联项(合并前请处理)
判定代码与 reference 字节级对齐、测试有牙(正例断言 boundary 置位+同请求消费、refs 精确重发、conflict ledger、无双重记录、下一 turn 可用;负例钉死两条单信号路径)、非命中路径字节级不变、stale-base 风险已实证排除、CI 全绿。可合并;建议顺序:先关 #2599 → 人工合并本 PR。 |
Drive-by (review of #2684): master's lockfile lags the in-repo component versions — acp-kernel recorded 0.0.110 while kernel/package.json is 0.0.112 (d16c341), and billion-context-pi-subagents recorded 0.1.3 while pi-subagents/package.json is 0.1.4. Align both entries to what npm install writes against current master. No dependency or content change.
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.227-master.4e6bd5f # this exact build
npm install -g billion-context@master # always the newest merged build
|
Follow-up to the v0.1.192 carve-out (ranxianglei#2664): the bugfix channel shipped with only its embedded pre-flight (typecheck+test+build) — no e2e lane ever ran on the publish sha, because no PR existed and no e2e workflow triggers on bugfix-release/** pushes. Policy (2026-10-10): no matter the release channel, the COMPLETE CI lane set must be green at the exact publish sha before npm publish. - new scripts/release-ci-gate.mjs: --dispatch: idempotently workflow_dispatch every required lane that has no run at the publish sha (or a green run at an EXTRA_MATCH_SHAS, e.g. the PR head — same semantics as branch-protection required checks, so routine PR-based releases pay zero extra CI); --wait: block until every lane's latest run at the publish sha is success; any red lane / timeout / un-dispatchable lane ⇒ exit 1, publish step never runs (fail-safe). - release.yml / release-kernel.yml: dispatch early + gate before Create tag, gated on is_release; EXTRA_MATCH_SHAS=HEAD^2 reuses PR-head runs. - release-bugfix.yml: dispatch before the pre-flight (lanes run in parallel with it) + gate after it; +actions:write. - release-manual.yml: direct path (GITHUB_TOKEN push fires no events, nothing runs CI on the release commit) gets dispatch+gate before Create tag; fallback path is already gated via release.yml after merge. - required set (override with REQUIRED_CI_WORKFLOWS): ci.yml, ci-e2e.yml, ci-e2e-fake.yml, ci-e2e-dsh.yml, ci-e2e-dsh-native.yml, ci-e2e-codex-persona.yml, ci-e2e-native.yml, ci-e2e-native-opencode.yml, ci-e2e-pi-ws.yml - tests/release-ci-gate.test.ts: 8 regression tests against an inline mock of the GitHub Actions API (no network, no token).
…anxianglei#2695) Host-side deletion of history without a compaction frame (Claude Code context editing, dsh native checkpoints on lanes without the rebase fix) orphans fold blocks. syncBlocks keeps them alive forever via arrival- order cluster ids re-derived by identical later messages, and the remint feedback loop flaps one carrier in and out every turn - permanent mid-list churn, i.e. prefix-cache misses on every request (ranxianglei#2596). Host-only fix (no kernel changes): foldCoverageByBlock records a zombie streak (z) - consecutive passes with a majority of a block's covered ids absent from the inbound. After FOLD_DRIFT_ESCALATE_PASSES such passes in proxy mode, reapDestroyedSubstrate removes the block from state.blocks (removal is sticky; active=false would be resurrected by syncBlocks), archives it via the ranxianglei#395 preCompactionArchive path (blockContents stay for derived decompress), prunes refs, strips anchors/order/coverage, and records an orphan-reap conflict event. Plugin mode is exempt (covered ids are legitimately absent after the agent's own compress). Proofs added (user request: cache proofs covering host compaction): - cache-proof HOSTCOMPACT (chat wire): decimated replay drops orphan carriers, re-arms cleanly; zombie flap bounded (regression pin - red on master: zombie rides every later fold round-2, green with reap). - cache-friendly-plugin P6 (dsh native-compaction rebase, 4 wires): checkpointed replay rebases blocks cleanly, era-stable tags, prefix append-stable after the rebase turn; red on pre-ranxianglei#2664 masters for anthropic/google. Refs ranxianglei#2596 ranxianglei#2658. Kernel root-fix proposal (remint coveredBases should scan inactive blocks; instance identity for duplicate clusters) filed in ranxianglei#2695.
v0.1.192 was a carve-out release (78df4ea, ranxianglei#2664 only) and its version bump never flowed back to master, so master still declares 0.1.191 while npm latest is 0.1.192. That trips the Release one-click Drift guard: ::error::master package.json (0.1.191) != npm latest (0.1.192) ranxianglei#2664's changes themselves are already in master (f0b3f5d), so this is metadata-only: bump package.json + package-lock.json (root and packages."" entries) to 0.1.192 so the next one-click release (0.1.193, carrying the ranxianglei#2755 fold-summary head-stability fix) can proceed.
… cap Publish Release Notes has been red since 2026-10-10: the 0.1.191 backfill entry landed at 401 chars, and the 0.1.192 backfill (f24e3e8) added a 520-char bilingual summary. The validator exits on the first offender, so both must be trimmed in the same push. - 0.1.192: 520 -> 399 (condense the bilingual pair, keep ranxianglei#2658/ranxianglei#2596/ranxianglei#2664 refs) - 0.1.191: 401 -> 392 (drop the 'ordinary ' qualifier on fold drift) Verified locally with the exact validation script from release-notes.yml (schema:1, 1..20 entries, semver, dedup, tier, <=400 summary, date) — all 14 entries pass. Fixes the failed runs: - https://github.com/ranxianglei/billion-context/actions/runs/38152721758 - https://github.com/ranxianglei/billion-context/actions/runs/38040163381
Closes #2658
What
#2432/PR #2436's dual-signal detection (dsh checkpoint framing in resent history + decimated fold coverage → immediate ACP rebase) only landed on two wires — openai chat (
prepare-openai.ts) and responses (prepare-responses.ts). The anthropic and google lanes had the server-side REFUSAL gate (dshCompactionRefusal("anthropic")exists; the gate covers that wire) but not the post-landing recovery. So any dsh checkpoint landing there — direct-bypass (agentless/background/idle contexts have no ALS attribution),allowDshCompaction: true, or a future gate mismatch — left ACP state permanently unrebased: the cannot-be-anchored death spiral (#2432 defect 1 in full form) plus persistent prefix-cache loss (the #2596 main complaint). This PR ports the identical signature + rebase to both remaining lanes.Changes
src/server/prepare-anthropic.ts: dual-signal block afterloopConfig, beforereconcileFoldCoverage/processTurn, mirroringprepare-openai.ts:142-155— gatepluginAgent === "dsh"+ active blocks + title-gen skip (same ≤200max_tokensheuristic as the openai/google lanes); on hit →recordConflict("native-compaction")+ warn log +markNativeCompactionBoundary+reconcileNativeCompactionBoundary. The laterdetectUnannouncedHistoryRewriteis wrapped inif (!dshRebased)so a just-classified dsh compaction is not double-recorded as a second "unannounced rewrite" (same pattern as the openai lane).src/server/prepare-google.ts: same dual-signal block (this lane has nodetectUnannouncedHistoryRewritecall, so no flag needed); adds therecordConflict+ guard-helper imports.tests/issue2658-dsh-anthropic-google-compaction.test.ts: 6 hermetic e2e tests through a real proxy instance per lane — positive (fold 9 of 14 msgs via plugin compress, replay[checkpoint framing, retained tail]→ boundary set, fold destroyed, refs reissued at 3, conflict event recorded, next turn works) plus two negatives per lane (framing paste with INTACT history → no rebase, fold stays alive; decimated history WITHOUT framing → existing paths unchanged, no false rebase).Behavior change disclosure
detectUnannouncedHistoryRewrite/ fold-reconcile as before).Verification
issue2658/issue2432/issue2451): 17/17 passanthropic-cache-control,e2e-google-compress,dsh-compaction-guard,compaction-archive): 36/36 passnpm run typecheckclean;npm run buildcleansrc/server/**changed.