Skip to content

[PR] fix(preflight): retain recovery receipt across interrupted retries - #5100

Closed
abworks-dev wants to merge 2 commits into
ranxianglei:masterfrom
abworks-dev:2026-10-29_preflight-abort-recovery
Closed

abworks-dev wants to merge 2 commits into
ranxianglei:masterfrom
abworks-dev:2026-10-29_preflight-abort-recovery

Conversation

@abworks-dev

Copy link
Copy Markdown
Contributor

Closes #5098

Version-first scope

The incident was investigated on published 0.1.208. This source fix targets current master 6b298c37b079ef063b7ff704814d12e97bbaf945, package/npm latest 0.1.209. Current source already contains compressed-body decoding, so this PR does NOT resubmit the zstd fork-adoption fix. It also does not replace closed #2928 or attempt all of broader #3978.

Failure and correction

An estimate-only evidence return can be taken again after an interrupted request because there is no spent-probe receipt. An interrupted over-window walk can retain completed compression blocks without retaining its obligation to re-check the rebuilt outgoing context. The existing completed-413 localRefusals ledger does not cover every such interruption.

Config surface / boundaries

None: no config/env/CLI fields, dependency changes, package version bump, kernel or pi-subagents changes. Only src/server.ts and one new targeted regression file change. No changes to message identity, signature handling, compression carriers or installed profiles. Both plugin and plain proxy modes are covered.

Validation on final source

Run with XDG_CONFIG_HOME, XDG_STATE_HOME and XDG_CACHE_HOME set to disposable per-run directories so existing server fixtures cannot write the developer's daily affinity/session-order caches.

node --import tsx --test --test-concurrency=1 tests/preflight-recovery-receipt.test.ts tests/issue1800-image-arbitration-compress.test.ts tests/issue4185-identified-fresh-forward.test.ts tests/preflight-client-abort.test.ts tests/issue3846-local-refusal-evidence.test.ts tests/issue4288-preflight-stale-baseline-fit-exit.test.ts tests/issue1933-preflight-calibration.test.ts tests/preflight-fail-fast.test.ts tests/preflight-fork-estimate.test.ts
  • PASS on the final staged source in one isolated serial run: 64 tests, 0 failures, 0 skips. The 21 new receipt cases include interrupted/reloaded probes, before-await receipt ordering, plugin/proxy summary retention, stale projected messages versus actual outgoing bodies, grey-zone anonymous upper-bound fit, scope changes, cancellation/rebase and first-arbitration controls.
  • PASS: npm run typecheck, npm run build, git diff --check.
  • Three initial minimal regressions were red on the pinned baseline before the fix. Tests use real gate/core/session code and disposable loopback summary endpoints, not a live provider or account. Metadata JSON roundtrips are not a claim of fsync/crash-durability acceptance.
  • Full-suite verdict remains the upstream CI lanes. Gated real Codex lifecycle / original installed-session recovery was not run, and must not be inferred from the hermetic tests.

Triage: theme D (timeouts/retries/degradation), cross-lane request pipeline; requested labels p1 and scope/wiring (no single-client lane). Label application requires maintainer permissions. No merging, publishing or daily service restart is requested.

@ranxianglei ranxianglei changed the title fix(preflight): retain recovery receipt across interrupted retries [PR] fix(preflight): retain recovery receipt across interrupted retries Oct 29, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] (ai: vllm-qwen/qwen3.8-27b) 进度同步:进程被强制重启后我已恢复。核查结果——工作树是干净的,上一段会话没有留下任何已提交/已推送的改动(无丢失的阶段性成果)。卡住的根因是拉取 PR head 时走 GitHub 代理的 git fetch 无超时挂死。我现在改用本地镜像 + 带硬超时的方式取 PR diff,继续按八问做审核,随后给出完整结论。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

PR 审核完成(独立读过 diff 与既有行为,不是照抄 issue 结论)。先澄清编号:镜像里的 #5101 对应 GitHub 真实 PR #5100(abworks-dev,base = master 6b298c3,2 文件 +392/-23);GitHub 上 pulls/5101 不存在(那是个无关 bug),别按 5101 去找。

