Skip to content

feat: lenient compress-arg parsing via acp-kernel salvage (omp#121) - #188

Open
ranxianglei wants to merge 1 commit into
masterfrom
2026-08-22_compress-arg-salvage
Open

feat: lenient compress-arg parsing via acp-kernel salvage (omp#121)#188
ranxianglei wants to merge 1 commit into
masterfrom
2026-08-22_compress-arg-salvage

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Why

Weak/local models (vLLM qwen etc.) emit compress tool arguments that fail strict JSON.parse ~50% of the time — truncated output caps, raw newlines inside summary strings, trailing commas, or plain prose (see billion-context-omp#121). Until now the proxy's parseCompressInput was strict-only:

  • raw string input (text-protocol triggers, stream tails) was rejected outright;
  • JSON-string content that failed to parse returned [] — raw arguments discarded with zero log evidence, making the failure class undiagnosable in production.

What

Route both paths through acp-kernel's parseCompressInputStringsalvageParseRanges (5-layer ladder: strict JSON / fenced / repaired / truncated-array prefix / field-regex):

  • string input is salvaged instead of rejected;
  • broken JSON-string content falls back to the same ladder instead of [];
  • the lenient path logs the salvage layer + note, and keeps raw[:800] as evidence when 0 ranges are recovered.

Bumps acp-kernel to ^0.0.34 (introduces salvageParseRanges + extractRanges double-encode normalization).

Tests

5 new lenient-path cases in tests/basic.test.ts (raw string salvage, fenced JSON, repaired commas/newlines, truncated-array prefix, field-regex prose form). Full suite 516/516, typecheck clean.

Companion PRs: acp-kernel#109 (parser), billion-context-omp (replay), billion-context-pi (ACP host extension).

--- DEPENDENCY NOTE (pre-publish) ---

⚠️ Do not merge yet: package.json currently pins acp-kernel to a local file: tarball so the diff is reviewable now. Depends on acp-kernel PR #109 landing and npm publish of 0.0.34 (0.0.33's publish failed with npm 404 — expired NPM_TOKEN). Before merge this PR will be updated to "acp-kernel": "^0.0.34" from the registry and the full suite re-run.

parseCompressInput was strict-only: raw string args (text-protocol
triggers, stream tails) were rejected outright, and JSON-string content
that failed to parse returned [] — raw arguments discarded, zero log
evidence. Weak/local models (vLLM qwen etc.) fail strict JSON ~50% of the
time, making the failure class undiagnosable.

- string input now routes through parseCompressInputString →
  kernel salvageParseRanges (5-layer ladder)
- broken JSON-string content falls back to the same ladder instead of []
- lenient path logs layer + note, and keeps raw[:800] evidence when 0
  ranges are recovered

Bump acp-kernel to 0.0.33.

tests: 5 new lenient-path cases in basic.test.ts; 516 pass.
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.

1 participant