Repository navigation
fix: surface partial compress drops in the model-facing receipt (#1495) - #1499
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1455-pr.1499.9be1779This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1499.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Reviewing now — pulling branch |
9abe6db to
235c74a
Compare
|
Rebased onto master (head
The branch's own |
4f67720 to
dd1e4d6
Compare
Problem (#1495)
A batched
compresscall with 3 entries silently folded only 2 — the 3rd entry vanished with no failure note. Root cause (verified against acp-kernel 0.0.95 + master b371bd0):contentarray (salvageContentEntries, dist/index.js:7827 only recovers complete top-level objects; an unterminated trailing entry is dropped with no diagnostic other thankind="truncated"). A corrupted single element instead yieldskind="ok"+invalidItems>0+invalidReasons.applyRanges(src/stream.ts) only read those diagnostics on TOTAL failure (ranges.length === 0). On partial success it discardedinvalidItems/invalidReasons/kind, so the model received a clean[Compressed X, Y → 2 block(s)]receipt for an entry that was requested but never folded. Apply-layer per-range errors (r.errors) had the same invisibility whenever some other range in the batch succeeded, and the server-side log was silent too.This is mode-independent (proxy + plugin modes share this one execution path; all wire adapters route through
applyRanges) — so default mode exhibits the same behavior as lean; lean just has a shorter tool description that omits the "some gateways stringify arrays" note, making the exposure slightly more likely.Fix (at the decision point, not a symptom mask)
applyRangesnow appends to every non-total receipt:[PARTIAL: …]note when parse diagnostics report drops — per-entry rejection reasons (invalidItems/invalidReasons), or forkind="truncated": how many ranges were recovered and that any unlisted requested range was LOST, with acp_status guidance to re-issue;Errors: …for apply-layer per-range errors (unknown refs, …) that previously vanished on partial success.[Compressed …]success line and the[Compression FAILED: …]0-blocks line.warnlog inparseCompressInputfor the partial-drop case (previously unlogged).Previously, a compress call whose arguments arrived partially damaged returned a clean success receipt naming only the ranges that landed (and logged nothing). Now such calls additionally carry a
[PARTIAL …]annotation (and apply-layer errors carryErrors: …), plus a server warn log. Clean calls are byte-identical (pinned by regression test #4).Regression tests
New
tests/issue1495-partial-compress-drop.test.ts(4 cases): valid+invalid mix names the rejected entry inline; truncated gateway-stringified array names the salvage loss and never lists the lost range as applied; unknown-ref apply-layer error surfaces on partial success; clean call stays unannotated.Pre-flight
npm run typecheck✅npm test✅ 2875 pass / 0 fail / 12 skipped (default-gated e2e)npm run build✅ci-e2e.ymlauto-runs on this PR (src/stream.ts is a hot file)Closes #1495