Repository navigation
fix: fork 子会话 nudge 全盲死区 — 收据播种 sizing 基线(0.1.195 卡死复现) - #2936
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3280-pr.2936.248a91bThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2936.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 PR #2936 review 结论:可合(CI 绿后) 已拉取分支逐段审完代码,本地定向验证全过。以下按八问作答。 1. 是什么问题 2. 什么原因导致的 3. 影响范围与严重程度 4. 怎么修复的 5. 是否有回归问题
一处措辞精度说明(非阻塞):PR 正文说「每个 LLM 轮一行」,实际日志粒度是**每个 for-loop 轮次(round)**一行——单轮内可能含多次 LLM 调用(串行 walk 带减半重试,或一次 batch 调用覆盖多个 range)。观测目标(马拉松进行中可见)已达成,行内容报的是轮次状态,正是缺失的信息;不改。 6. 是否破坏缓存 7. 是否改了设计方向 8. 是否引入了新的配置 顺手小修(独立 commit):review 发现 CONFIGURATION.md 的英文警告没有同步到 收工判定:代码方向正确、根因修复打在产生盲区的位置而非症状层、测试有牙(红-绿已复验、lane 实证用校准 filler 确定性落在 [80%,98%]×窗口并断言 pre-fix 签名消失)、回归面清点无破坏。CI 转绿后可合。 |
…zone) A mid-history fork child starts on a fresh stats block: billing isolation deliberately skips the usage baseline, but nothing seeded localInputEstimate either, so effectiveTokenCount fed the kernel tokenCount 0 and every nudge trigger went dark on the child's first turn — exactly when the inherited context is at its fullest. A model switch onto a smaller window then overflowed every request into the preflight summarization marathon (0.1.195 field report: dsh fork at branch point 93, 671 msgs, 'nudge idle: usage=0% (0/936000)' with 929710 pending, 19 rounds per request, #568 early-SSE hold reads as a stuck conversation; identical second fork child 33 min later = deterministic). The receipt's own estimate describes the child's exact next outbound view: seeding it keeps the nudge live from turn 1. It errs early only (char-count upper bound), a real usage report takes precedence immediately (#728), and every prepare* overwrites it with the measured outbound per turn. The grandchild receipt covers fork-of-fork identically. Also: one info line per preflight LLM round (every 32nd digest round) so the marathon is observable while it runs — both field reports cut at the #568 hold line with zero round visibility; and a nudgeGrowthTokens doc warning to keep the step proportional to the smallest model window (a 1.5M step over a ~1M window makes the T1 mass trigger unreachable).
ccec401 to
0097033
Compare
[bot] 🏷 补:rebase 到最新 master + CI 全绿 review 期间 master 前进 4 个 commit(#2922 dsh no-ceiling budget,触碰 src/plugin.ts 的 新 head: CI:20/20 全绿(static-gates ×6、lane-guard、version-guard、kernel-guard、docs-sync、docs-coverage、config-surface-guard、lock-sync、unused-exports、pi-subagents-guard、build-artifact、dsh plugin lane fork-adoption suite、real-image billing e2e、test 矩阵 ubuntu/windows × node 22/24),PR 状态 收工判定不变:可合。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.327-master.da15214 # this exact build
npm install -g billion-context@master # always the newest merged build
|
复现(0.1.195 现场,确定性)
现场日志(同一父会话
session-c0ccf16d、同一 branch point 93、间隔 33 分钟的两个 fork 子会话,数字完全一致):用户视角:fork 选压缩过的分支 + 换模型 → 对话卡住、上下文显示 0、压缩块形状怪异(branch point 处的 crossing 块展开态 + preflight 反复部分折叠)。不换模型则一切正常(窗口装得下,不触发 preflight)。
根因(三因叠加,核心是 A)
A. mid-history fork 子会话的 nudge 死区(本 PR 修复) —
handlePluginFork(src/plugin.ts)给子会话建立全新 stats:计费隔离有意不继承 usage 基线(lastInputTokens/lastUsageGradeTokens不播种),但localInputEstimate也没人播种 →effectiveTokenCount的 #728 兜底链路返回 0 → kerneldecideNudge拿到tokenCount=0:usage 恒 0%、growth 恒 0、first-sight mass 需 usage ≥ 45% —— 所有触发线结构性失明,恰发生在继承上下文最满的时刻。nudge 状态本身也只在全前缀 fork 时继承(prefix.length === snapshot.orderedMessages.length)。B. 固定步长放大(文档修复) — 现场
nudgeGrowthTokens: 1500000> 窗口 936k:T1 质量触发线在窗口内永远够不着。内核默认 50k 不会踩这个坑,但文档从没警告过步长必须与窗口成比例。C. 无过程可见性(日志修复) — 19 轮 LLM 总结 × 每轮一次上游往返(分钟级),期间只有 #568 一行 hold 提示,轮次全程静默;两份现场日志都断在 #568 行,无法判断最终收敛与否。
修复
recordContextObservation(est, "estimate")之后补一行child.stats.localInputEstimate = child.stats.contextTokens:收据自己的估计恰好描述子会话下一次出站的准确视图,播种它让 nudge 从第 1 轮就活着。只可能偏早(字符上界),真实 usage 报文立刻接管([Bug] 上游从不报告 usage 时 nudge 永不触发——上下文无界增长直到超窗(ChatGPT 登录态后端) #728 不变量),每次 prepare* 都会用实测出站覆盖。孙会话(fork 的 fork)走同一条收据路径,同样覆盖。round N/M: payload ~X tok vs window W (deficit D), K viable range(s),马拉松进行中可观测。nudgeGrowthTokens增加与最小窗口成比例的警告(步长 > 窗口 → T1 质量触发不可达 → 增量折叠静默、超窗请求直坠 preflight 马拉松)。测试(tests/fork-nudge-deadzone.test.ts,3 个,红-绿已验证)
localInputEstimate === contextTokens(141768);计费隔离保留(lastInputTokens===0、source≠usage);effectiveTokenCount>0且落入 ≥75% 压力带;kernelprocessTurn(放宽 preserveRecent 与 harness 同参)→nudge.shouldInject为真,reason 命中 OVER-LIMIT/EMERGENCYcalibrateRepeats()二分校准 filler 使收据估计与入站载荷都落 [80%,98%]×窗口 30000(避开 preflight 触发),真实 wire 请求换小窗模型(small-test)→ 200,bili.log 子会话 nudge 行不含usage=0% (0/(修复前该行正是现场签名),且无preflight compressing before forward修复前红:seed undefined / 死区行
usage=0% (0/30000) ... reason="growth 0 < floor 22500";修复后绿:usage=30% (9088/30000)。回归
tsc --noEmitclean设计边界(有意不动)
statusInputBaseline仍走 usage-grade(Status readers still trust estimate-grade failure baselines after #1846 #2029 pin 的"estimate 无锚点 → 状态面 0 = by design"),本修复只喂 nudge 判定的 [Bug] 上游从不报告 usage 时 nudge 永不触发——上下文无界增长直到超窗(ChatGPT 登录态后端) #728 兜底。