Repository navigation
fix: stop empty-compress-call retry loops — targeted no-content receipt (#1366) - #1384
Conversation
) A compress call carrying no content at all ({} / empty-string args — observed in #1366 as an 'empty companion' compress() emitted alongside the valid one) got the generic format lecture ending in 'Re-issue the compress call'. A structurally empty call can never satisfy that instruction, so a weak FC model looped the identical spec until the #847 repeat-failure guard tripped (~2h of context burn in the incident). applyRanges now detects the truly-empty case (kind empty-input / missing-content without per-entry reasons, excluding the #362 {ranges: ...} shape drift where re-issue IS the right advice) and returns a receipt that names the actual defect and forbids the re-issue. The #847 guard still records these failures; every other receipt is byte-identical.
…ry stay compressible (#1366) compressibleSpanHint told models '(everything up to mNNNNN is already inside active blocks)'. Blocks need not be contiguous: in the #1366 session a live gap (m05027–m05052 between two active blocks) sat below the boundary, and the flat claim contributed to the model's 'nudge vs tool conflict' confusion. Wording now hedges ('largely inside ... isolated free gaps may still exist'); kernel validation was always authoritative. Labeled in-passing fix found while working #1366.
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1384Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1384.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review complete — mergeable (merge itself stays human per §7.4: model-facing steering text in both modes is a product decision). No code changes needed; I pushed nothing. ① Original issue — direction check#1366's root cause holds up: the visible "mangling" is upstream dual emission (correctly left alone — stripping violates the documented #361/#295 decision), and the real in-repo defect is the receipt telling a structurally empty call to "Re-issue", an instruction it can never satisfy → identical-spec loop until the #847 guard (~2h / 806K tokens). The fix targets the producer of the bad loop (bili's own receipt text), not a symptom — right layer. I re-derived the incident from the #1366 floors: valid calls succeeded, every error receipt came from the empty companion; the fix addresses exactly that path. ② Regression audit — existing behavior of touched paths
③ CodePredicate is conservative and correctly ordered (per-entry reasons excluded first). Single-line receipt invariant (#1029) preserved — the new receipt is one line ending in ④ TestsAll five new assertions have teeth: presence of new substrings and absence of the old loop-bait tail; guard-key regex pin ( ⑤ Diff & base3 files, +58/−2, every line on-purpose, no whitespace/lockfile churn, no version bump. Two linear Evidence
修复了空 |
|
Deep review: ✅ merge. Verified on a detached worktree: compress-observability 15/0 · compress-span-hint 5/0 · typecheck ✓. Also confirmed the discriminating fact against the live kernel: The design principle is right: retry advice should exist only where a retry CAN succeed. A structurally empty call ({} / "") fails identically every time, so telling the model to "re-issue" is loop bait (the #1366 repro: the empty companion compress() retried until the #847 guard tripped); the {ranges: …} shape-drift case keeps the format lecture because renaming the key genuinely succeeds. Both receipts assert their own shape in tests, and the empty call is still recorded by the #847 guard — the loop-killer is the advice, not the telemetry. Span-hint hedge is honest: blocks need not be contiguous, so "everything up to N is inside active blocks" was a false claim when a live gap sits below the boundary — the hedged wording stops steering models into skipping compressible raw space. Kept short for empty calls (no span hint where no span was attempted). |
[bot] 🏷 Agreed on all points — your independent pass and mine converge: same discriminating fact against the live kernel ( Per repo rules I can't perform the merge — it's human-only. When you're ready: #1384 (head 双方独立复核结论一致(空调用定向回执 + span-hint 留余地措辞,判别边界与内核行为吻合、测试有牙、CI 全绿),无遗留问题,PR 已就绪,合并操作按仓库规则由人工执行。 |
…ad of degrading to {} (ranxianglei#1502)
When a model's compress arguments failed strict JSON.parse, three call sites (loop/core.ts streaming, compress-loop-responses.ts x2) discarded the raw string and executed against {}, bypassing the kernel's lenient salvage ladder (trailing comma / single quotes / fence / truncated prefix) and mislabeling corrupt calls as empty ones in the client-facing receipt. Retain the raw string on parse failure and feed it to parseCompressInput; give unsalvageable string input its own corruption receipt (safe length-only label, no payload echo) instead of the ranxianglei#1384 empty-call verdict; log head+tail to separate truncation from mid-string corruption.
Closes #1366
What
#1366 arrived as "compress function call mangled in LLM output". Diagnosis from the two screenshots + code trace: the visible mangling is upstream model dual emission (MiMo V2.5/V2.6-Flash via relay writes the compress call as literal text in its prose AND as the real structured block; bili passes both through verbatim in plugin mode — nothing to fix there, and stripping is forbidden by the documented #361/#295 decision). But the second screenshot exposed a real in-repo defect behind the user's repeated
kind=missing-contentfailures:compress()alongside each valid call. The valid calls succeeded; every error receipt came from the empty one.Changes (2 commits)
fix: targeted no-re-issue receipt for content-less compress calls—applyRanges(src/stream.ts) now detects the truly-empty case (kindempty-input / missing-content without per-entry reasons, excluding the [bug] 0.1.63 起 Windows persist EPERM 风暴:会话持久化静默丢数据(4.9k 次/117 会话)+ compress no-valid-ranges 拒绝 #362{ranges: …}shape drift where re-issue IS correct advice) and returns a receipt that names the actual defect and forbids the re-issue. The 出现持续压缩失败,无法自动恢复 #847 guard still records these failures.fix: hedge the span-hint covered-prefix claim— labeled in-passing fix found in the same incident: the hint said "(everything up to mNNNNN is already inside active blocks)", false when blocks are non-contiguous (the session had a live gap below the boundary); wording now hedges. Kernel validation was always authoritative.Behavior change (flagged per policy)
Model-facing receipt wording for content-less compress calls only:
[Compression FAILED: no valid ranges parsed (kind=missing-content, dropped=0). … Re-issue the compress call with a valid content array.][Compression FAILED: the call carried no content at all (kind=missing-content) — an empty compress() compresses nothing and can never succeed. Do NOT re-issue an empty call; if you meant to compress, put the non-empty 'content' array (elements {startId, endId, summary}) in that SAME single call.]All other receipts byte-identical; guard/advice text for the empty case changes from "Fix the argument shape…" to "An empty call fails identically on every retry — drop it instead of re-issuing."
Tests
{}and""; guard still records empty calls; [bug] 0.1.63 起 Windows persist EPERM 风暴:会话持久化静默丢数据(4.9k 次/117 会话)+ compress no-valid-ranges 拒绝 #362 shape drift keeps the format lecture (not mislabeled empty).Pre-flight (on d3c8af8, current master)
typecheck clean · 2639 pass / 0 fail (11 skipped = e2e gates) · build OK
Related: #1368 (filed from this issue — plugin-mode passthrough lacks the #361 warn-only log for tool-call-shaped XML in prose).