Repository navigation
feat: preserveRecentTools — positive override for the recent-zone exclusion list - #428
Conversation
…lusion list Effective exclusion = (neverPreserveRecentTools ?? built-in) minus preserveRecentTools. The common remedy for the batch-read fold->re-read loop (billion-context #1198/#1277) becomes a one-entry config, ["read"], without restating — or freezing a copy of — the built-in list. Glob-suffix patterns subtract matching list entries; unset or empty is a no-op. neverPreserveRecentTools keeps its verbatim-replace semantics for power users (incl. the [] protect-everything hatch). Refs ranxianglei/billion-context#1277
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)In your adapter project: npm install acp-kernel@pr-428Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf acp-kernel-pr428.tgz
npm install ./packageThis comment is automatically updated on each push. |
e83be26 to
2adca91
Compare
[bot] 🏷 Review of #428 — ① Direction (original issue)Follow-up to #395. The trap is real and I confirmed it in code: ② Regression audit (existing behaviors on touched paths)
③ CodeClean. Per-message ④ Test validityThe 5 new tests have teeth and pin both directions: default keeps fresh read compressible while ⑤ Diff cleanliness — one issue found, fixed on the branchThe feature commit had committed an unrelated 475 KB
Verification
Verdict: mergeable once you merge it — per repo rules the merge itself is human-only: #428 中文摘要:审核了 |
Follow-up to #395 (
neverPreserveRecentTools).The trap
neverPreserveRecentToolsreplaces the built-in list["decompress","search_context","read","bash"]verbatim. A user who wants to protect ONE tool (e.g.read, the #1198 batch-read fold→re-read remedy) must (a) know the built-in list, (b) restate the other three entries, and (c) silently lose any future built-in additions. Wrong-direction edits accidentally un-excludesearch_context/decompressand pin just-restored blocks in the recent zone — a different disease.Fix: the positive-facing knob
{ "preserveRecentTools": ["read"] } // protect read in the recent zone — that's itEffective exclusion =
(neverPreserveRecentTools ?? built-in) minus preserveRecentToolsneverPreserveRecentTools(subtraction applies to the explicit list too)"bash*"removesbash)[]= no-op (NOT protect-everything — that staysneverPreserveRecentTools: [])+/-prefix design was considered and rejected — double negation on top of an exclusion list)Changes
src/types.ts:Config.preserveRecentTools?: string[]src/protected.ts:isNeverPreserveRecent(msg, patterns, preservePatterns)— filter the effective list by the preserve patternssrc/recommend.ts: threadconfig.preserveRecentToolsthrough the single call sitesrc/config.ts:validateConfigshape check (non-string array rejected;[]tolerated as no-op)Tests (+5 in tests/protect-recent.test.ts, file 19/19)
[]no-opapplyCompressionrefuses a range over a fresh read underpreserveRecentTools:["read"](/protected/i)[]tolerancePreflight: typecheck clean, full suite 1120/1120.
Refs ranxianglei/billion-context#1277 (adapter wiring follows there).