Repository navigation
feat: CCR v3 — planning-aware retrieval for search_context (compress.search.planAware) - #1419
Conversation
[bot] 🏷 Reviewing this PR now (mirror of #1419). Direction already green-lit in #1336 floor 6 ("okay,go ahead") — scope is tier-1 deterministic re-rank + steering + stats, config-gated default-off, so I'm checking the implementation against that scope plus regression/diff hygiene. One early flag: GitHub reports |
The feature commit rewrote the historical-session note text in
executeSearchContext without gating it on compress.search.planAware.
That breaks two documented properties:
1. The PR's own contract that foreign-session searches stay
"byte-identical to before" when the new flag is off — the rewrite
fires for every foreign lookup regardless of config.
2. The pinned assertions in tests/search-context-cross-session.test.ts
("Read-only search of historical session ..."), which fail with the
new wording even though the PR does not touch that test file.
Revert to the original wording (verified byte-identical to master).
c572cfe to
1bac14f
Compare
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1419Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1419.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review complete — PR updated (rebase onto current master + one fix commit), green, ready to merge. I reviewed against the live master (not just the diff), rebased the branch, fixed one issue directly, and re-ran everything on the rebased head. What I did to the branch
FindingsF1 (fixed in F2 (note, non-blocking): the repeat-retrieve steering hint suggests F3 (note, non-blocking): Nuance (no action taken): the server.ts comment says the feature "applies to both proxy and plugin lanes". Strictly, the re-rank executes only in the proxy lane — Regression inventory (paths touched → verdict)
Test validity (④)Strong. Behavior-change disclosure (per policy)
Pre-flight on rebased head (
|
|
Deep review verdict: Approve — 1 MED fixed in-branch (head What it is (four-axis)
Fixed on your branch (F1, MED)
Verified
Non-blocking (follow-ups noted, not blocking)
Merge note: base is |
…search.planAware) Re-rank search_context candidates against in-context plan state (latest planning-tool snapshots + most recent user turn) when matches exceed limit; append a [plan-aware] steering section (top fetch targets + repeat-retrieve hint). Byte-identical output when off or when no plan state is present; foreign-session searches stay read-only lexical. Retrieval-quality stats (whole-block restores vs cheaper precise path available) surface in acp_status. Default off until measured. Fixes #1336
The feature commit rewrote the historical-session note text in
executeSearchContext without gating it on compress.search.planAware.
That breaks two documented properties:
1. The PR's own contract that foreign-session searches stay
"byte-identical to before" when the new flag is off — the rewrite
fires for every foreign lookup regardless of config.
2. The pinned assertions in tests/search-context-cross-session.test.ts
("Read-only search of historical session ..."), which fail with the
new wording even though the PR does not touch that test file.
Revert to the original wording (verified byte-identical to master).
12e6fbc to
94515f4
Compare
[bot] 🏷 Verdict confirmed — round-trip fix verified, branch rebased onto current master, all gates re-run green. Ready for human merge. Verification of the round-trip fix (
|
…ster (#1439 review) Rebase conflict resolution: master's #1419 threaded a 5th ctx arg into executeSearchContextTarget inside the local dispatch this PR deletes — kept the deletion (the shared src/loop/core.ts dispatch already carries the new arg on master). New pin: a no-trigger response returns the SAME object reference — the JSON loop only re-serializes when a trigger fires.
…anglei#1419) The feature commit rewrote the historical-session note text in executeSearchContext without gating it on compress.search.planAware. That breaks two documented properties: 1. The PR's own contract that foreign-session searches stay "byte-identical to before" when the new flag is off — the rewrite fires for every foreign lookup regardless of config. 2. The pinned assertions in tests/search-context-cross-session.test.ts ("Read-only search of historical session ..."), which fail with the new wording even though the PR does not touch that test file. Revert to the original wording (verified byte-identical to master).
…gh reload (review of ranxianglei#1419)
Fixes #1336
What
Planning-aware retrieval for
search_context— a policy layer on the existing candidate surface; no store/fold/injection mechanics change:compress.search.planAware— nested likeabsorb/ccr, sub-field merged deepest-wins across the three levels, default off until measured.limit, candidates are re-ranked against in-context plan state: the LAST tool call of each planning tool (built-in patternsTodoWrite/todowrite/todo_list/update_plan/TaskCreate/TaskUpdate, plus everycompress.protectedLatestToolspattern — same latest-wins semantics as the kernel's snapshot protection) and the most recent user turn. Weighted term overlap scores each candidate's topic+summary; score > 0 sorts first, ties keep lexical order. Rendered<acp>ref-tag markup is stripped before tokenization so proxy metadata never pollutes the terms. Pure function of (candidates, plan state) — prefix-cache neutral.[plan-aware]section is appended:top fetch targets:with the covered ref spans of the top-scoring returned blocks, plus a hint for any covered ref already retrieved ≥2× this session pointing at a one-shotdecompress({blockId,startId,endId})range restore instead of repeatacp_retrieve. No auto-retrieval (bili philosophy).conversation_idsearches never see plan state and are byte-identical to before.[acp-search-plan] …log line per re-rank with per-block scores; new optional statswholeBlockRestores/wholeBlockRestoresPreciseAvailablerendered inacp_statusasRETRIEVAL QUALITY — whole-block restores: W total, P had a cheaper precise path available (X%)so the retrieve-vs-decompress trade is measurable before/after enabling. Per-ref retrieve counters are in-memory only (FIFO cap 512), feeding the repeat-retrieve hint; not persisted (buildRecordomits them by construction).CONFIGURATION.md+CONFIGURATION.zh-CN.mdgain a#### searchsection; web config editor description updated (zh/en).Behavior-change disclosure
limit,search_contextoutput is byte-identical to pre-feature behavior (unit-tested + e2e OFF lane). No past behavior changes.acp_statusgains one line only after whole-block decompresses have occurred in the session.Preflight (rebased head c572cfe over master 6bdc6b9)
npm run typecheck✅ cleannpm run build✅ (dist-import-annotations OK)tests/search-plan-aware.test.ts: 13/13 green — extractPlanState semantics (latest-wins over repeated calls, custom patterns via protectedLatestTools, CJK terms, 40-msg window bound), byte-identity (flag off / no plan state / pool ≤ limit / foreign target), deterministic re-rank order (repeat-run equality + log line), steering text (spans + repeat hint), stats counters, FIFO cap at 512, acp_status RETRIEVAL QUALITY line, plus an anthropic e2e through the real proxy vs mock upstream: plan-aware steering rides the search tool result across the wire while the client's system-anchorcache_controlstays stable on all three requests, and the OFF lane reproduces the exact pre-feature output.npm test: 2589/2601 pass, 10 skipped, 2 fail — both pre-existing on pristine master, unrelated to this diff (verified by stashing this PR's changes and re-running): stale assertions intests/search-context-cross-session.test.tsleft behind by the protectedLatestTools revert. Tracked separately as #1418.Notes
storeEffectiveCcr; plugin-mode remembered snapshots and proxy folded views both feedextractPlanStatethrough the singleexecuteSearchContextTargetentry.src/plugin-install.ts,tests/kimi-native.test.ts) appeared in this clone mid-session; they are NOT part of this PR and were excluded from the commit.