Skip to content

fix(ccr): pin acp-kernel 0.0.97 — stored-ref raw retransmission no longer leaks onto the wire (#1460 Step 0) - #1525

Closed
ranxianglei wants to merge 3 commits into
masterfrom
2026-09-27_ccr-retransmission-regression
Closed

ranxianglei wants to merge 3 commits into
masterfrom
2026-09-27_ccr-retransmission-regression

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Part of #1460 (Step 0 — stored-ref rematerialization correctness). Does NOT close #1460: it is the umbrella design issue, Steps 1–4 remain.

What

Four commits:

  1. test(ccr) — wire-level regression in tests/ccr-plugin.test.ts: turn 1 stores an oversized tool result → outbound carries the [acp-stored …] placeholder, not the raw text; turn 2 re-sends the client's own history containing the RAW result again (what every plain proxy-mode client does) → asserts the raw text never re-enters the wire and the historical position keeps the byte-identical placeholder. RED on acp-kernel 0.0.95, GREEN on 0.0.97.
  2. test(ccr) — isolate that test from the file-global SessionStore (drop its session in finally; scope the route-scoped arming assertion to its own conversation) so it can't pollute neighboring tests' global-session assertions.
  3. fix(ccr) — pin acp-kernel 0.0.95 → 0.0.97 (exact).
  4. fix(ccr) — incidental small fix in src/store.ts: adoptContentStore now passes the arrival-time command through to buildStoredPlaceholder, so placeholders rebuilt on adoption are byte-identical to the primary store path's output and the saved-bytes stat matches reality (kernel API added in 0.0.96).

Why

#1460 Step 0 established that when a client re-sends the raw bytes of an already-stored tool result, the old kernel let the raw text back onto the upstream wire (hasStoredRef short-circuit returned the message untouched) — and if the same request also carried an acp_retrieve injection, one request could hold two full copies. Fixed upstream by acp-kernel#458 (re-project into the canonical placeholder at re-arrival); released as 0.0.97 together with the #1476 follow-up fix (lastPassIds discriminator, acp-kernel#463). Note: 0.0.96's first attempt at that follow-up (naive reconcile-live-ids) regressed full-history-resending hosts — 55 failures in this repo's suite — which is why this pin lands on 0.0.97, not 0.0.96.

Behavior changes (disclosure)

Pre-flight

  • npm run typecheck — clean
  • npm run build — OK
  • npm test — 2884 tests, 2872 pass, 0 fail, 12 skip (the new wire test is green on the pinned 0.0.97; suite was 55-fail on 0.0.96 and red-on-the-new-test on 0.0.95)

CI's e2e workflow auto-triggers on this diff (acp-kernel pin bump is a pipeline change per .github/workflows/ci-e2e.yml).

Addendum — review rebase (2026-09-28): The branch was 126 commits behind master at review time. It has been rebased onto 86e0b684 (current master) and force-pushed:

Addendum 2 — rebase onto v0.1.172 master (2026-09-30): master moved past 86e0b684 (kernel pin advanced 0.0.97 → 0.0.98 via subsequent releases). The branch was rebased again onto current master c0e9e65f (release v0.1.172) and force-pushed: new head ccc346e4. No conflicts; still exactly 3 linear commits touching only src/store.ts (+1) and tests/ccr-plugin.test.ts (+41/−2) — no manifest or lockfile changes at any point, so there is no lockfile noise in this PR's diff (the kernel pin itself was never part of the final diff; it arrived via #1505). Verified on the new head against kernel 0.0.98 (StoredPlaceholderInput.command API confirmed intact in 0.0.98 typings): typecheck clean, build OK, full suite 3241 tests, 3229 pass, 0 fail, 12 skip. Both remaining changes were re-confirmed absent on current master before rebasing (adoption placeholder still built without command; no standalone #1460 wire test), so nothing here became redundant.

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-09-27_ccr-retransmission-regression (ccc346e)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.1640-pr.1525.c936ed1

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr1525.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review started. Plan: pull the branch, verify the four commits against the description, regression-audit the existing behaviors the kernel-pin bump touches (both compression modes), validate the new wire test actually has teeth (RED on 0.0.95 / GREEN on 0.0.97), run typecheck + build + full suite locally, and check CI (incl. the auto-triggered e2e run). Will report findings here. Note: this is a cross-repo pin bump → stays human-merge per §7.4 regardless of review outcome.

@ranxianglei
ranxianglei force-pushed the 2026-09-27_ccr-retransmission-regression branch from f8ce9e3 to 811171b Compare September 27, 2026 17:06
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review complete — mergeable. I rebased the branch onto current master and re-verified everything locally; details below.

What I did to the branch (verified with git):

  • The branch was 126 commits behind master. Rebased onto 86e0b684 (current master head) and force-pushed: new head 811171bb, 3 linear commits, original authorship preserved.
  • Commit 3 (fix(ccr): bump acp-kernel 0.0.95 -> 0.0.97) is dropped: master already pins 0.0.97 (landed via chore: pin acp-kernel 0.0.97 — post-fold echo discrimination (kernel #463) #1505), so it became an empty no-op on rebase. The PR no longer touches package.json/package-lock.json. Added an addendum to the PR body documenting this.
  • Net diff after rebase: src/store.ts +1, tests/ccr-plugin.test.ts +41/−2. Every line serves the PR's purpose; no lockfile churn left.

① Direction (#1460 Step 0): sound. The root cause of the raw-retransmission leak lived in acp-kernel (hasStoredRef short-circuit returning the message untouched) — fixed upstream in #458, already in master's pinned kernel. This PR's remaining job is exactly right: pin the wire contract with a dedicated regression test (the #458 assertions that exist in master live inside the #1457 drop-note lifecycle tests; a minimal standalone resend test with a byte-stability assertion was missing), plus fix a genuine byte-drift bug on the adoption path. Not symptom-patching.

② Regression audit — existing behaviors touched:

③/④ Code + test validity: the test has teeth — I re-ran it against kernel 0.0.95 locally: fails with exactly raw original leaked back onto the turn-2 wire (#1460); green on 0.0.97. The byte-identity assertion (toolContentOf(f2) === toolContentOf(f1)) matches the kernel contract ("same inputs always produce identical bytes — prefix-cache friendly"), so it catches both the leak regression AND any future placeholder non-determinism. dropSessionForGc in finally is safe (request complete, inFlight == 0). No tautologies, no mock-only assertions.

⑤ Diff cleanliness: clean after rebase (see above). Hot-file contention check across all open PRs: none touch src/store.ts or tests/ccr-plugin.test.ts; #1461 touches only tests/fork-ccr-adoption.test.ts (no textual overlap; combined tree covered by CI on merge).

Pre-flight / CI on rebased head 811171bb: local typecheck clean, build OK, full suite 3014 tests, 3002 pass, 0 fail, 12 skip. CI: 12/12 check runs green (test matrix ubuntu/windows 22+24, hermetic registry, real-client lanes). Note the auto-triggered e2e job didn't fire on the reduced diff (pin bump was the pipeline-change trigger; src/store.ts isn't in the e2e hot-file list) — I manually dispatched ci-e2e.yml on the branch as belt-and-braces; it should land green like the old head's run did.

Old-head CI (f8ce9e3) was also fully green (13/13 incl. e2e), which already exercised this exact store.ts change + kernel 0.0.97.

Verdict: 可合并 — please merge when convenient (merge stays human-only). 中文摘要:修复了 CCR 存储引用在客户端重发原始字节时泄漏回上游线的问题(内核侧已由 #458/0.0.97 修复并经 #1505 合入),本 PR 补上了专门的线级回归测试(含占位符字节稳定性断言,已验证在 0.0.95 上 RED)和 adoption 路径占位符重建缺 command 导致字节漂移的小修;分支已 rebase 到当前 master(pin 提交因 #1505 已合入而剔除),本地与 CI 全绿,可以合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Follow-up: the manually dispatched ci-e2e.yml run on rebased head 811171bb completed green — so all 13 checks are now passing on the final head (12 auto + 1 manual e2e). Nothing outstanding from review; the PR is ready for a human merge. 中文摘要:rebase 后新 head 的手动 e2e 跑测也已通过,13/13 全绿,无遗留问题,等待人工合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

Stale: pins acp-kernel 0.0.97 while master is on 0.0.98 — rebasing would regenerate the lockfile noise. If the underlying fix landed another way, suggest closing; otherwise happy to rebase onto current master.

ework-agent added 3 commits September 29, 2026 20:32
The new #1460 raw-retransmission test left its CCR-armed session in the
file-global SessionStore (closeRig only closes sockets), which broke the
downstream route-scoped test's global session-count assertion.

- drop the test's own session in finally (dropSessionForGc)
- scope the route-scoped arming assertion to its own plugin-lane
  conversation: it checks THIS config does not arm the plugin lane, not
  that sessions armed by other tests under other configs are absent
…adoption

adoptContentStore rebuilt stored placeholders without the arrival-time
command, so adopted placeholders could differ byte-for-byte from the
primary store path's output and the saved-bytes stat diverged from
reality. Pass entry.command through (kernel API added in 0.0.96).
@ranxianglei
ranxianglei force-pushed the 2026-09-27_ccr-retransmission-regression branch from 811171b to ccc346e Compare September 29, 2026 12:38
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Rebased onto current master — done and verified. One clarification first: the PR no longer pins anything. Since yesterday's review rebase, the fix(ccr): bump acp-kernel 0.0.95 -> 0.0.97 commit was dropped as a no-op (that pin already landed via #1505), so the branch touches neither package.json nor package-lock.json at any point — there is no lockfile noise to regenerate on rebase; the full diff is just src/store.ts (+1) and tests/ccr-plugin.test.ts (+41/−2). The "stale" flag comes from the base being behind (86e0b684 @ kernel 0.0.97 vs today's master @ 0.0.98), not from a pin in the diff.

Why not close: I re-checked current master before rebasing — both remaining changes are still live and absent there: src/store.ts:109-115 still builds the adoption placeholder without the arrival-time command (byte-drift vs the primary path + wrong saved-bytes stat), and there is still no standalone #1460 raw-retransmission wire test (master's #458 assertions only live inside the #1457 drop-note lifecycle tests, without the byte-identity check). Closing would drop a real fix and a regression test, so per your "otherwise happy to rebase" I did exactly that.

What I did (all verified with git/CI):

  • Rebased the 3 commits onto current master c0e9e65f (release v0.1.172, kernel 0.0.98) — clean, no conflicts, linear history preserved. Force-pushed: new head ccc346e4.
  • Confirmed the kernel API the store.ts fix relies on is intact in 0.0.98 typings (StoredPlaceholderInput.command?, pre-command fallback note unchanged).
  • Pre-flight on the new head against kernel 0.0.98: typecheck clean, build OK, full suite 3241 tests, 3229 pass, 0 fail, 12 skip.
  • Updated the PR body with "Addendum 2" documenting this rebase and the no-manifest-changes fact.
  • Manually dispatched ci-e2e.yml on the branch again (the auto-trigger doesn't fire for this reduced diff — no pipeline hot files touched); will confirm when it lands.

Note: the PR title still says "pin acp-kernel 0.0.97" — I left it as provenance of where the work came from, with the final scope fully documented in the body. Happy to rename it to something like test(ccr)+fix(ccr): stored-ref retransmission regression & adoption placeholder byte-drift (#1460 Step 0) if you'd rather have the title match the final diff.

中文摘要:分支已再次 rebase 到当前 master(v0.1.172 / 内核 0.0.98,新 head ccc346e)并全量验证通过(3241 测试 0 失败);该 PR 实际不含任何 pin/lockfile 改动(pin 提交此前已因 #1505 先行合入而剔除),剩余两项改动(#1460 线级回归测试 + adoption 占位符字节漂移修复)在当前 master 上仍然缺失且有效,故不建议关闭,等待合并即可。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 CI confirmation: all 13 checks are green on rebased head ccc346e4 (test matrix ubuntu/windows 22+24, hermetic registry, real-client lanes, version-guard, build-artifact, + manually dispatched e2e). Nothing outstanding — ready for a human merge whenever convenient. 中文摘要:新 head 的 CI(含手动触发的 e2e)13/13 全绿,无遗留问题,可随时人工合并。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

design(ccr): active working-set policy for store-on-arrival and ephemeral retrieval churn

1 participant