Repository navigation
refactor(ccr): retrievals deliver in the tool result — kernel v2 lockstep (requires acp-kernel 0.0.99) - #1738
Conversation
… v2 lockstep)
executeRetrieve now calls kernel applyRetrieve({store, ref, exportDir})
and returns the result as the tool result directly — retrieval is a plain
tool call whose output carries the payload. The #1343 queued-delivery
lifecycle for CCR is retired: queueRetrieval deleted, delivery counts at
tool time, carrier/ledger/note machinery survives only for legacy state
and the #1207 range-decompress rider (which now rides as user).
Originals >= 4000 tok export to stateDir()/retrieve/<ref>.txt with a
pointer tool result; write failure degrades to a bounded head preview.
compress-settings spreads kernel DEFAULT_CCR_CONFIG first so new kernel
ccr keys (retrieveInlineTokens) survive the deepEqual contract.
Requires acp-kernel 0.0.99 (unreleased): package.json still pins 0.0.98
and CI is expected red until the kernel lands on npm — the bump commit +
re-run turns it green. Tests reworked to the atomic-delivery contract;
3295/3295 green against the local kernel overlay.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1706-pr.1738.90716eeThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1738.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Review startedPicked up this PR. Initial state check:
Now walking the code + tests + the CI failure mode. Full review conclusion follows in a second comment. |
Review complete — code is sound; gated on acp-kernel 0.0.99What I verified
Direction (①) — correct layer. The #1343 channel delivered model-untrusted folded content as a host-synthesized Regression walk (②) — existing behaviors touched, each judged:
Code (③) — Tests (④) — assertions have teeth: inline framed-original bytes, empty carrier queue, delivered-at-tool-time counters, no-note-on-failure atomicity across both the OpenAI and Anthropic plugin lanes, and the surviving legacy-lifecycle tests seed the old carrier shape directly ( CI status — the latest runs are on the superseded sha 3df6a8b (the branch was force-pushed to 50d56bd afterwards) and all sit Verdict — code is sound and matches the issue description point-for-point. Remaining merge blockers, in order: (1) acp-kernel#485 merged + 0.0.99 published [human], (2) bump commit 中文摘要:代码审查通过——v2 检索契约(原文直接作为工具结果交付、退役 #1343 队列投递通道)实现干净、diff 无杂质;本地复现确认当前 CI 红完全由 acp-kernel 钉在 0.0.98 所致、背后没有隐藏问题。等 acp-kernel#485 发布 0.0.99 后,我会立即在本分支补 |
Follow-up — independent validation against the kernel PR buildWhile waiting for the official publish, I validated this branch against the pre-release build of acp-kernel#485 (it publishes an npm tag per push):
So the branch is confirmed correct against the v2 retrieval contract — not just per the local-build claim, but against the actual #485 artifact. Caveat: if acp-kernel#485 changes before merge, the bumped-head CI run is still the authoritative gate. Status unchanged: 0.0.99 not yet on npm (kernel PR open, awaiting merge). Once it lands I'll add the 中文摘要:已用 acp-kernel#485 的预发布构建(0.0.98-pr.485.342)独立验证本分支——typecheck 干净、测试 3295 全过,与作者本地数据一致;等 0.0.99 正式上 npm 后我立即补 bump 提交。 |
What
executeRetrievenow returns the retrieved original as the tool result itself and the #1343 queued-delivery channel for CCR is retired (kernel v2 retrieval contract, lockstep with the upcomingacp-kernel@0.0.99).src/store.ts:executeRetrieve→applyRetrieve({store, ref, exportDir: retrievalExportDir()}), returnstoolResultTextdirectly;queueRetrievaldeleted;retrieveDeliveredcounts at tool time. Originals ≥ 4000 tok export tostateDir()/retrieve/<ref>.txtwith a pointer tool result (write failure degrades to a bounded head preview).src/decompress-shared.ts: the feat: CCR v2 — covered-ref spans, range-level decompress, ID-returning search_context; CCR default-on (#1179) #1207 range-decompress rider rides asuser, notsystem.src/compress-settings.ts: spreads kernelDEFAULT_CCR_CONFIGfirst so new kernel ccr keys (retrieveInlineTokens) survive the deepEqual contract.package.jsonstill pinsacp-kernel: 0.0.98. This branch uses the v2 retrieval API (applyRetrieveinput/output,RetrievalExport), so typecheck + tests fail against the registry 0.0.98. The kernel release lands first; a bump commit on this PR (0.0.98 → 0.0.99) then re-runs CI green. Do not merge before the bump.Local validation: full suite 3295/3295 pass (17 live-e2e skips) against a locally built kernel with the v2 contract.
Test changes
tests/store.test.ts: executeRetrieve contract reworked (inline frame, delivered-at-tool-time, empty queue); bug(ccr): plugin-mode retrieve acknowledgement can outlive its volatile full-text delivery #1343 lifecycle tests now seed legacy carriers directly (seedLegacyCarrier).tests/ccr-plugin.test.ts: ack receipts → framed-original assertions; bug(ccr): retrieval-drop correction notes are consumed before upstream delivery is confirmed #1457 lanes reworked to atomic-delivery semantics (an upstream 500 cannot un-deliver, no correction notes).tests/fork-ccr-adoption.test.ts: adoption assertions read the tool result.tests/ccr-v2.test.ts: decompress rider role expectationsystem → user.