Repository navigation
[PR] fix(#7821): compress failure path — one-line parse, in-flight-ref message, armed-refusal no-increment - #7822
ranxianglei wants to merge 11 commits into
Conversation
⚠️ MODEL-FACING TEXT CHANGE: two model-visible error strings changed. Facet 1 (parse-compress-input.ts): a one-line entry with text after the refs (e.g. 'm09309–m09309 Final.') was rejected as 'missing summary' even though the error message says the summary may be on 'the same or the next line'. The parser only read the summary after a newline; text after the refs on the header line was treated as the topic. Fix: when there is no newline, the text after the refs IS the summary. Header-only entries (no text after the refs) are still rejected. Facet 2 (boundaries.ts): startId at exactly highest+1 (the in-flight assistant message being written, which has no ref yet) was refused with the generic 'stale artifact from an earlier generation' message. Fix: a dedicated message tells the model the ref belongs to the message it is currently writing, that it has no ref yet, and that it should continue the turn. kernel-change: fix two provably-mechanical defects in the compress failure path (wrong parse of a documented one-line form; wrong error message for the in-flight case). Both have reproducing regression tests. Bumps kernel version 0.0.200 -> 0.0.201.
…7821)⚠️ MODEL-FACING TEXT CHANGE: the armed-refusal receipt now includes the last failure's cause ('Last failure: ...'), so the model can self-correct even while the breaker is armed. BEHAVIOR CHANGE (old -> new + why): - OLD: every compress failure while the breaker is armed incremented the streak counter (n) and refreshed lastAt, so the 10-minute decay could never elapse while the model kept retrying — the model was locked out indefinitely (25 calls in 8 minutes, counter climbed to 22, decay unreachable). - NEW: a failure while the breaker is already armed is a REFUSAL, not a new failure — it does NOT increment n and does NOT refresh lastAt. The count stays at the threshold while armed, so the decay can actually elapse after 10 minutes from the last non-armed failure. The armed receipt also carries the last failure's cause (invalidReasons[0]) so the model can self-correct instead of blindly retrying. - WHY: the old behavior turned the breaker (a 10-minute cooldown) into a permanent lockout whenever the model kept retrying, which is exactly what the DSH plugin-native session in #7821 showed. Applies to both the parse-failure path and the stale-ref failure path in applyRanges. The preflight lane (loopTracking:false) is unaffected (it never arms the breaker).
…fusalReceipt + kernel version conflicts - kernel/package.json: master moved 0.0.200 -> 0.0.211 while this PR bumped 0.0.200 -> 0.0.201; this PR carries kernel source changes, so the bump continues on master's head: 0.0.211 -> 0.0.212. - src/stream.ts armedRefusalReceipt: union of intent — keep this PR's cause parameter + 'Last failure:' note, keep master's wording (ce07358 removed the JSON-array format note; da7bda3 moved the disarm wording to 'one substantial fold (a trivial one that saves almost nothing does not count)'). Both master changes are intentional model-facing text changes; the PR's base was simply stale. Targeted tests green on the resolved head: kernel parse-compress-input / issue4521-retry-livelock / compress / issue3302-sparse-ref-unknown (149 pass), host issue7821 / issue2146 / issue4812 breaker suites (20 pass), typecheck clean.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.12638-pr.7822.307bc4bThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr7822.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 — no other open PR targets #7821; this is the only fix PR for the thread. What I did this round (PR #7822, branch The PR was dirty against master (
Drive-by fix (own commit Verification on the resolved head (targeted, per local-test discipline): kernel 八问(PR #7822 审核结论):
状态:PR 已可合并( |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Follow-up — second lockfile drift found and fixed (drive-by, own commit The first CI pass on the merged head failed Status on head |
(ai: vllm-qwen/qwen3.8-27b) CI fix run — lock-sync red on PR #7822: already fixed on the branch, verified locally, CI re-running. Live state verified this run (mirror cache + one-shot API, head
No further action taken this run — nothing left to push. If any check goes red on head 八问
判定:lock-sync 红已在分支上修好( |
…l' parse #7821 introduced This PR's facet 1 (one-line entries: text after the refs IS the summary) broke the #3780 host salvage's invariant — 'a no-real-newline string always yields zero ranges undecoded'. A double-escaped payload like 'm00001–m00002 example topic<literal backslash-n>folded summary body' now 'parses' undecoded with the literal backslash-n glued into the summary, the salvage gate (failed parse only) never fired, and the corrupted summary would have been folded. CI caught it: test (windows-latest, 22, 1) — issue1494-compress-params.test.ts '#3780: double-escaped line-form string ... is decoded once and recovered' (expected 'folded summary body', got 'example topic<literal backslash-n>folded summary body'). Fix (host layer, which owns the whole-string decode): the salvage now also runs when the undecoded parse SUCCEEDED but the content is a no-real-newline string carrying a literal backslash-n, and adopts the decoded result on the same range count (> 0) — the decoded parse carries the real header/summary split, the undecoded one cannot. Multi-entry double-escape (decoded parses more ranges) and all non-double-escape shapes are unchanged. Stale comments in src/compress-tool.ts and the test file updated to the new invariant.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Follow-up — CI caught a real regression in this PR's own facet 1; fixed on the branch (commit What CI found: Root cause (my facet-1 kernel change broke an existing host salvage): the #3780 double-escape salvage in Fix (host layer, which owns the whole-string decode): the salvage now also runs when the undecoded parse succeeded but the content is a no-real-newline string carrying a literal Verification (targeted, local): CI state (verified live just now): the run on 八问(本轮 #3780 回归修复):
判定:PR 代码面已收敛(3 个 facet + 3 个 drive-by:kernel lockfile、root lockfile、#3780 救捞),等重跑的 CI 出全绿判定。 |
# Conflicts: # kernel/package-lock.json # kernel/package.json # package-lock.json
(ai: vllm-qwen/qwen3.8-27b) Conflict re-landed after master advanced — merged, resolved, pushed. PR is mergeable again. What happened: master moved 60 commits past this branch's base (incl. kernel bumps 0.0.212 → 0.0.213 → 0.0.214 for the thinking-relay and multi-image kernel fixes), which re-dirtied the PR. The branch itself also gained one new commit since my last run — What I did this run:
八问
判定:冲突已解,分支已推( |
Local test of PR #7822: the in-flight-ref loop is still presentI applied the current PR #7822 diff (facets 1–3) plus the #3780 fix (commit 6d47bc3) to a local copy of billion-context 0.1.216 (DSH 0.2.2-rc.5, Windows 11, deepseek-flash), restarted the proxy, and re-ran the long-lived session from the original report. This is a local trial build, not an official release; the proxy loaded the patched bundle (SHA256 73F57E0B...). Result: facets 1 and 3 work, but the model still loops on its own in-flight message. Facet 2's dedicated message is present in every receipt and is ignored. Evidence (local time UTC+8; session id omitted; no conversation content): (Lines are trimmed with
Why facet 2 is not enough Returning an error keeps the model in "fix the tool call" mode. The dedicated message is accurate, but it competes with the generic stale-ref instructions that precede it, and it still looks like a retryable tool error. Suggested changes (owner decision)
Facet 3 is a clear improvement (the counter no longer climbs), but the user-visible loop remains: "22 failures" becomes "unbounded refusals with n=3". If useful, I can test the success-no-op variant locally and report back; I did not modify the PR branch. |
…t.ts (not related to this PR's changes)
CI state re-verified live — the reported blocker is already resolved; no fix needed this run.
七问
判定: CI 全绿、无冲突,PR 处于可合并状态(mergeable: true;behind 非阻塞)。本轮收工,无进一步动作。 |
🔶 需要决策 For @ranxianglei (owner) — a design decision is needed on PR #7822 before the in-flight-ref loop can be fixed. I am stopping here; I have not modified the PR. The reporter (@PiPiMoe — an outside user; their words are reference opinion, not an owner decision) reports that after facets 1–3 of PR #7822 the model still loops on its own in-flight message (12 compress calls in 47 s, every ref =
All three proposed variants are changes under Options (as proposed by the reporter):
My recommendation: A as the primary fix — it directly removes the diagnosed root cause (the generic framing competing with the in-flight instruction), is the most surgical and lowest-risk, keeps correct error semantics, and is testable at the receipt level (assert the exact model-visible string). Fall back to B if A does not stop the loop in a local re-test; use C only as a last-resort safety net (most complex, does not fix the root cause). Default if undecided: ship nothing new — keep the current facet 2 behavior (in-flight instruction appended to the generic receipt). All three variants are kernel + model-facing changes that need your go; I will not implement any without it. Gated diff (for your approval): 八问
判定:需要 owner 拍板 A/B/C(或都不做)。已打 |
Resolve kernel version + lockfile conflicts from the master merge: - master advanced the kernel 0.0.214 -> 0.0.217 (crush rewriter removal, tier-boundary auto-split #7770, warn-channel #7729/#7791). - this PR's pending #7821 kernel change (one-line parse fix + in-flight-ref message, kernel/src/boundaries.ts + parse-compress-input.ts) is NOT in master, so the merged kernel bumps to 0.0.218 (master 0.0.217 + 1). - kernel/src files: zero overlap between the two sides (clean auto-merge); the only conflicts were the version field + the two lockfiles. - lockfiles lock-synced (npm install --package-lock-only, no drift on root or kernel).
(ai: vllm-qwen/qwen3.8-27b) Merge conflict resolved — PR #7822 is mergeable again (no longer What I did this run:
Verification (live, this run):
Note: this run was scoped to the merge-conflict resolution only. The separate in-flight-ref-loop design decision (🔶 需要决策, 八问
判定:冲突已解决并验证( |
…sertions (#7976 follow-up) #7976 added the unconditional eg_debug wire-evidence table (created in BOTH modes) but did not update the table-count assertions in tests/eg-sweep-egress-identity.test.ts, so every PR head rebased past the #7976 merge fails shard 1 (A1/A1b/B1: 9 vs 8 fresh-eg tables, 21 vs 20 legacy/converged). Master-level born-red (latent on master because the heavy test lane is plan-skipped on master push/schedule events); fixed here as a small mechanical expectation update so this PR's CI can go green. (cherry picked from commit 0682f5b)
(ai: vllm-qwen/qwen3.8-27b) 3 red test jobs fixed — pushed What was failing: Root cause — a master-level born-red, not this PR's code: PR #7976 added the unconditional Fix (small mechanical, test-only): cherry-picked the existing already-reviewed fix Verification (live, this run): PR Coordination note: the fix currently lives only on the feature branch 八问
判定:3 个红 job 已修(cherry-pick 既有修复 |
…218->0.0.219 Master advanced past the merge-base via PRs #7916 (eg_debug table-count fix, already cherry-picked here) / #7987 (eg_debug response-headers test) / #8028 (kernel WHEN-NOT-TO-COMPRESS gate). The only conflict was the eg-sweep test file: master added a new response-headers test block this branch lacked, so the resolution takes master's version (a superset - this branch's only change, the eg_debug table-count fix, is identical to master's). Kernel version: both sides were at 0.0.218 (this branch for #7821, master for #8028) - a collision. Bumped to 0.0.219 so the merged kernel (carrying both #7821 and #8028 changes) has a distinct version and the kernel-guard passes.
(ai: vllm-qwen/qwen3.8-27b) Conflict resolved and pushed. Master advanced past the merge-base via three PRs — #7916 (eg_debug table-count fix, already cherry-picked into this branch in the previous run), #7987 (new eg_debug response-headers test), and #8028 (kernel WHEN-NOT-TO-COMPRESS gate). The only conflict was in I also bumped the kernel version Pushed as the final head 八问
判定:冲突已解决,PR 现在 mergeable(mergeable_state: blocked = 等 CI 检查),可进入正常 review/合并流程。 |
kernel-change: fix two provably-mechanical defects in the compress failure path
Both kernel changes are mechanical (wrong parse of a documented one-line form; wrong error message for the in-flight case), each with a reproducing regression test. The host change (facet 3) is a behavior change requested by the issue.
What this fixes (Closes #7821)
A long DSH plugin-native session (1005 msgs, 147 blocks) after a generation change entered a compress retry loop: 25 calls in 8 minutes, 0 acp_status, ending at a 22-failure armed refusal. Three distinct defects compounded:
Facet 1 — one-line entries rejected as 'missing summary' (kernel)
parseLineEntry()only read the summary after a newline; text after the refs on the header line was treated as the topic. A one-linem09309–m09309 Final.was rejected even though the error message says the summary may be on 'the same or the next line'.Fix: when there is no newline, the text after the refs IS the summary. Header-only entries (no text after the refs) are still rejected.
Model-facing change: one-line entries with text after the refs are now ACCEPTED (previously rejected). The model's natural one-line form now works.
Facet 2 — in-flight-ref (highest+1) gets a dedicated message (kernel)
startIdat exactlyhighest+1(the in-flight assistant message being written, which has no ref yet) was refused with the generic 'stale artifact from an earlier generation' message — which is wrong (it's not stale, it's the current turn).Fix: a dedicated message tells the model the ref belongs to the message it is currently writing, that it has no ref yet, and that it should continue the turn.
Model-facing change: the error message for
startId == highest+1changed from 'stale artifact from an earlier generation, or a typo' to 'the assistant message you are currently writing — it has no ref yet (refs are minted on the next request). Do not compress it now; continue the turn and it will be compressible on a later call.'Facet 3 — armed refusals no longer increment the streak (host)
BEHAVIOR CHANGE (old → new + why):
Model-facing change: the armed-refusal receipt now includes 'Last failure: ' so the model can self-correct. The counter no longer climbs while armed (stays at the threshold).
Behavior change disclosure (required by §7.3)
m09309–m09309 Final.rejected ('missing summary')Tests
parse-compress-input.test.ts(one-line pair + one-line single-ref); 3 existing tests updated (header-only cases now use bare refs lines).issue4521-retry-livelock.test.ts(startId at highest+1 gets dedicated msg; startId above highest+1 keeps stale-ref msg).issue7821-armed-breaker-no-increment.test.ts(armed parse-failure no-increment, cause in receipt, un-armed still increments, armed stale-ref no-increment, decay can elapse).issue2146-compress-loop-breaker.test.ts(count stays at threshold while armed),issue4812-armed-breaker-short-receipt.test.ts(count stays at threshold, not climbing).Not implemented (design decision, flagged for owner)
The issue's suggested fix #5 ('consider not arming on parse failures at all') is a DESIGN DECISION — I have NOT implemented it. It would change the breaker's semantics (parse failures would never arm the breaker, only stale-ref/substrate failures would). Flagging for owner decision.
Files changed
kernel/src/parse-compress-input.ts— facet 1 (one-line parse)kernel/src/boundaries.ts— facet 2 (in-flight-ref message)kernel/package.json— version bump 0.0.200 → 0.0.201kernel/tests/parse-compress-input.test.ts— facet 1 testskernel/tests/issue4521-retry-livelock.test.ts— facet 2 testssrc/stream.ts— facet 3 (armed-refusal no-increment + cause in receipt)tests/issue7821-armed-breaker-no-increment.test.ts— facet 3 tests (new)tests/issue2146-compress-loop-breaker.test.ts— updated for new behaviortests/issue4812-armed-breaker-short-receipt.test.ts— updated for new behaviorCloses #7821