Repository navigation
feat: acp_rule delete/clear — wire kernel removeRule/clearRules (#1177) - #1178
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1178Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1178.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Reviewed PR #1178 (head Diff cleanliness. Single commit, 7 files, +90/−9, every line serves the PR's purpose (schema + dispatch + tests + en/zh doc parity). No unrelated files, no whitespace churn, no lock-file drift, Code review.
Regression review — existing behaviors on touched paths, each dispositioned:
Verification (re-ran on branch head
Minor nit (acknowledged, left out of scope): the kernel 0.0.84 not-found message says "…(omit the text argument)" while the param is named Verdict: mergeable. 中文摘要:审查了 acp_rule 新增 delete/clear 功能的 PR——内核 API 契约、双模式执行路径、持久化与既有行为回归面逐项核实无误,本地复跑 typecheck/test/build 全绿、CI 全绿,可以合并。 |
|
Rebase conflict vs master resolved (head fd2a2da) — docs union, no code changes:
(Wrongly-pushed stray branch |
…xianglei#1399) 诉求 1 — compress.rules defaults ON (owner decision: the model owns session rules): - rulesEnabled(): absent block now means enabled; only explicit false disables - new effectiveRulesEnabled() for the session-level plugin-tool paths (loop/core executeProxyTool, absorb isProxyToolFor, plugin tool allowlist) - kernel needs no change: acp_rule is unconditionally protected there 诉求 2 — human-side parity: pi/omp /acp-rule now forwards the full op set: - bare = list, text = record (unchanged) - 'remove <id>' -> { delete: id }; bare 'remove' warns with usage, no forward - bare 'clear' -> { clear: true }; 'clear <text>' records (typo guard) Docs en+zh: rules default line + migration note, /acp-rule usage incl. remove/clear, stale 'ranxianglei#1178' claim removed. Tests: default-on expectations flipped at every gate site, new forwarding/regression cases, wire-contract ledger + manifest-default golden regenerated via scripts/update-wire-contract-goldens.ts.
Closes #1177
What changed
Wires
acp_ruleto acp-kernel 0.0.84'sremoveRule/clearRules, so recorded rules can be removed instead of staying permanent (or being hedged with counter-rules).src/compress-tool.ts: theacp_ruleschema gains two optional params —delete: "ruleN"(remove one by id) andclear: true(remove all) — plus description sentences so the model can discover the capability. All four wire shapes (anthropic/openai/responses/google) share the one definition.src/rules-feature.ts(executeRule, shared by both proxy mode and plugin mode): dispatches toremoveRule(state, id)/clearRules(state); unknown ids pass the kernel error through verbatim; mixing operations in one call returns an explicit conflict message without mutating state; non-stringdelete/ non-trueclearare ignored (same convention as non-stringrule).tests/rules.test.ts(delete-by-id + returned text, id trim + unknown-id passthrough, clear count + honest empty clear, pairwise mutual exclusivity + no state mutation on conflict, schema documents rule/delete/clear on all four wire shapes) + the loop-routing test extended to coverdeletethroughexecuteProxyTool.Behavior change (old → new)
acp_ruleaccepted only optionalrule; once written, a rule could never be removed.Removed ruleN: <text>andCleared N rule(s).; clearing with nothing recorded answersNo rules to clear.(honest, no false success). Default behavior is otherwise byte-identical: no args = list,rule= record. The tool description string is extended (visible to models only whencompress.rules: true).acp-kernel >= 0.0.84; master already pins exactly 0.0.84 (PR chore: bump acp-kernel 0.0.82 -> 0.0.84 #1175), so this PR bumps no dependency. CONFIGURATION.md now states ">= 0.0.70 (>= 0.0.84 for delete/clear)".Pre-flight (on this branch head)
npm run typecheck✅npm test✅ 2321 pass / 0 fail (2 skipped = e2e gated off by default)npm run build✅ (tsup; new strings verified present in dist/index.js)E2E_CHECK=1 node --import tsx --test tests/e2e/e2e-codex.test.ts✅ (zero-token preflight). Full 4-phase e2e needs the upstream at 127.0.0.1:8199, which is not reachable from this sandbox — the changed path sits behind the default-offcompress.rulesgate and is covered by the HTTP-level wire tests on all three native-tool wires. The manual-dispatch CI e2e can run it if desired.Minor nit (out of scope, belongs to acp-kernel)
The kernel 0.0.84 not-found message reads
…list current rules first (omit the text argument).while the param is namedrule, not "text". Cosmetic wording only; we pass it through verbatim.