Skip to content

[PR] fix: progress-stall fail-fast in preflight fold loop (#7775) - #7788

Open
ranxianglei wants to merge 2 commits into
masterfrom
wt-7775-ework-daemon
Open

ranxianglei wants to merge 2 commits into
masterfrom
wt-7775-ework-daemon

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Summary

When the preflight fold is not making meaningful progress (net saving per round < 3% of the window), the 32-round marathon that saves only ~13.7K/round against a 730K gap is doomed. This PR adds a progress-stall check that fails fast when the average net saving over the last 3 rounds cannot close the gap in the remaining rounds.

Problem

Issue #7775 reports that a session with 1,894,041 local-est tokens (2.4x over the post-headroom window 792,576) enters preflight and runs 32 rounds, saving only ~13.7K per round. The total saving (~438K) is far less than the deficit (~801K), so the fold cannot close the gap. The user waits for the full 32-round marathon before the turn is refused.

Root Cause

The existing futility gate checks if the TOTAL foldable mass * FUTILITY_SLACK < deficit. In this case, the total foldable mass is large (many messages), so the gate does not fire. But the NET saving per fold is small (the summary re-enters the payload), so the fold is effectively futile.

Fix

Add a progress-stall check that tracks the net saving per round and fails fast when the average net saving over the last 3 rounds cannot close the gap in the remaining rounds. The check is gated on the progress rate (< 3% of the limit per round) to avoid interfering with the existing round-budget exhaustion behavior for high-overshoot cases where each fold removes a meaningful chunk.

Behavior Change

  • Old: The preflight fold loop runs up to 32 rounds (or the emergency cap of 512) before failing. In the issue's case, this takes ~2.5 minutes.
  • New: The preflight fold loop fails fast after 3 rounds when the progress rate is < 3% of the limit per round. In the issue's case, this takes ~15 seconds.

This is a behavior change: the fail-fast message is different from the round-budget exhaustion message. The new message says "progress stall: the average net saving over the last N rounds (~X tok/round) cannot close the ~Y-tok gap in the remaining Z rounds — the fold is not converging."

Tests

  • All existing preflight tests pass (15/15 in the targeted suite, 20/20 in the emergency-fold/client-abort/tier-recovery suite).
  • The progress-stall check does NOT fire in the existing test cases (the round-budget test and the issue3918 test), because their progress rates are above the 3% threshold.

Closes #7775 (problem 2: preflight stop ignored during preflight)

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: wt-7775-ework-daemon (878ce1c)

Latest build — install this exact version

npm install -g billion-context@0.0.12127-pr.7788.d98dde8

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
878ce1c billion-context@0.0.12127-pr.7788.d98dde8 build
829d3e1 billion-context@0.0.12113-pr.7788.af21ab6 build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr7788.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

查重: 不重复。 检索了 open issue/PR(含 [PR] 行全量清单):针对 #7775 问题 2(preflight 马拉松不收敛)没有其他在途 issue/PR;相关的 preflight PR(#7177 折叠前 doomed-body 判定、#4928 doom-bar 后继续收敛走查、#6467 baseline 口径)机制均不同。本 PR 是该问题的唯一修复。

标签: bug + p2 + dsh + scope/kernel(已打到本镜像线程;PR 侧已有同组标签,按 PR 自身 diff 复核过:改的是 src/preflight.ts 折叠循环 = src 侧压缩决策面 → scope/kernel 成立;p2 = 特定超窗场景下 2.5 分钟等待,有绕行,非可用性缺陷)。

当前状态(实时核实):

接下来:rebase → 补正向测试 → 定向跑 preflight 套件 → 推回 PR 分支 → 按八问给完整 review 结论。

When the fold is not making meaningful progress (net saving per round
< 3% of the window), the 32-round marathon that saves only ~13.7K/round
against a 730K gap is doomed. This adds a progress-stall check that
fails fast when the average net saving over the last 3 rounds cannot
close the gap in the remaining rounds.

The check is gated on the progress rate (< 3% of the limit per round)
to avoid interfering with the existing round-budget exhaustion behavior
for high-overshoot cases where each fold removes a meaningful chunk.

Closes #7775 (problem 2: preflight stop ignored during preflight)
ranxianglei pushed a commit that referenced this pull request Nov 26, 2026
…#7788)

After an authored bili-snapshot checkpoint lands, the ACP state is rebased
onto it and the compression blocks are wiped to 0 by design (the client
checkpoint replaced them; originals stay in CCR). The web panel's '压缩块 0'
state could be misread as data loss.

This change exposes the dshAuthoredCheckpointLanded session flag to the
detail payload and renders a one-line note in the empty-blocks state
explaining the rebase is expected and the originals are still in CCR.

Closes #7788
…7775)

