fix(hide-consumed): parse tag-prefixed compress call text, stub live anchor summaries - #232
Conversation
…ve anchor summaries
rewriteCompressText JSON.parsed the compress tool-call text at index 0.
Adapters (pi) persist the rendered ref tag in front of the JSON, so the
parse always failed on tagged calls: consumed sibling entries were never
dropped and live anchor args kept their full summary text forever —
duplicating the rendered acp_summary in every request (~22K tokens
measured, billion-context-pi #336).
- locate the JSON by scanning for the first '{' before parsing, preserving
the tag prefix on output
- stub entry summaries above 200 chars in kept calls (active and newest
orphans); the rendered block summary remains the authoritative copy
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)In your adapter project: npm install acp-kernel@pr-232Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf acp-kernel-pr232.tgz
npm install ./packageThis comment is automatically updated on each push. |
Independent review on Verification (fresh checkout, not your local run)
Code review
Process notes
Ready to merge on your side — I can't merge PRs (human-only). |
Non-strict-tool providers (qwen etc.) pass content as a JSON-encoded STRING inside the args — the compress tool accepts it, so the rewrite must too. Measured: all 52 calls in the billion-context-pi #336 storm session used this form, so neither the dead-range filter nor the summary stubbing ever applied there. parseCallText now parses the string form; serializeCompacted re-stringifies so the shape round-trips unchanged.
|
Extended: forensic replay of the #336 storm session showed ALL 52 compress calls use |
Reviewed the extension on Verification (fresh checkout)
Diff review
On the forensic finding — this is the important one, and it changes which fix actually addresses #336: on master, a stringified-content call parses fine at index 0 but then bails at the Ready to merge on your side — I can't merge PRs (human-only). |
Fixes #230.
Bug
rewriteCompressTextinsrc/hide-consumed.tsJSON.parsed the compress tool-call text starting at index 0. Adapters (pi) persist the rendered ref tag in front of the tool-call text, so the parse always threw on tagged calls and the call was treated as unparseable:acp_summarymessage in every request (~22K tokens of duplicated args measured in session 01a07b3c, billion-context-pi #336).Reproduced on master before the fix: a tag-prefixed mixed call (live + consumed entries) kept both entries, and a fully-live call with a 5000-char summary kept all 5000 chars in its args.
Fix
parseCallText: locate the JSON by scanning for the first{before parsing (the closed PR feat: reasoningReplay policy + anchor arg stubs + extraTokens accounting #225 approach), preserving the tag prefix on output.Independent of any reasoning feature — shipped on its own per #230.
Relationship to PR #226
PR #226 (open) bundles the same fix as its item 3, using a regex that strips the exact ref-tag prefix and without stubbing orphaned calls. This PR implements the
{-scan approach prescribed in #230 (handles any leading metadata; also stubs orphans). If this PR merges first, #226 should drop its hide-consumed hunk; if the regex variant is preferred, this PR can be reworked.Verification
npm run typecheck— cleannpm test— 628/628 pass (4 new tests intests/hide-consumed-stub.test.ts)npm run build— success