查重:不重复。它补的是「中断的越窗 walk 没有 spent-probe/恢复回执」这个空档——现有 completed-413 本地拒绝账本(#3846/#4079)只覆盖「已拿到 413」,覆盖不到「请求被中断后重试又重走 estimate-only 逃逸」的路径;也和已关的 #2928、更大的 #3978 不是一回事(OP 已声明不重提 zstd fork-adoption、不吞并 #3978)。方向正确,打在根因上。

八问

  1. 是什么问题:会话出站上下文已超窗、正在压缩重建时,如果这次请求被中断(客户端 abort / relay 挂),下次重试会把「试一次看上游接不接受」的证据探测再走一遍——没有记录“我已探过/我欠一次复查”,于是反复 doomed 转发、上下文/成本失控。
  2. 什么原因导致:缺一张作用域精确到「归一化 origin + model + window」的 JSON 安全回执(spent-probe / pending-recovery)。completed-413 有账本兜底,中断路径却没有对应收据,重试无从判断该不该再放开这些一次性逃逸。
  3. 影响范围/严重程度:触发 = 超窗负载 + 请求被中断后重试(匿名或已校准会话都可能)。p1:重复 doomed 转发持续放大上下文与成本,headless 宿主还会读到可重试状态空转,属「上下文只增不减失控」一类。
  4. 怎么修的(机制层):加三枚小工具 preflightRecoveryFor/notePreflightRecovery/clearPreflightRecovery,回执写进 session.metadata(复用现有 markDirty 持久化,不加新存储)。关键:在第一次越窗 summary/重建 await 之前就落 pending 回执,estimate-only 返回前落 spent 回执;重试若 pending/spent 就关掉所有「试一次」逃逸(probe/image-arbitration/post-fold/doomed-probe),改用现有重建路径判真实出站体;能装下的活体重建才清回执;取消保持权威(绝不转发、保留已完成摘要、必要时重新密封);确定性 413 交还带 TTL 的拒绝账本(保 [Bug][preflight] Local 413 is forgotten when the baseline becomes an estimate, reopening oversized probes #3846/Context Window Overflow Issue Summary: Raw Requests Sent Directly to Upstream Rejected + Local Intercept Cooldown Lockin | 上下文超窗问题汇总:请求裸冲上游被拒 + 本地拦截冷却锁死会话(统一分析入口) #4079 语义,不做永久锁)。
  5. 是否有回归:触碰路径逐项过了一遍,没破坏既有正确行为。有 4 处判定口径变化,全是「更保守或更准」方向,逐条见下;无 spurious 永久锁(回执在 装下/scope 变化/确定性413 三种情况都会清,非确定性耗尽保持 pending 但 retryable 且自收敛)。wire 形状/消息身份/签名/摘要载体/config schema/持久化版本/kernel 全没动,纯新增一个 metadata 字段。
  6. 是否破坏缓存:不破坏缓存机制本身。回执是每会话 metadata,不进 wire;fit 口径变化只改「何时折叠/何时 fail-fast」,不改任一给定出站体的前缀稳定性。
  7. 是否改设计方向:没转向。plugin/proxy 两模式都覆盖,载体不变,只是加了作用域回执这层防护。
  8. 是否引入新配置:无。没有新 env/config/CLI,无依赖变化,没动 kernel 与 pi-subagents,没 bump 版本。

行为变更披露(旧→新 + 原因)

  • A. 匿名会话(lastInputTokens≤0)的 payloadFitsWindow:旧用 calibratedPayload<limit(≈裸乐观估算),新用保守 upperBound<limit。更严、更贴 fork 会话 lastInputTokens=0 时 preflight 退化为字符估算,大载荷被低估后不压缩直接裸转上游 #553「不信本地估算」;已知基线会话取值不变。
  • B. 折叠后 & 未折叠路径的 fit 度量:旧用 estimateCoreMessages(数组)+原始 body 开销(+imageTokens),新用 outboundContextEstimates(真实出站 body)——量真正要发出去的体(含自身 wire 开销与重算图片预留),更准。
  • C. ⚠️ 最需再看一眼:已知基线的未折叠路径现在套用 k̂ 校准系数(旧是裸估算)。这是把未折叠路径对齐到早已校准的折叠路径,方向是「信学到的尺度」;k̂ 夹在 [0.25,4] 且按 origin+model 门控,风险有限,但它确实让「装不装得下」的判定可能双向移动,建议 owner 复核这条。
  • D. 匿名会话折叠后的 fit:旧用内核循环内部的 result.fitsWindow,新用显式 upperBound<limit。有意为之(fork 会话 lastInputTokens=0 时 preflight 退化为字符估算,大载荷被低估后不压缩直接裸转上游 #553 保守上界)。

测试有效性:真函数直驱(非 mock 内部)、loopback 摘要端点、JSON roundtrip 模拟重载、res.destroy()/emit('close') 模拟中断、断言上游调用次数——对「重试又重探」这个 bug 有牙,plugin/proxy 双模式、scope 变化、灰区取消、校准跨 scope 都钉住。诚实披露:store 关了盘持久化,所以没断 fsync/崩溃持久性(作者已明说)。

diff 整洁度:2 文件、聚焦、每行都在题内,新测试组织清晰,无空白 churn/无关文件/锁文件连带。代码整洁硬标准(外部提交从严)也过:命名达意、helper 在各逃逸门复用不重复、无死代码、无魔法数(复用 DOOMED_PROBE_* 常量)、注释讲为什么、风格一致、无新依赖。两处无害微瑕:notePreflightRecovery 恒置 probeUsed=true(名字兼作「回执激活」略过载);growthArmed 分支里 && !recoveryPending 被 payloadFitsWindow 蕴含(冗余但防御性)。均不构成质量门槛,不另开返工。

CI(合并前必须处理):head b8ab7ea 上 36 绿 / 16 skip(门控 e2e,正常)/ 3 红;静态门、各守卫(gate/kernel-guard/version-guard/lane-guard/config-surface-guard/lock-sync…)、build、mysql-contract 全绿。3 红是测试分片:ubuntu-22-s3、ubuntu-24-s3、windows-22-s1(check-runs payload 未带日志细节)。注意模式:ubuntu 两个 node 版本都是 s3 红、其余分片全绿——更像确定性失败而非随机 flake;若其中含新加的 preflight-recovery-receipt.test.ts,优先看它的中断/断网模拟在 CI runner 上的时序。处置:按 #4599 查 master 红绿——master 也红=继承红,git merge origin/ci-fixes 进 PR 分支即收敛;master 绿=本 PR 引入,须修掉。红了不合。

标签:本环境 Gitea shim 未实现 label 接口(endpoint not implemented),我打不上去;建议 owner 打 p1 + scope/wiring + bug(跨车道请求管道,无单一客户端标签)。

结论:代码层面可合——机制打在根因、回归逐项过干净、测试有牙、diff 整洁、无 config/kernel/版本变动(故按 §7.4 保持人工合并不自动合)。唯一卡点是那 3 个红测试分片:先按上面 #4599 流程判清是继承红还是本 PR 引入,转绿后再由 owner 合并。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

CI 已修复并转绿。作为 ci-worker 我独立读了 diff、逐路径追了代码(不是照抄 issue 或前一轮审核的结论):这 3 个红分片是本 PR 引入的确定性回归,不是 flake——master 6b298c3 全绿(#4599 floor 449),三个平台同一断言同一点挂。已在 PR 分支直接补一个 additve commit 修掉:7ed532f(作者归属不变)。新 head 上 55 项 check 全部终态:39 绿 + 16 门控 skip + 0 红,此前红的 u22s3 / u24s3 / w22s1 三个分片均 success。

八问

  1. 是什么问题:PR 新加的「恢复回执」机制上线后,既有 e2e 测试 e2e #488-A/#496 变红——图片为主的负载第一次靠「转发一次让上游裁决」成功通过(上游实际只计了 3000 token,窗口是 10k)之后,同一会话的下一个正常轮次反而被 bili 本地判成 413。
  2. 什么原因导致:转发前写入的 spent-probe 回执只有三个清除条件(scope 变化 / 装得下的活体重建 / 确定性 413 移交拒绝账本),唯独漏了「探测成功、usage 证据已落地」这一种——回执对该 origin+model+window 作用域永久保持 spent,下一轮 evidenceProbeAvailable=false 把所有 forward-once 逃逸全关 → 无可折叠内容 → 确定性 413。一句话:「forward once」退化成了「每个作用域一辈子只许一次」,破坏了 PR #489 后续: 默认图片计费 b64/4 在像素 tile 计费上游(官方 Anthropic/OpenAI)会硬 502 误杀多模态会话 #496/多模态会话上下文控制失效 + preflight 救援 502(codex responses store:false) #488-A 钉住的稳态契约(多模态会话必须能持续工作)。
  3. 影响范围与严重程度:触发条件 = 会话曾走 estimate-only / 图片仲裁逃逸后在同一 scope 继续正常使用(典型多模态场景)。严重度高:不修的话这类会话从第二轮起被永久 413,且 413 还会写进拒绝账本把整个 scope 锁死。仅在本 PR 合入后出现,master 无此问题。
  4. 怎么修复的:在回执自身的设计词汇内补第四个清除条件「解除(discharge)」——写入回执时记下当时的 usage-grade 基线(新增 seenUsage 字段);此后一旦落地一份与基线不同的 proven usage 报告(即上游已经回答了探测想问的问题),立即清除回执、允许下一次越窗轮次重新仲裁。相同负载重发计费相同 → 看不到变化 → 保持关闭,[Bug] Interrupted preflight can reopen estimate-only evidence probes without a durable recovery receipt #5098 要防的中断重试语义原样保留;早于该字段存在的旧持久化回执保守地维持原行为。改动仅 src/server.ts +19/-2。
  5. 是否有回归问题:逐项过过——(a) PR 自带的 preflight-recovery-receipt.test.ts 21 例全过(其 fixture 全是 estimate-grade 基线,不会触发解除,[Bug] Interrupted preflight can reopen estimate-only evidence probes without a durable recovery receipt #5098 的「中断重试不再重探」保证未动);(b) 含 fix-488 / issue1800 / issue3846 / preflight-client-abort / issue1933 等在内的 10 个定向文件本地 71/71 通过;(c) 权威判定 = 新 head CI 55 项 0 红;(d) 前一轮审核披露的行为变更 A–D 口径未被本 commit 触碰,wire 形状/消息身份/签名/config schema/持久化版本/kernel 均无变化。
  6. 是否破坏缓存:不破坏。回执是会话内 metadata,不进 wire;解除逻辑只决定「下次是否允许重新仲裁」,不影响任何给定出站体的前缀稳定性。
  7. 是否改了设计方向:没有转向。仍是同一个回执机制(一个 JSON-safe metadata 字段 + 复用 markDirty 持久化),只是把生命周期从「三清除」补成「四清除」。
  8. 是否引入新的配置:无。没有新 env/config/CLI,无依赖变化,无版本 bump。

行为变更披露(E,旧→新 + 原因):spent-probe 回执生命周期——旧:仅 scope 变化 / fitting rebuild / 确定性 413 移交时清除(spent 即终身);新:追加「落地的 proven usage 报告与花费时基线不同」时也清除。原因:探测的目的(#2313/#496)本就是取 usage 证据,证据到了还永久封死会把合法的多模态连续对话锁进 413。方向上只重新开放 master 本来就有、且被测试钉住的那条逃逸,没有创造任何新的转发路径。

收工判定:CI 全绿,代码层面维持可合结论;按 §7.4 触及请求管道语义,仍属人工合并范围,合并与否留给 owner。

@ranxianglei

Copy link
Copy Markdown
Owner

(ai: vllm-qwen/qwen3.8-27b)

Merged current master (6db5906) into this branch — clean, no conflicts (merge commit cfaa4e8). Local typecheck + build + all 64 preflight recovery-receipt tests pass on the merged head; the PR is no longer behind master and CI is now queued/running.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) ci-engineer-r1 · PR #5100 冲突处理:本地 rebase 已完成,卡在 1 个需 owner 拍板的设计点(未推送)

结论先行:这个 dirty 不是普通漂移——master 在本 PR 之后被重写/rebase过,导致直接 merge 会爆成 166 文件冲突。我把 PR 的真实增量(其实只有 2 个 commit)rebase 到当前 master,只产生 2 处 hunk 冲突、已按正交并集忠实合并;typecheck/build 全绿,PR 的 9 个定向 preflight 测试 65 条里 64 过 1 挂。那 1 条失败是 master 新增的 measured-body 硬门 × PR 旧预期 的行为冲突,属设计取舍,超出我"小机械修复"的权限,所以停在决策点、先不猜着推红分支。

一、是什么问题 / 为什么 dirty

二、怎么处理的(本地,尚未推送)

三、影响范围与严重程度

  • 影响面:preflight p1 热路径的一个具体场景——匿名(unknown-baseline)超窗、折叠后仍超窗时的处置。非全局。
  • 严重程度:当前是"PR 无法合入(dirty)"卡住一个已审过的 bugfix,不是线上故障。

四、唯一残留红项 + 根因

  • 用例:tests/preflight-recovery-receipt.test.ts:215「a fresh post-fold arbitration remains available once…」——断言首个匿名超窗请求应 forward-once("evidence bet"),实际返回 fail-fast 413。
  • 证据:我用临时诊断脚本复现,首请求命中 master 的 measured-body doom:outbound body measures ~7,021 TEXT tokens even after preflight compression … vs the model window 6,000 … NOT forwarded。grep 证实该措辞在纯 master(dc041dd1)出现 2 次、在 PR 的 base(491ac1ded)仅 1 次 → master 在 491ac1d→dc041dd1 之间新增/收紧了这条 post-fold measured-body 硬门(side request(max_tokens<=200)绕过 preflight 且不检查载荷体积,携带全量历史直转上游导致 400 #554 guard meter 家族)。我的 2 处合并忠实保留了双方代码(typecheck+64/65 佐证),失败源于 master 新硬门 × PR 旧预期,不是我能靠重排 hunk 修掉的。

五、🔶 需要决策:"匿名超窗且折叠后仍超窗的请求"到底该 forward-once 还是 fail-fast?这是行为取舍,且会牵动 receipt 落账语义(measured-doom 是否写/spend receipt),不是改一行断言能收口。

选项 做法 各选项回归风险
A(推荐) 以 master 现有行为为准:确定性超窗不烧 forward-once,更新该用例预期为 fail-fast 并让 receipt 正确落账 低——master 硬门更新更刻意,另 64 条定向用例全绿,仅这一条预期过期
B 保留 PR forward-once:给 master measured-body doom 对"新鲜探针可用"的匿名请求开洞 高——削弱 guaranteed-400 保护,可能重引 #5885「日志说已转发实则没有」类问题
C 交回作者 abworks-dev 自行把 receipt 特性对齐到当前 master 硬化 中——最稳但依赖作者活跃

默认(owner 不表态时):A。

六、回归审查(我合并触碰的既有行为)

七、收工判定 / 下一步

  • 本地 rebase 已完成并通过 typecheck/build/64-of-65,随时可 force-with-lease 推送(会用 <ref>:9f6a7870 原子防覆盖并发)。
  • 我暂未推送:残留红项属设计决策(不宜擅自猜行为推红分支),且本会话连续两次被强制重启、网络推送正是高风险操作,先停下汇报。
  • 请 owner 拍板 A/B/C。拍板后下一轮:按所选方向处理该用例→定向复跑→force-push→报 CI 结论。
  • (needs-decision 标签:本工作区没有 tools/add-label.sh,暂未能自动补打,请 owner 加一下或下一轮我再走镜像 API。)

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) ci-engineer-r1 · 状态收口(承接上一条详细分析)

已完成:把 PR #5100 的真实增量(其实只有 2 个 commit:b8ab7eaff9+7ed532f496)rebase 到当前 master dc041dd1,得到干净线性分支(本地 pr5100-resync-test:dc041dd1→a98e5ddbc4→8457d0ee6b)。两处 hunk 冲突按正交并集忠实合并(master 的 #5000 maxMessages 计数门+measured-body doom 原样保留;PR 的 receipt 逻辑拼入),作者署名保留。

已验证:typecheck ✅、build ✅、PR 的 9 个定向 preflight 测试 64/65 通过。

残留 / 风险:唯一红项 tests/preflight-recovery-receipt.test.ts:215——首个匿名(unknown-baseline)超窗请求现在 fail-fast 413,而用例期望 forward-once("evidence bet")。根因是 master 在 491ac1ded→dc041dd1 之间新增/收紧了 post-fold measured-body 硬门(#554 guard meter 家族),和 PR 旧预期相撞(有 grep+复现证据,非我合并引入)。风险:擅自猜着改断言推红分支,可能把 p1 热路径行为改错。

卡点(需决策):这是设计取舍——匿名超窗且折叠后仍超窗的请求到底该 forward-once 还是 fail-fast,且牵动 receipt 落账语义,超出我"小机械修复"权限。请拍板 A/B/C:A(推荐,以 master 现有行为为准、更新该用例预期并让 receipt 正确落账)/B(给 PR forward-once 对新鲜探针开洞,回归风险高)/C(交回作者 abworks-dev 自行对齐)。不表态时默认 A。

下一步:你拍板后我下一轮按方向处理该用例→定向复跑→force-with-lease 推送→报 CI 结论。当前分支未推送(dirty 仍在,但真实改动已在本地备好)。
(needs-decision 标签:本工作区既无 tools/add-label.sh 也无镜像 labels API,暂打不上,麻烦你手动加一下。)

@ranxianglei
ranxianglei force-pushed the 2026-10-29_preflight-abort-recovery branch from 9f6a787 to 8457d0e Compare November 11, 2026 21:18
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) ci-engineer-r1 · PR #5100 冲突已解决并推送(dirty→behind),剩 1 个需决策的红项

本次核心进展:把 PR 从「无法合入(dirty)」推进到「无冲突、可自动更新(behind)」。已推送。

一、是什么问题:PR #5100 因 base 冲突处于 mergeable_state=dirty(无法合并),卡住一个已审过的 bugfix;另有一个残留测试红项。

二、什么原因:① dirty——master 在本 PR 之后被重写/rebase,PR 分支 round-4 合入的旧 base 491ac1ded 已脱离 master 谱系,naive merge 会爆成 166 文件冲突(多为孤儿旧-master 谱系噪音)。② 残留红项——master 在 491ac1ded→dc041dd1 之间新增/收紧了 post-fold measured-body 硬门(#554 guard meter 家族),与 PR 旧预期相撞。

三、影响范围与严重程度:dirty 属"PR 合不了"的阻塞,非线上故障;红项只影响"匿名超窗且折叠后仍超窗"这一具体场景。

四、怎么修的(本次已执行并推送):

五、live CI(镜像缓存,本 run 实读):当前 3 failed / 11 success / 16 skipped / 0 pending;3 个失败全是 test shard-1(ubuntu-22 / ubuntu-24 / windows-22)。诚实说明:我推送才几秒且 0 pending,这份快照大概率是上一次已完成运行的结果,全新全量跑需几分钟才会刷出 pending→结论;失败签名(单一 shard-1 测试文件)与我本地定位的那条一致。

六、回归审查:合并保留双方代码原语义(typecheck/build/64-of-65 佐证),未改动任何既有行为、缓存/重试/游标/去重键、或配置项。

七、🔶 需要决策 + 下一步:

  • 唯一残留红项 tests/preflight-recovery-receipt.test.ts:215(首个匿名超窗请求:现 fail-fast 413,用例期望 forward-once)属设计取舍,超出小机械修复权限。请拍板 A/B/C:A(推荐,以 master 现有行为为准、更新该用例预期并让 receipt 正确落账)/B(给 PR forward-once 开洞,回归风险高)/C(交回作者)。默认 A。
  • 我此前说"拍板后再推",现修正:git 层冲突解决已完整且与 A/B/C 行为选择无关,先推它清掉 dirty 阻塞并不预判 A/B/C(那条红项无论选哪个都保持红,等你定夺后再处理)。若你更希望我把推送也压到决策后,说一声即可回滚(分支本地留有 8457d0ee6b,可一键还原 9f6a7870)。
  • 你拍板后下一轮:按方向处理该用例→定向复跑→等 CI 全绿→报最终结论。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🔶 需要决策 (ai: vllm-qwen/qwen3.8-27b)

本轮 live 核实(不凭记忆)

  • 冲突已解决并推送:当前 head = 8457d0ee6b(PR 的 2 个 commit 忠实 rebase 到 dc041dd1),GitHub 侧 mergeable_state 已从 dirty → behind(冲突消除,现在只是落后于当前 master)。
  • 当前 master = 259cd876,CI 绿(success)。所以这次红不是 master 继承性失败,而是 PR 的 preflight 行为变更 与 master 当前加固门控的冲突。

CI 红诊断(6 红 = 2 个测试族,同一个根因) — 取自 live CI 日志

八问

  1. 是什么问题:PR 的 preflight「forward-once / recovery receipt」行为与 master 当前「measured-body fail-fast」门控冲突,导致 2 个测试族红。
  2. 什么原因导致的:PR 引入的 fit 判定改动(超窗且无可压缩时 forward-once)+ recovery receipt 机制,撞上 master 后来加固的 side request(max_tokens<=200)绕过 preflight 且不检查载荷体积,携带全量历史直转上游导致 400 #554 measured-body doom(超窗直接 413)。master 绿、PR 红 ⇒ 是 PR 行为变更引入,非 master 回归。
  3. 影响范围与严重程度:仅「略超窗 + 无可压缩范围 + 新鲜/匿名基线」这一类 preflight 场景;2 个测试族。属行为语义冲突,非崩溃/数据丢失。
  4. 怎么修复的(本轮):本轮只做冲突 rebase + 诊断,未改 PR 逻辑——因为修它 = 设计决策,超出 auto-fix 车道的小机械修复。冲突已解(dirty→behind)。
  5. 是否有回归问题:PR 相对其原 base 是忠实的(typecheck + 定向 64/65 通过证明 rebase 无损);红是 PR 行为 vs master 门控的既有冲突,非我 rebase 引入的新回归。
  6. 是否破坏缓存:不涉及(冲突在 preflight 转发/失败判定,不动缓存/重试/去重键)。
  7. 是否改了设计方向:未改。要修必须先定方向(见下 A/B/C)。
  8. 是否引入了新的配置:无。

🔶 需要决策(选项 + 推荐 + 默认)

我已停手(不循环):待决策,不再改这个 PR 的代码;已打 needs-decision 标签。决策后:若 A → 更新两个测试 + 同步到当前 master(259cd876)+ 重跑 CI。

注:此环境 tsx 未安装,我本地无法独立复现;以上诊断基于 live CI 日志(权威)。

@ranxianglei
ranxianglei force-pushed the 2026-10-29_preflight-abort-recovery branch from 8457d0e to 346d387 Compare November 13, 2026 03:34
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

本轮摘要(七问) — 冲突已解决并推送,PR 不再 dirty;剩余红 = 待决策。

1. 是什么问题
本轮系统转发报告 PR 与 base 分支冲突(merge state: dirty)。LIVE 查证:master 已从我的上次 rebase 基线(dc041dd1)前进到 243709b(+138 提交),其中 src/server.ts 的 preflight 区域又改了一处(图片 token 在 fold 后重测的细化,+26/-13),导致我的 head(8457d0ee6b)与新 master 再次冲突。

2. 本轮做了什么
把 PR 的真实 2 个提交(recovery-receipt 跨重试保留 + spent-probe 一次性 discharge)rebase 到当前 master 243709b,解决 src/server.ts 的 4 处冲突,--force-with-lease 推送(已确认无并发推送者)。

3. 怎么解决的
4 处冲突都是「master 的图片 token 细化」与「本 PR 的 recovery-receipt / fit 判定重构」在同一区域的正交叠加,全部按正交并集处理:保留 master 的 rebuiltImageTokens/reducedImageWire/imageArbitrationAfterFold(fold 后重测图片),同时保留本 PR 的 outboundContextEstimates(text/upperBound)+ recoveryPending/evidenceProbeAvailable 守卫。两者在图片测量上等价(outboundContextEstimates 内部就是调 imageReserveFor),无行为冲突。

4. 验证

5. 剩余阻塞(待决策,非本轮能修)
CI 上会红的仍是同一个设计张力的 2 个用例:

6. 当前状态(LIVE 查证)

  • GitHub API:head.sha=346d387,base.sha=243709b,mergeable_state dirty → blocked(mergeable=True)→ 冲突已解决,blocked 只是分支保护(等 CI 绿 + 审批)。
  • 镜像缓存此刻:30 check,0 failed / 0 pending(11 success + 19 skipped)。注意:新 head 刚 push,完整 test 分片大概率还在跑,我不据此断言绿;已知会红的就是第 5 点的 2 个待决策用例。

7. 下一步
冲突这条已闭环(dirty→blocked)。剩下的红只取决于 owner 的 A/B/C 决策——拍板后我按所选方案改 2 个测试(A)或改 preflight 逻辑(B),再推一次即可。needs-decision 标签已挂,本轮到此停手,不空转等。

(如需回滚:本地分支保留 346d387,可恢复上一版 8457d0e。)

abworks-dev and others added 2 commits November 13, 2026 14:28
… lands

A recovery receipt written before an image-arbitration or estimate-only
evidence forward stayed spent for the whole origin+model+window scope even
after the forward completed and the upstream reported real usage — so the
very next over-window turn found every forward-once escape closed and
failed fast with 413 although the upstream had just proven it bills the
payload under the window (regression pinned by tests/fix-488-multimodal.test.ts
"e2e ranxianglei#488-A/ranxianglei#496", red on three CI shards).

A spent probe exists only while its question is unanswered: its purpose
(ranxianglei#2313/ranxianglei#496) was to acquire upstream usage evidence. Stamp the spend-time
usage baseline into the receipt (seenUsage); when a proven usage report
different from that baseline lands, discharge the receipt so the next
over-window turn arbitrates afresh (ranxianglei#488-A steady state). An identical
resend bills identically, sees no change, and stays closed (ranxianglei#5098's
interrupted-retry guarantee holds); receipts predating the field keep
their conservative closure.
@ranxianglei
ranxianglei force-pushed the 2026-10-29_preflight-abort-recovery branch from 346d387 to 95f6e75 Compare November 13, 2026 06:59
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] PR #5100 已重新同步到最新 master + 决策请求 (A/B/C)

本轮进展 (11-13)

  • master 又前进: 243709bef2 → fcc2e84848 (9 commits, 全部 PR [PR] feat: BILI_PLUGIN_BYPASS operator override for the x-bili-plugin-bypass passthrough (#6220) #6360 BILI_PLUGIN_BYPASS, 不触碰 src/server.ts 或 PR 的测试文件 → 正交, 无冲突)。
  • 已把 PR 的 2 个 commit (b9760651af receipt body + 346d387365 discharge) cherry-pick 到 fcc2e84848, 干净无冲突, 新 head 95f6e754d3, 已 force-push 到 abworks-dev:2026-10-29_preflight-abort-recovery。
  • 本地验证: typecheck 干净; 定向测试 (PR 9 文件 + issue5631) 67/68 通过。
  • 唯一红: tests/preflight-recovery-receipt.test.ts:215 (已知待决策测试)。
  • issue5631-restart-survival 已绿 — master 自身提交 a223959a50 ("test(5631): bill the fake upstream at token scale with a disjoint anthropic cache partition") 修复了它, 不再是 PR 引入的回归。

决策请求 (A/B/C) — 已挂 needs-decision 2 天, owner 未拍板

PR 的 forward-once/receipt 车道与 master 已合入的 measured-body fail-fast 门 (#554/#5000/#4543/#5885) 语义冲突: 对匿名超窗且折叠后仍超窗的 fresh 请求, PR 期望 forward-once 收证据, master 现在 fail-fast 413。

八问

  1. 是什么问题: PR 的 preflight abort-recovery 对匿名 fresh 超窗请求的 forward-once 期望, 与 master 当前 fail-fast 行为矛盾 (1 个测试断言红)。
  2. 什么原因导致的: PR 基于旧 master 编写 (当时 doom 门对 fresh-anonymous 更宽松); master 后续合入 side request(max_tokens<=200)绕过 preflight 且不检查载荷体积,携带全量历史直转上游导致 400 #554/[Bug][dsh][0.1.208] Kill switch / egress fuse only measures message.text: a session with 26,903 messages and only 1.44 M | [Bug][dsh][0.1.208] 判死/egress fuse 只量 message.text:26,903 条消息、core text 仅 1.44 MiB 的会话绕过 fuse 发出 55.2 MiB 请求体,被上游 413 拒收(ModelArts.… #5000/[Bug] CJK payloads slip past the egress byte-floor fuse: a 4.1 MiB outbound was forwarded at 1,121,674 tok into a 1,000,000-token window (0.1.206, plugin lane) #4543/[Bug][dsh] Rewind (fork+seed) leaves non-monotonic refs: preflight folds only ~5k tokens/round, so 31 rounds (649 s) cannot close a 283k deficit — and the "NOT forwarded" payload is sent anyway #5885 加固了该门。rebase 后 PR 的测试期望过期。
  3. 影响范围与严重程度: 仅测试期望层面 (1 个断言), 非运行时行为 — PR 的 receipt 机制对已识别/授权请求仍成立。严重程度: 体验瑕疵 (PR 无法合入, 但 master 行为本身正确且已测试钉住)。
  4. 怎么修复的: 待 owner 拍板。推荐 A: 采用 master fail-fast, 更新该测试期望为 413 + 调整 receipt 记账。
  5. 是否有回归问题: A 无回归 (master 已如此行为); B 有回归风险 (削弱 master hardened gate)。
  6. 是否破坏缓存: 不涉及 (preflight 门在缓存之前)。
  7. 是否改了设计方向: A 不改 (master fail-fast 是既定方向, PR 适配); B 改 (为 fresh-anonymous 开洞)。
  8. 是否引入了新的配置: 不涉及。

选项对比

选项 内容 行为变更 回归风险 代价
A (推荐) 采用 master fail-fast, 更新测试期望为 413 + 调整 receipt 记账 匿名 fresh 超窗请求: forward-once → 413 低 (master 已如此行为且测试钉住) 小 (1 个测试断言 + 记账)
B master doom 门为 fresh-anonymous-probe 开豁免 master doom 门开洞 高 (#5631 等已依赖 fail-fast) 中 (改 master 门)
C 退回作者 abworks-dev 无 无 PR 停滞, 作者可能不活跃

推荐 A。master 的 fail-fast 是较新的、有意的、测试钉住的行为; PR 的测试期望相对旧 master 已过期。rebase 语义 = PR 适配 master 当前行为。

等 owner 拍板 (A/B/C)。拍板后我立即执行:

  • A: 改测试期望 + receipt 记账, 推新 head (预计 1 个 commit)。
  • B: 在 master doom 门开 fresh-anonymous 豁免 (需另评估回归)。
  • C: 在 PR 留评论退回作者。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

🔶 需要决策

本轮 (auto-fix lane) 已重新核实 live 状态 — 3 个红 shard 全部失败在同一测试, 属设计决策 (非机械小修), 按 lane 规则停手等 owner 拍板。

Live 核实 (本 run, 非记忆):

选项 + 推荐 + 默认:

为何推荐 A: master 的 fail-fast 是较新的、有意的、测试钉住的行为; PR 的测试期望相对旧 master 已过期。rebase 语义 = PR 适配 master 当前行为。

needs-decision 标签已挂。停手等 owner 拍板 (A/B/C), 拍板后立即执行 (A = 1 个 commit 改测试期望 + 记账)。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 进程被强制重启后恢复 (35 分钟无输出) — 重新核实 live 状态, 仍卡在 A/B/C 决策

发生了什么: 上一轮处理 auto-fix lane 时被 force-stop, 之后 35 分钟无输出被强制重启。本轮所有网络操作都加了严格 timeout, 已避开导致卡住的操作。

Live 核实 (本 run, 非记忆, 全部 timeout-bounded):

  • head 95f6e754d3 (未变)
  • CI: 30 checks, 3 failed / 0 pending — 3 个红 shard (test ubuntu-24-1 / ubuntu-22-1 / windows-22-3) 仍全部失败在同一测试 tests/preflight-recovery-receipt.test.ts:215
  • PR 现在 "behind" master: master 从 fcc2e84848 前进到 99c22d283f (6 个 commit, 全部 docs/announcements/notices: announcement policy / notice scan gate / retract announcement), 不触碰 PR 文件 (src/server.ts / tests/preflight-recovery-receipt.test.ts) → 干净 rebase, 无冲突
  • issue5631-restart-survival 仍绿 (master 自身 a223959a50 修复)

状态: 这是 floor 60 已请求的同一 A/B/C 决策 (🔶 需要决策, needs-decision 标签已挂), owner 尚未拍板。红测试是设计决策 (非机械小修), 按 auto-fix lane 规则停手。

为何现在不单独 re-sync: PR 因红 CI + 待决策本就无法合入, 单独 re-sync 只会多跑一轮 CI (30 checks), 而 master 仍在快速移动 (1.5h 又 6 commit), "behind" 会再次出现。等 owner 拍板后, 我会在一次 push 里同时完成 re-sync 到最新 master + A/B/C 修复, 避免冗余 CI。

选项 (重申, 等 owner 拍板):

  • A (推荐, 默认): 采用 master fail-fast — 更新该测试期望为 413 + 调整 receipt 记账。回归风险低 (master 已如此行为且测试钉住)。
  • B: master doom 门为 fresh-anonymous-probe 开豁免。回归风险高 (削弱 master hardened gate)。
  • C: 退回作者 abworks-dev。无行为变更, 但 PR 停滞。

请 owner 拍板 (A/B/C)。拍板后我立即执行 (re-sync + 修复一次 push, 全程 timeout-bounded)。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 🔶 需要决策

背景:PR #5100(mirror #5101)与 master 冲突(merge state: dirty)。我尝试 cherry-pick PR 的 2 个 commit(d6cd8b8aef + 95f6e75)到当前 master(0a133d91463),在 src/server.ts 遇到 6 个冲突块(行 4251, 4333, 4413, 4794, 5011, 5125)。

关键发现:这 6 个冲突不是简单的正交合并,而是两种竞争设计对同一个 preflight-abort 问题的处理:

  • Master(HEAD 侧):一次性折叠门(one-shot fold gate),基于计数器——session.stats.preflightRuns > 0 = preflightSpent;compressionCount > 0 = compressionCommitted;如果已花费,直接转发(forward as-is)。定义在 master src/server.ts:4246-4251、:4735、:2287。
  • PR(d6cd8b8aef 侧):基于收据的恢复逻辑(receipt-based recovery)——preflightRecoveryFor/notePreflightRecovery/clearPreflightRecovery 函数(在合并后的 src/server.ts:3539/3552/3557,干净添加在冲突外);recoveryPending/evidenceProbeAvailable/calibratedHere 变量。

决定性发现(git show 0a133d91463:src/server.ts):master 没有恢复收据函数(grep 未找到 preflightRecoveryFor/notePreflightRecovery/clearPreflightRecovery/PreflightRecoveryRecord);master 有一次性折叠门;master 没有 tests/preflight-recovery-receipt.test.ts(该文件是 PR 新增的)。所以 PR 引入了收据机制;master 独立添加了基于计数器的门来处理同一个「不要重新折叠已中断/已花费的会话」问题。

结论:正确解决这 6 个冲突 = 在两种竞争设计之间做选择(计数器门 vs 收据)= 正是自 floor 60(14 天前)以来悬而未决的 A/B/C 设计决策。这不是 auto-fix lane 授权的小机械修复——选错设计会改变 preflight 的恢复语义。

选项:

  • A(推荐):采用 master 的一次性折叠门,丢弃 PR 的收据逻辑。理由:master 的一次性折叠门(preflightRuns 计数器)已经处理了 PR 收据逻辑要修复的「中断后不重折」场景,且 master 已上线 967 个 commit 的稳定行为。
  • B:保留两者(正交合并)。理由:master 的一次性折叠门和 PR 的收据逻辑是互补的(计数器管「是否已花费」,收据管「恢复义务」)。风险:两套机制交互复杂,需大量测试验证。
  • C:交还给作者(abworks-dev)。理由:合并太复杂,超出 auto-fix lane 的范围,需要原作者理解其收据设计意图后与 master 的一次性折叠门做整合。

推荐:A。
默认(未决定时):A。

已中止 cherry-pick(git cherry-pick --abort, exit=0)。工作树干净在 pr5100-resync-2026-11-27 @ 0a133d91463。

需要 owner 决策:请 owner 决定 A/B/C。决策后,我将按决定重新合并 PR 并推送(final head push,不带 [ework:ci-held])。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 七问摘要(本轮 auto-fix 尝试 1/6,duplicate wake m00228)

  1. 是什么问题:PR [PR] fix(preflight): retain recovery receipt across interrupted retries #5100(mirror [Bug] emergencyTruncateLatch uses a shared BLOCKED key, causing cross-message interleaved writes of tool parameters/rece | [Bug] emergencyTruncateLatch 使用共享 BLOCKED 键,跨消息串写工具参数/回执并使上下文暴增 #5101)与 master 冲突(merge state: dirty)。master 自 11-13 以来推进了 967 个 commit(99c22d283f → 0a133d9),PR 的 2 个 commit(d6cd8b8aef + 95f6e75)需要 rebase 到当前 master。

  2. 什么原因导致的:master 和 PR 在 src/server.ts 的 preflight 区域独立演进——master 添加了一次性折叠门(one-shot fold gate,基于 preflightRuns 计数器),PR 添加了基于收据的恢复逻辑(receipt-based recovery,基于 preflightRecoveryFor/notePreflightRecovery/clearPreflightRecovery 函数)。两者解决同一个「不要重新折叠已中断/已花费的会话」问题,但用了不同的机制,导致 6 个冲突块。

  3. 影响范围与严重程度:PR 无法合并(dirty),CI test shards 被跳过(0 failed / 0 pending,全部 skipped)。影响:PR 的 preflight-abort-recovery 修复无法上线。严重程度:PR 阻塞(非生产事故)。

  4. 怎么处理的:尝试 cherry-pick PR 的 2 个 commit 到当前 master(0a133d91463),在 src/server.ts 遇到 6 个冲突块(行 4251, 4333, 4413, 4794, 5011, 5125)。分析发现这 6 个冲突是两种竞争设计的合并(master 计数器门 vs PR 收据逻辑),不是简单的正交合并。正确解决需要选择一种设计(或整合两者),这是 A/B/C 设计决策(自 floor 60 悬而未决 14 天)。已中止 cherry-pick(git cherry-pick --abort, exit=0),工作树干净。

  5. 是否有回归问题:未推送任何 commit(cherry-pick 已中止),无回归风险。

  6. 是否破坏缓存:不涉及(未修改任何代码)。

  7. 是否改了设计方向:未改。但合并需要 owner 决策(A/B/C),决策后才能确定设计方向。

状态:等待 owner A/B/C 决策。决策后,我将按决定重新合并 PR 并推送(final head push,不带 [ework:ci-held])。

标签:needs-decision + pr(已确认,id=82 + id=1)。

Live 核实(本 run,非记忆):

  • head 95f6e754d3(未变)
  • master 0a133d91463(967 commits past 99c22d283f)
  • mergeable_state: dirty
  • CI: 30 checks, 0 failed / 0 pending(test shards 全部 skipped,因 PR dirty)
  • 无 owner 拍板(floors 69-71 全是 system 评论)

@abworks-dev

Copy link
Copy Markdown
Contributor Author

Closing as superseded by the one-shot fold gate (#7545) and the forward-first policy (#7537).

The premise of this PR — refuse locally on a size estimate and return failFast, plus a durable recovery receipt so an interrupted estimate-only probe is not reopened — no longer matches master:

The mechanism is therefore superseded rather than mergeable. #5098's concern is covered on master. Thanks for the analysis and the tests — they read as a clear record of the tension. Closing.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Interrupted preflight can reopen estimate-only evidence probes without a durable recovery receipt

2 participants