Repository navigation
[PR] fix: seed the Anthropic cache-breakpoint ladder on fork adoption (#5519) - #5525
ranxianglei wants to merge 6 commits into
Conversation
A fork/resume that adopts its parent's compression state started with no cache-breakpoint ledger of its own: computeAnthropicMessageMarks only ever pushed the single tail mark, so the child's first turns left most of the shared prefix behind no cached segment at all while the parent's marks had accumulated across dozens of turns. applyForkAdoption now arms a one-shot flag (metadata.cacheMarkLadderInitPending); the child's FIRST anthropic-owned mark pass seeds quarter + half + tail of its own stable region instead of the lone tail, then hands back to the sticky #1637 cumulative dynamics unchanged (cap freeze, fold retirement). The parent's ledger itself is deliberately NOT copied — its positions are stale relative to the child's view and a full inherited cap would block the child's tail push. The flag is consumed unconditionally so a client-managed or too-short first turn cannot defer a mid-history relayout to a later turn (byte-stability debt is exactly what the #1637 design forbids). Tests: tests/issue5519-fork-cache-mark-inherit.test.ts (seed shape, stickiness, retirement, fallbacks, consumption, adoption-side flag); fixture in tests/fork-adoption-plan.test.ts gains the required metadata field.
…he-mark-ladder-init
…text into 2026-11-02_fork-cache-mark-ladder-init
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9022-pr.5525.7d64632This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5525.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。按失败签名(fork 采纳 × Anthropic 缓存断点继承 / 标签: bug, dsh, scope/wiring, p2(理由:fork 首轮缓存命中崩塌是成本/性能缺陷,可用不卸载、第 2 轮起自愈回 ~90% → p2;报告车道为 dsh;改动面在 wire 层 cache-control + fork-adoption,归协议接线域)。 开始对 PR #5525 做独立审核(分支 |
…ng (review nit) The inline comment claimed the one-shot cacheMarkLadderInitPending flag is 'consumed unconditionally' on the first turn. In fact a client-managed first turn never reaches computeAnthropicMessageMarks at all (the suppression at prepare-anthropic.ts precedes the call) and a too-short or knob-off first turn early-returns before the flag code — both leave the flag armed for the next eligible pass. That is safe (the seed is a first-appearance layout, not a rewrite of already-stamped bytes), but the old wording did not match the mechanism. Comment-only change; no behavior change.
[bot] 🏷 PR #5525 独立复审结论:可合。 八问
验证证据(独立重做,未照抄 issue 结论)
顺手小修(独立标注 commit 判定:可合。 行为变更披露与 PR 描述一致(fork/resume 首轮消息断点 1→最多 3,有意变更;稳态不变),配置面与 kernel 均未触碰。合并请 owner 操作:#5525 |
(ai: vllm-qwen/qwen3.8-27b) 本 PR 的独立审核已在 floor 6 完成并给出「可合」+ 八问。本次是同任务重触发,我没有照抄 floor 6,而是独立重跑了一遍端到端核查;结论一致,维持可合,且没有新发现。 八问(本轮复核,精简版)
独立复核证据(自己重做,非转录)
状态核对:分支 tip 现为 判定:可合(维持 floor 6)。 无新发现、无新提交。合并请 owner 操作:#5525 协调回报(一行):PR #5525 审核完成——可合,修复 |
# Conflicts: # src/fork-adoption.ts
… required metadata field Merging current master into this branch exposed a semantic conflict git could not see: master added four test fixtures that call applyForkAdoption (two directly, two via maybeAdoptResume) whose child Session has no metadata field, while this PR made applyForkAdoption unconditionally arm session.metadata.cacheMarkLadderInitPending (#5519). Production sessions always carry metadata (createSession initializes it), so the fixtures are the defective side — same class as the pre-existing fixture gap this PR already fixed in the #2620 test of fork-adoption-plan.test.ts. Adding metadata: {} to each; no production-code change. Verified locally on the merged head: typecheck clean; targeted suites issue5519-fork-cache-mark-inherit / fork-adoption-plan / anthropic-cache-control / resume-miss-timestamp-seed all green (34/34); fork-adoption-wires keeps its two known inherited-reds with the identical pre-merge signature (fixture precondition, fails before adoption code).
(ai: vllm-qwen/qwen3.8-27b) Conflict resolved and pushed — branch 七问 summary
|
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Confirming for the record: this run is complete — the full 七问 summary was already posted as the previous comment in this thread (comment id 71320) and is not being repeated here. State verified live in this run: branch |
(ai: vllm-qwen/qwen3.8-27b) 复审(新 head 自上次评审后真正新增的只有 1 个提交:
核心修复内容未变(rebase 前后我逐一比对,字节级一致):
八问(精简版,详版见 floor 6)
CI(mirror cache @ 判定:可合(APPROVE)。 无新发现、无遗留项(NO OPEN ENDS)、未触碰 kernel/ 故无需决策升级。合并请 owner 操作:#5525 协调回报(一行):PR #5525 新 head |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Verified live this run: there is no conflict to resolve and no red CI to fix — the branch is green and merge-ready. The blocker flag arrived after master moved again, but the authoritative sources say otherwise: 七问 summary
|
是什么 / What
Fork/resume 采纳(
applyForkAdoption)搬 blocks、refs、token snapshot 等,但不搬 Anthropic 缓存断点账本(session.metadata.anthropicCacheMarkIds)。新采纳的会话首轮 anthropic 请求只能打一个尾部断点:早期前缀在子会话侧从未申请过缓存,写阶梯从空开始重建(#5519)。观测:fork 首轮 8.07MB 请求与父会话末轮字节公共前缀仅 2,552 字节(0.03%),第 2 轮起才回到 ~90% 命中。修法 / Fix
applyForkAdoption武装一次性标志metadata.cacheMarkLadderInitPending(四条采纳路径——匿名 fork、identified resume、derived fork、boot reconcile——都汇聚于此,一处覆盖全部)。MESSAGE_MARK_CAP=3、阻塞子会话自己的尾部 push——第 2 轮命中深度反而比现状更差(issue 建议 1 的字面实现是负优化,已在 issue 线程说明)。行为变更披露(old → new)
src/loop/cache-control.ts+src/fork-adoption.ts),零kernel/触碰。测试 / Tests
tests/issue5519-fork-cache-mark-inherit.test.ts(8 例:非 fork 现状钉死、标志武装且不复制父 marks、种子形状、次轮冻结、折叠退役后补位、短历史回退单尾、已有存活 mark 不重排、ephemeral 尾巴不入点)。tests/fork-adoption-plan.test.tsfixture 补上 Session 类型必需的metadata: {}(既有缺陷:缺它 applyForkAdoption 会崩,与本修复同路径)。tests/fork-adoption-wires.test.ts有 2 条在干净 masterfad9805bc与干净 ci-fixes821dbc04b上同样失败(fixture 前置断言 "must have a folded block",在任何采纳代码运行前),clean worktree 双证;若 CI 分片以此签名红,属继承性失败,已按政策走 CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599。Closes #5519