Skip to content

feat: protectedLatestTools config — keep latest tool snapshot across compression - #1032

Merged
ranxianglei merged 1 commit into
masterfrom
2026-09-20_protected-latest-tools
Sep 20, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-09-20_protected-latest-tools

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Re-PR of #637 (kernel-adopt rework; #637 was auto-closed because its head sha was accidentally pushed directly to master during a push-target mixup — the commit was immediately reverted there, master content unaffected). This PR carries the identical change on a fresh head.

Reworked per review: the host-side todo replay is superseded by acp-kernel's native protectedLatestTools primitive (#223, shipped in 0.0.80, pinned on master via #1030). This is a clean single-feature commit on current master (2b027f1) that plumbs the config through and drops the host-side machinery entirely.

What it does

compress.protectedLatestTools: ["todo_list", "TodoWrite"] — tool-name patterns whose latest tool-call + paired result are hard-excluded from every compress range (refs render as BLOCKED, unaddressable by suggested or explicit ranges). Older instances of the same tool fold normally, so cumulative-snapshot tools (todo/task lists) never grow unboundedly and the agent never loses its live task list to a fold.

Kernel-side protection covers every wire and both compression modes for free — no per-wire wiring, no synthetic replay messages; the REAL tool-call/result stays byte-stable in place.

Changes

  • src/config.ts — CompressSettings.protectedLatestTools + strict parseCompressSettings validation (non-empty trimmed string array; malformed rejects the block loudly)
  • src/compress-settings.ts — three-level deepest-wins merge (whole-array replace) + applyCompressSettings passthrough onto the kernel Config
  • tests/protected-latest-tools.test.ts — 6 tests: parse accept/reject, merge precedence, plumbing, end-to-end kernel behavior (spanning range cannot fold the latest pair; default stays fully foldable)
  • Docs: CONFIGURATION.md / CONFIGURATION.zh-CN.md field reference, README.md / README.zh-CN.md note beside the acp_rule protection paragraph, web UI field list

Default: off (no todo_list) — tool names are client-specific; operators opt in per deployment.

Pre-flight (on this head, base master @ 2b027f1)

  • typecheck ✅
  • tests 2024/2024 ✅ (2 e2e-gated skips)
  • build ✅

Fixes #639

Supersedes #637

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-09-20_protected-latest-tools (a402b3e)

Option A — Install from npm PR tag (recommended)

npm install -g billion-context@pr-1032

Each push to this PR publishes a new version under the pr-1032 npm tag.

Option B — Download artifact

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

Install instructions are refreshed on each push.

…compression

Kernel-adopt rework of the host-side todo replay (#639 / PR #637): the
kernel grew a native primitive for exactly this (acp-kernel #223,
protectedLatestTools, shipped in 0.0.80), so the host-side re-injection
is superseded — protection now happens inside the kernel pipeline where
it covers every wire and both compression modes for free.

- src/config.ts: CompressSettings.protectedLatestTools (string[] of
  tool-name patterns, glob-capable) + strict parseCompressSettings
  validation (non-empty string array, entries trimmed; malformed rejects
  the whole compress block per the parse-state guard convention).
- src/compress-settings.ts: three-level deepest-wins merge
  (whole-array replace) + applyCompressSettings passthrough onto the
  kernel Config.
- tests/protected-latest-tools.test.ts: parse/merge/plumbing asserts +
  end-to-end kernel behavior — an explicit compress range spanning the
  latest todo_list pair cannot fold it (latest call+result refs render
  as BLOCKED, unaddressable), older instances fold normally; with no
  configuration everything stays foldable (default off).
- Docs: CONFIGURATION.md/.zh-CN.md field reference; README.md/.zh-CN.md
  note next to the acp_rule protection paragraph; web UI field list.

Default: none — tool names are client-specific, opt in per deployment
(e.g. ["todo_list", "TodoWrite"]).

Fixes #639
@ranxianglei
ranxianglei force-pushed the 2026-09-20_protected-latest-tools branch from 164e044 to a402b3e Compare September 20, 2026 04:32
@ranxianglei
ranxianglei merged commit 3adc9ac into master Sep 20, 2026
8 checks passed
@ranxianglei
ranxianglei deleted the 2026-09-20_protected-latest-tools branch October 15, 2026 05:32
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.

feat: preserve todo continuity across context compression

1 participant