The PR shipped the stall check with only negative-direction coverage (the
existing round-budget and issue3918 suites sit above the 3% progress-rate
threshold, so the gate must not fire there — and it does not). #3617 gate
discipline requires both directions.

This test is the positive direction: a 2.8x-over-window payload of many small
messages where every fold lands but each removes only a ~4.7k-tok range
(~2.4% of the 200k window, under the 3% gate) against a ~396k deficit. The
projected saving over the remaining rounds is a small fraction of the gap, so
the check must fire within the first couple of rounds instead of running the
full 32-round budget.

Verified as a genuine regression test: with the stall check removed the same
fixture runs the full 32-round marathon and reports 'exhausted after 32
rounds'; with the check present it fails fast after 2 rounds with the
'progress stall' verdict (2 summary calls, payload not forwarded).
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

Progress update — review work is done, CI is running:

Rebased onto current master. The PR head was cut from 1e357bf (2026-11-20), 464 commits behind master ced22b1. src/preflight.ts had 15 commits since the base (incl. the #2383 emergency-digest regime rework and the fresh-parallel fold lane). Rebased cleanly, no conflicts; the diff is byte-identical (shifted +188 lines). Verified the appliedThisRound === 0 block still always break/continues on the new master, so the stall-check placement (only runs in rounds where ≥1 fold landed) is preserved.

Added the missing positive regression test (tests/issue7775-preflight-progress-stall.test.ts). The PR shipped the stall check with only negative-direction coverage (the existing round-budget and issue3918 suites sit above the 3% progress-rate threshold, so the gate must not fire there — and it doesn't). #3617 gate discipline requires both directions. The new test is a 2.8×-over-window payload of many small messages where every fold lands but each removes only a ~4.7k-tok range (~2.4% of the 200k window, under the 3% gate) against a ~396k deficit — the check must fire within the first couple of rounds. Verified it is a genuine regression test: with the stall check removed the same fixture runs the full 32-round marathon ("exhausted after 32 rounds"); with the check present it fails fast after 2 rounds with the "progress stall" verdict (2 summary calls, payload not forwarded).

Local verification (targeted only, per local-testing discipline): all 7 preflight suites pass (31 tests: round-budget, issue3918, issue1841 futility, emergency-fold, client-abort, issue2952 tier-recovery, + the new test). Typecheck clean, build succeeds.

Pushed the rebased branch + test to the PR head (wt-7775-ework-daemon → 878ce1c). CI is running now (30 checks, 0 failed, 6 pending). I'll post the final structured verdict (8问) once CI is green.

ranxianglei pushed a commit that referenced this pull request Nov 28, 2026
…#7788)

After an authored bili-snapshot checkpoint lands, the ACP state is rebased
onto it and the compression blocks are wiped to 0 by design (the client
checkpoint replaced them; originals stay in CCR). The web panel's '压缩块 0'
state could be misread as data loss.

This change exposes the dshAuthoredCheckpointLanded session flag to the
detail payload and renders a one-line note in the empty-blocks state
explaining the rebase is expected and the originals are still in CCR.

Closes #7788
ranxianglei pushed a commit that referenced this pull request Nov 28, 2026
…param

The panel fix (#7788) intentionally added the authoredCheckpointLanded parameter to buildTreePane so the empty-blocks card can explain the authored-checkpoint rebase. The #4608 bundle-shape gate still pinned the old one-arg signature, so it failed on every OS/shard that runs it (shard 1: ubuntu 22/24 + windows 22). Update the pin to the new two-arg signature.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dsh p2 scope/kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant