Repository navigation
[PR] fix: pause compression nudges when folds stop shrinking the session - #5092
ranxianglei wants to merge 17 commits into
Conversation
…5058) Companion-style long sessions hit a pure positive feedback loop: every nudge round ends in a successful compress whose own action cost (tool-call args, receipts, reasoning — all persisted by the host and re-sent next turn) outweighs what the fold removed, so the flat-50K growth gate re-arms forever and the session walks past its window while every standing guard stays silent (the #2748/#3322 gate judges one commit in isolation, the #2146 breaker counts failures, #2155 D1 needs reductions to STOP landing, #3461 covers host emergency injections only). Add the cross-round trajectory view: recordNetProgressBaseline at each successful fold commit (live-view tokens + post-fold estimate, same kernel counter space per #1911); evaluateNetProgressRound once per nudge-carrying request compares the client's raw resend against pre-fold-level-minus-margin (25_000 = half the flat step). Two consecutive non-progress rounds latch a per-session nudge suppression through nudgeInjectionBlocked at all four lane gates (decide-ladder fallback punch-through preserved, #3004 deadlock guard shared with D1); any demonstrable reduction lifts it early and the SELF_HEAL_SUPPRESS_CAP_MS wall cap bounds silence. Armed state surfaces on /__bili/sessions (netProgress) and as a Web UI badge; arm/recovery/expiry log [net-progress] lines. No config surface — constants by design (#2155 precedent). Tests: tests/issue5058-net-progress-guard.test.ts (strike state machine, boundary, wall cap, fresh-window reset, corrupt-state tolerance, OR semantics against the #2155 latch).
) CLIENTS.md (en+zh): the pre-send local refusal failure mode for long-lived plugin-mode sessions (dsh's overflow guard measures its own unpruned local store, so once it exceeds the window no traffic reaches bili and no automatic recovery can fire), the known refusal wording for host-side detection regexes, and the rotation / nudgeGrowthTokens / file-size-watch mitigations plus a pointer at #5052. TECHNICAL-NOTES.md: net-progress guard constants and semantics (baseline/strike/margin/wall-cap), alongside the #2155 self-heal section.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.12299-pr.5092.7d59180This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5092.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 本 PR 是 #5058(陪伴类长会话 nudge 自我放大直到超窗永久报废)的修复单;open+closed issue/PR 全量检索无同机制的并行工作(跨轮净进展守卫 / nudge 暂停)。相关条目:#5033(同死锁模式不同机制,不并案)、#5052(关联功能请求)。 这是已提交的修复 PR(#5058 线程 floor 27),按规则不重做 —— 现在做独立审核:重新通读全量 diff、审既有行为回归、本地定向测试、核对 pushed head 的 CI 状态。完成后按结构化八问回复结论。 |
(ai: vllm-qwen/qwen3.8-27b) 进度汇报(进程曾被重启,已恢复继续):独立审核进行中。已完成:通读新模块 src/net-progress-guard.ts(140 行)与全部接线 diff(handle.ts / stream.ts / lane-decisions.ts / prepare-*×4 / web 三件)。正在核实一个关键前提 —— 「基线与轮次测量同 token 空间」:stream.ts 的基线记在 |
recordNetProgressBaseline ran on EVERY successful fold commit and wrote session.metadata["netProgressGuard"]; persist serializes session.metadata into the state file, so every long-session storage golden drifted its persisted-state digest deterministically on all three CI platforms (the six red test shards at b88abf4: storage-engine-proofs full-mode restart x4 wires + golden-storage-render x4 wires). The latch now lives process-local in a WeakMap keyed by the session object (#4790 precedent - same mechanism family, same fix shape): entries die with their session object, an evicted-and-reloaded session re-seeds silently, which is harmless because the latch self-expires within SELF_HEAL_SUPPRESS_CAP_MS (10 min) anyway, and a fresh arm needs one more successful fold commit plus at most NET_PROGRESS_STRIKE_LIMIT non-progress rounds. /__bili/sessions netProgress reads the live store (badge visible while the session object is live; disk rows do not badge). Adds a regression pin asserting session.metadata stays untouched across every mutation path.
(ai: vllm-qwen/qwen3.8-27b) CI 红已修复,全车道绿。 最终 head 八问:
行为变更披露(本 PR 两个 commit 之间,旧值→新值+原因):latch 状态原设计随 验证链:本地复现红(digest 漂移值与 CI 一致)→ 修复后定向套件绿 → push → 远端 CI 全绿(判定以 CI 为准,本地未跑全量)。结论:可合并(请人工合并 #5092 );#4599 已留一行结论。 |
(ai: vllm-qwen/qwen3.8-27b) 这条失败通知是过期重复转发,无需再修。 它指向的 head 仍是
详细八问见上一条回复。结论不变:可合并(请人工合并 #5092 )。不重复开 issue、不做重复修复。 |
(ai: vllm-qwen/qwen3.8-27b) [bot] 进程被重启前的进度汇报:本 issue 的工作已全部完成,无阻塞。
当前无待办:等人工合并 #5092 。若合并后有新事件(如 owner 评论或新一轮 CI),再按新指令处理。 |
…in client-resend space Review corrections for the #5092 guard (two facets of one measurement integrity defect): 1. Lane scope — plugin lanes only (session.metadata.pluginAgent bound). Only plugin hosts persist and re-send the compression action itself, so only there does the resent payload shrink when a fold works. Proxy-mode clients keep their full local history and re-send it verbatim every turn; once folded coverage exceeds the 25K margin the raw resend structurally never drops below pre-fold-minus-margin, so an unscoped latch would arm on every mature proxy session and silence the flat-50K nudge cadence (KDD #8) without defending anything. The #5058 swelling domain is plugin-mode only. 2. Same-space baseline — recordNetProgressBaseline now takes the inbound RESEND total (stream.ts rawViewTokens — same array class as the round check counts over prepared.originalMessages) instead of the rendered live view. Mixing spaces would distort the bar by the reasoning-drop delta on heavy-reasoning hosts. postCtx stays the rendered post-fold estimate (diagnostic only). Tests: proxy-mode negative row (guard stays inert, cadence untouched); persistence pin updated. TECHNICAL-NOTES.md: lane-scope + baseline-space bullets.
(ai: vllm-qwen/qwen3.8-27b) 独立审核结论:方向正确,发现并当场修复两处测量缺陷——其中一处是原实现引入的未披露回归(proxy 模式平 50K nudge 节奏被整体掐灭),已把守卫收窄到插件车道。 diff 全部 15 个文件逐行读过(未沿用 issue 侧结论),四个既有防御机制的漏法逐一验证。 ① 方向关 ✅:#5058 根因成立——压缩动作本身(tool-call 参数含摘要全文、回执、回合推理)被插件宿主持久化进历史、每轮重发,fold 省得比动作花得少时纯正反馈不收敛;kernel 每次成功 compress 后重置基线,下一次 nudge 永远再隔一个平 50K 步到来。既有四道防御(#2748/#3322 单轮净收益、#2146 失败断路器、#2155 自愈 D1、#3461 紧急退避)各按设计恰好漏掉这个形状。加跨轮轨迹视图方向对;补救用抑制不用删除,#3004 死锁逃生口保留。 ② 回归审计——发现原实现一处未披露回归(已修):baseline 记的是渲染活视图(stream.ts ②b 第二处测量空间缺陷(顺手修):即便插件车道内,baseline 也应与观测同一空间(客户端重发量),否则重推理宿主会被 reasoning-drop delta 扭曲门槛。stream.ts 改传 ③ 代码关 ✅:状态机逻辑、常量(margin 25K=半步,吸收估算噪声+一轮物化滞后;2 strikes)、wall cap 复用 SELF_HEAL_SUPPRESS_CAP_MS(10min)、与 #2155 的 OR 语义、Web 徽章/i18n 均无问题。作者自推的 3f4b7ef(latch 从 session.metadata 移入进程本地 WeakMap,#4790 先例,修 storage golden drift 红)方向正确,两套 storage 套件本地绿。 ④ 测试有效性:单测有牙(严格 八问:
行为披露(old→new):PR 正文称守卫作用于「all sessions」、baseline 为「live-view token total」——修正后实际交付 = 仅插件车道 + baseline = 客户端重发量。原因:proxy 客户端每轮重发完整历史且 fold 不缩小它,套用会纯伤害(KDD #8 节奏被掐);异空间测量在重推理宿主上扭曲门槛。 当前状态与合并判定:修正 commit 本地就绪(定向测试+typecheck 全绿),但推送暂被本环境到 github.com 的网络故障阻塞(Connection reset by peer,含只读 ls-remote 在内多次重试约 10 分钟失败,判断为瞬时出口故障而非凭据问题)。注意:修正第一版 98dc0ba 已推上去,其中新增的 proxy 负例有一个 JS 默认参数坑(undefined 触发默认值)会在 CI 显示 1 红;修正版 6a57f3db4 网络恢复后立即推上并补说明,届时以 CI 为准。CI 绿后建议合并。超范围项 A/B/C(summaryMaxChars clamp / DSH 上游诉求 / compaction 归属策略)已在 PR 正文列出待你拍板,不阻塞本 PR 合并。 |
(ai: vllm-qwen/qwen3.8-27b) 补充状态:到 github.com 的出口网络故障仍在持续(约 25 分钟,只读探测同样失败),修正版 commit |
…inel for unbound fakes
CI (3 shards, same subtest): 'proxy-mode sessions are out of scope' expected no evidence window but got {baseline: 600000, expectedFloor: 120000, strikes: 0}. Root cause is the test helper, not the guard: a JS default argument fires when the passed value IS undefined, so mkSession(undefined) hits the '= "dsh"' default and produces metadata {pluginAgent: "dsh"} — exactly the binding that arms the guard. The implementation already gates on session.metadata.pluginAgent per spec (plugin lanes only), so the proxy-mode row needs a sentinel that survives the signature: null.
|
(ai: sglang-gpu0/qwen3.8-27b) CI 三个 shard 全红的是同一条子测试( 根因不在守卫实现,在测试的假会话构造器。 最新提交已经把守卫门控在 修法:测试 helper 改用 本地验证: old→new:此前这条本应证明「proxy 模式不 arm」的 CI 行其实一直在 arm 一个 dsh 绑定的假会话;现在它真的构造无绑定会话并证实守卫不碰、nudge flat-50K 节奏不受影响。插件车道行为不变。新提交 4fc74f1,请对新提交看 CI。 |
(ai: vllm-qwen/qwen3.8-27b) No new merge needed for this trigger: master has not advanced past the previous sync — live master is still |
…onflicts
Criss-cross merge: 90 conflicted paths resolved master-side (branch carried
foreign copies of master commits; every non-PR conflict verified as pure
master forward progress) with the PR's 15-file delta re-applied verbatim.
Docs retargeted to docs/clients{,.zh-CN}.md + docs/technical-notes.md per
the #5920 move; 4 master-only files dropped by the multi-base merge
(mdrender.ts + 3 tests) restored.
(ai: vllm-qwen/qwen3.8-27b) Merge conflict resolved and pushed. What the conflict actually was: the branch history carries foreign copies of master commits (criss-cross — 4 merge-bases), so the merge produced 90 whole-file conflicts, most of them in files the PR never touched. For every non-PR conflicted file I verified the branch side was byte-identical to the last-synced master tip or pure master forward progress (incl. the 3 exceptions Two non-obvious things found and fixed along the way:
Verification (local, targeted per test discipline): 八问:
收工判定:冲突已清零、推送完成、本地门禁全过,等待 CI 在 |
(ai: vllm-qwen/qwen3.8-27b) [bot] 重启后状态复核(上一条完整报告已发出,此处仅确认无未完成项):本地 HEAD 与远端 |
…ict resolution Two add/add conflicts (src/web/mdrender.ts, tests/mdrender.test.ts) resolved master-side: the branch carried Nov-12 snapshots of these files, master moved on since, and the PR never intended to touch them. One criss-cross resurrection fixed: the multi-base merge re-introduced a 152-line block in src/web/sessions-data.ts (parseBlockContentMessages snapshot machinery) that master had deleted after the branch's last sync. Rebuilt the file as current master + the PR's 3 hunks only. Final tree delta vs master = exactly the PR's 15-file contribution (+571/-19), verified file-by-file.
(ai: vllm-qwen/qwen3.8-27b) Second conflict pass done and pushed. What this pass had to deal with (master moved 588 commits since the Nov-12 sync):
Local gates (targeted per test discipline): 八问:
收工判定:冲突已清零、推送完成、本地门禁全过,PR 现为 blocked(等 review/CI),等待 CI 在 |
…le map The PR added the new src/net-progress-guard.ts module but the architecture-docs CI guard (tools/check-architecture-docs.mjs) requires every tracked src/ file to be listed in reference/architecture.md. Adding the missing entry so the guard passes.
(ai: vllm-qwen/qwen3.8-27b) CI auto-fix run (attempt 1/6) — done, PR is fully green. Re-verified the live check state first (the mirror cache was ~2.5h stale, so I used single live API fetches, no polling). The event reported one failing check, but the live state had two:
Pushed the fix → fresh run 结构化结论(八问)
判定:PR 现已全绿(52 checks:38 success + 14 skipped,0 failure),CI 侧无阻塞,可进入人工审批/合并。 |
|
(ai: vllm-qwen/qwen3.8-27b)
APPROVE — clean, well-scoped, well-tested. This fixes the #5058 companion-session compress spiral: in plugin mode the compress ACTION (tool-call args + receipt + turn reasoning) is persisted by the host and re-sent every turn, so when a fold's savings do not exceed its action cost the session grows unboundedly and the flat-50K nudge re-trips forever with no convergence. The guard adds the missing cross-round trajectory view: after each successful fold it baselines the client's raw-resend level, and two consecutive rounds that fail to drop below baseline−25K latch a per-session nudge suppression (same channel as #2155) until a round demonstrably reduces the context or the 10-min wall cap expires. Verified against the code:
No small findings to fix on the spot. 结构化八问
判定:APPROVE,可合并。 |
[bot] 🏷 Review of PR #5092 (head Full justification + 结构化八问 are in the review comment above (posted as a comment because GitHub blocks approving one's own PR — same account owns the PR and the token). What was verified:
No small findings to fix on the spot. Ready for merge. One note: the review-lane dispatch asked for a one-line report on a "coordination issue" — no such issue was identifiable from my context, so if one exists, point me at it and I'll post the line there. |
…} conflict Both sides added different dsh sections at the same anchor: PR #5058 (long-running-sessions wall + net-progress guard) and master (DSH Go host). Kept both (union of intent), blank line between. Local: typecheck green, net-progress-guard suite 11/11, architecture-docs green.
(ai: vllm-qwen/qwen3.8-27b) Resolved the merge conflict on this PR. What was conflicting. The PR (head
How I resolved it. Merged Local verification (before pushing). Push. Committed the merge as the final head Result. Note: the mirror check cache was stale (still showing the previous head from 2026-11-16), so I confirmed the new head's CI with bounded single live fetches rather than tight polling. 中文八问
判定:冲突已解决, |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Re-review on new head The new head PR diff unchanged. Docs conflict resolution is clean. Both Re-verified locally on the new head:
No 结构化八问(合并头复核,与首轮一致):
Ready for merge. |
[ework] CI fix verified green ✓ |
1 similar comment
[ework] CI fix verified green ✓ |
…lict master replaced the uncovered.js 'uncoveredHistoryRuns' import/usage with the richer 'uncoveredAudit' (plus formatProtectedMassCompact / PROTECTED_MASS_RENDER_FLOOR); the PR added the 'recordNetProgressBaseline' import for the #5058 net-progress guard. Union of intent: keep master's uncovered.js import (the merged body uses uncoveredAudit) and the PR's net-progress-guard import; drop the now-unused uncoveredHistoryRuns.
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
APPROVE — clean, well-reasoned, well-tested.
The net-progress guard is the right mechanism for the #5058 companion-session spiral: it measures the cross-round trajectory of the client's raw resend (the one thing every standing guard is blind to), arms a per-session nudge suppression after two consecutive non-progress rounds, and lifts on a demonstrable reduction or the #3004 wall cap. The lane scope (plugin-only) is correct and well-justified — proxy-mode resends structurally never drop below the bar, so an unscoped latch would silence the flat-50K cadence (KDD #8) without defending anything. The process-local WeakMap storage is the right call (persist serializes session.metadata; a persisted latch would drift every storage golden on every long session, #4790 precedent). The same-space discipline (#1911) holds: baseline and round check both use countMessageTokens over the client's raw resend (ctx.compressMessages = prepared.originalMessages in the relay path). The decide-ladder fallback punch-through is preserved (same #3004 deadlock guard as D1). Tests cover the strike state machine, boundary, wall cap, fresh-window reset, corrupt-state tolerance, OR semantics, proxy-mode exclusion, and healthy-session non-arming. No kernel/ changes, no config surface, no persistence format change, no wire protocol change. Behavior change disclosed (old: nudges continued forever; new: paused after two non-progress rounds, lifts on reduction or 10 min).
八问(review 结论)
- 是什么问题:陪伴类长会话(几百轮、跨天)里,compress nudge 形成正反馈——每次压缩动作(tool call 参数 + 返回体)被宿主持久化并重发,反而撑大了触发 nudge 的那段上下文;会话一路涨过模型窗口后被宿主发送前的超窗守卫拦死,没有 provider 报错,任何自动恢复都够不着,会话永久报废。
- 什么原因导致的:kernel 每次成功 commit 后重置 baseline,下一个 nudge 再过恒定 50K 步长才到期,而压缩动作本身重新触发增长门——纯正反馈、无收敛。所有既有守卫按设计都看不到这个形状:#2748/#3322 净收益门只判单次 commit;#2146 熔断器数连续失败(成功但净负的折叠会清掉它);#2155 D1 需要缩减停止落地(这里每轮都落地);#3461 紧急回退只限宿主侧紧急注入。没有任何守卫量跨轮重发负载的轨迹。
- 影响范围与严重程度:plugin 车道(dsh-native、pi 等)跑几百轮的长会话(陪伴类场景)。严重度:会话完全不可用(永久报废),唯一出路是删掉重建(陪伴场景 = 对话记忆清零)。p1(可用性缺陷)。
- 怎么修复的:新增
src/net-progress-guard.ts量跨轮轨迹——每次成功折叠 commit 后记录 baseline(入站重发总量),之后每个带 nudge 的轮次量当前重发量;连续两轮未跌破 baseline−25K 边距就 latch 一个 per-session nudge 抑制(走 #2155 同一条 suppress-nudge 通道),直到某轮证明性缩减或 10 分钟墙钟到期。latch 状态 process-local(WeakMap 按 session 对象键控),绝不持久化。lane 范围仅限 plugin(session.metadata.pluginAgent绑定)。 - 是否有回归问题:审过既有行为——四个 prepare 车道的 nudge 门从
nudgeSuppressed(仅 #2155)换成nudgeInjectionBlocked(#2155 OR #5058),decide-ladder 回退穿透保留(#3004 死锁守卫同 D1),#2155 既有行为不变、#5058 latch 是纯增量;guard 仅 plugin 车道生效,proxy 会话不受影响(KDD #8 恒定 50K 节奏不动);latch process-local 不持久化,存储 golden 不漂移(PR 加了 regression pin 断言session.metadata不被碰);baseline 记录在成功路径(折叠 commit 之后),不影响失败路径。无高危模式(语义漂移 / fail-fast 变吞错 / 阈值时序输出格式变化)。唯一行为变更是新增 nudge 抑制(PR 已披露旧值→新值+原因)。 - 是否破坏缓存:否。guard 不碰缓存、重试、增量游标、去重键。nudge 抑制是既有机制(#2155 suppress-nudge 通道),缓存行为不变。
- 是否改了设计方向:否。guard 遵循既有设计(#2155 补救通道、#1911 同空间纪律、#3004 墙钟上限),是新增守卫,不改架构 / 边界 / 数据流。
- 是否引入了新的配置:否。两个命名模块常量(
NET_PROGRESS_MARGIN_TOKENS=25_000、NET_PROGRESS_STRIKE_LIMIT=2),按设计不设 operator 旋钮(#2155 先例:guard 阈值是内部件);想要更懒节奏的 operator 已有compress.nudgeGrowthTokens。
判定:可合。无阻塞项,无顺手小修。
(ai: vllm-qwen/qwen3.8-27b) Re-resolved the merge conflict — master moved again since the last resolution. What happened. After the previous resolution (head The conflict. This time a single code conflict in
How I resolved it. Merged Local verification (before pushing). Push. Committed the merge as the final head Result. One note on the test matrix. The 中文八问
判定:冲突已解决, |
[ework] CI fix verified green ✓ |
…rt conflict master added responsesToCore to the acp-kernel/wire import; the PR adds countMessageTokens to the acp-kernel import (net-progress round check). Union of both, no behavior change. Also backfilled the PR's 4 det.net_progress* web-i18n keys into the ko locale (master added ko after this PR was written; #1024 catalog-parity test requires every key in every locale).
(ai: vllm-qwen/qwen3.8-27b) Third conflict pass done and pushed. What this pass had to deal with (master moved 126 commits since the Nov-27 sync, to
Local gates (targeted per test discipline): Note on the test matrix: the 中文八问
行为披露(old→new):ko 语言档此前没有 判定:冲突已清零、推送完成、本地门禁全过, |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
Re-review on new head 6ebe4a439 (merge of master into PR branch)
The new head is a merge commit resolving an import conflict in src/server/handle.ts and backfilling the PR's 4 det.net_progress* i18n keys into the ko locale (master added ko after this PR was written; the #1024 catalog-parity test requires every key in every locale).
Conflict resolution verified:
handle.tsimports: union of master'sresponsesToCore(acp-kernel/wire) + PR'scountMessageTokens(acp-kernel) — correct, no behavior change- ko i18n: 4
det.net_progress*keys added, matching zh-CN and en — correct
PR changes survived intact:
src/net-progress-guard.ts— unchangedtests/issue5058-net-progress-guard.test.ts— unchangedsrc/stream.ts:1870—recordNetProgressBaselinecall intactsrc/server/handle.ts:3683—evaluateNetProgressRoundcall intact- All 4 prepare lanes —
nudgeInjectionBlockedimport + usage intact src/web/sessions-data.ts—netProgressStateintactsrc/web/i18n.ts— all 3 locales (zh-CN, en, ko) carry the 4 keys
No new issues introduced by the merge. The src/stream.ts one-liner (removing clearCompressFailures in externalSummaryBreakerRefusal) is a master change, not PR-related.
Verdict: APPROVE — the merge is clean, the PR's net-progress guard is intact, and all prior review findings remain valid.
[bot] 🏷 Review complete on head Verdict: APPROVE — the merge is clean, all PR changes survived intact, no new issues introduced. Conflict resolution verified: Review posted: #5092 (review) 八问
判定:可合。 无 kernel/ 变更,无 config surface 变更,无 persistence/wire 变更。行为变更已披露:旧值 = nudge 永远继续;新值 = 2 轮连续非进展后暂停,真实缩减或 10 分钟到期后恢复。 |
[ework] CI fix verified green ✓ |
Closes #5058
What this fixes
Companion-style long sessions (hundreds of turns, days) hit a pure positive feedback loop in plugin mode: every nudge round ends in a successful compress whose own action cost (tool-call args incl. summary text, receipts, turn reasoning — all persisted by the host and re-sent next turn) outweighs what the fold removed. The kernel's baseline reset after each successful commit makes the next nudge due another flat 50K step later, and the action re-trips the growth gate — no convergence. In the reported session (0.1.208, dsh-native, deepseek-flash 750K window) that walked the host's local store to 30 MB / 24,051 events until dsh's pre-send overflow guard refused everything locally: no provider error, so no automatic recovery anywhere could fire, and the session was permanently bricked.
Every standing guard misses this shape by design:
How it works
New
src/net-progress-guard.tsadds the trajectory view:recordNetProgressBaseline,src/stream.ts): live-view token total + rendered post-fold estimate, both from the same kernel counter over the same request (postCtx≈0 的退化折叠会摧毁缓存前缀(shrink 287%/129%,cache ceiling ≥0%) #1911 same-space discipline). A new fold opens a fresh evidence window; strikes reset.evaluateNetProgressRound,src/server/handle.ts, inside the existing!selfHealRoundDone && prepared.nudge !== undefinedblock): the client's raw resend (countMessageTokensoverprepared.originalMessages) below pre-fold-level-minus-margin (NET_PROGRESS_MARGIN_TOKENS= 25_000, half the flat step — absorbs estimator noise and the one-round materialization lag where the post-compress re-request still carries the unfolded history, fix: net post-compress usage credit + hand launcher context windows to the proxy (#252) #252) counts as progress and resets; otherwise a strike.NET_PROGRESS_STRIKE_LIMIT= 2 consecutive non-progress rounds arms.nudgeInjectionBlocked(session)(the 会话卡死自愈机制:卡死模式检测与代理侧主动补救 #2155 predicate OR'd with this latch) at all four lane gates — the decide-ladder fallback punch-through is preserved (same dsh上下文700K不触发压缩 #3004 deadlock guard as D1). Latch state{ baseline, expectedFloor, strikes, armedAt }kept PROCESS-LOCAL in a WeakMap keyed by the session object — never persisted: persist serializes session.metadata into the state file, and this guard fires on every successful fold commit, so a persisted latch would drift the byte-for-byte storage goldens on every long session ([PR] Warn when the outbound bili tool set flips mid-session (#4789) #4790 precedent, same mechanism family). Wall expiry reusesSELF_HEAL_SUPPRESS_CAP_MS(10 min); any real reduction lifts it early; an evicted-and-reloaded session re-seeds silently (a fresh arm needs one more successful fold plus at most 2 non-progress rounds). Evaluate runs while suppressed so recovery can be observed./__bili/sessions(netProgress) + Web UI badge ("swelling"); arm/recovery/expiry log[net-progress]lines with the observed-vs-baseline numbers and rotate-to-fresh-session advice.Docs: CLIENTS.md (en+zh) dsh section documents the overflow-wall failure mode, the known refusal wording for host-side detection regexes, and the mitigations (rotation /
compress.nudgeGrowthTokens/ file-size watch / #5052 pointer); TECHNICAL-NOTES.md records the constants beside the #2155 section.Behavior change (old → new)
Sessions whose folds stop shrinking them now get their compression nudges PAUSED after two consecutive non-progress rounds (old: nudges continued forever, each compress enlarging the session further). The pause lifts on the first round that demonstrably reduces the context below pre-fold-level-minus-margin, or after 10 minutes wall-clock. Healthy sessions are unaffected: any fold buying back more than ~25K tokens of growth counts as progress immediately. This is a suppression (the decide ladder's fallback escape still punches through one legacy advisory), not a removal of the compression surface.
Config surface
None. Two named module constants by design (#2155 precedent: guard thresholds are internals, not operator knobs). Operators who want a lazier cadence for companion sessions already have
compress.nudgeGrowthTokens.Verification
tests/issue5058-net-progress-guard.test.ts(strike state machine, boundary, wall cap, fresh-window reset, corrupt-state tolerance, OR semantics vs the 会话卡死自愈机制:卡死模式检测与代理侧主动补救 #2155 latch) +tests/issue2155-self-heal.test.ts+tests/lane-decisions-matrix.test.ts+tests/web-i18n.test.ts— all green (123 tests); typecheck clean; build clean (dist-external OK). Full-suite verdict from CI on this head.Out of scope (tracked separately)
summaryMaxChars(behavior change vs the documented "pass summaryMaxChars to increase the limit") — decision item A in the issue thread.CI fix after first push (head b88abf4 was red)
The first commit stored the latch in
session.metadata, which persist serializes into the state file — every long-session storage golden drifted its persisted-state digest deterministically on all three CI platforms (six red test shards:storage-engine-proofsfull-mode restart x4 wires +golden-storage-renderx4 wires; master itself green). Follow-up commit3f4b7efe3keeps the state process-local (WeakMap keyed by the session object, #4790 precedent) and adds a regression pin assertingsession.metadatastays untouched across every mutation path. Behavior delta vs the first commit: the latch no longer survives a proxy restart (it self-expires within 10 min anyway), and the/__bili/sessionsnetProgressbadge shows live sessions only.