Skip to content

[PR] fix(diagnostics): report large histories without attributing stalls - #5481

Merged
ranxianglei merged 13 commits into
ranxianglei:masterfrom
Maziar123:fix/factual-request-cost
Nov 10, 2026
Merged

ranxianglei merged 13 commits into
ranxianglei:masterfrom
Maziar123:fix/factual-request-cost

Conversation

@Maziar123

@Maziar123 Maziar123 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The large-history warning fires on message count, not on measured starvation. It asserted event-loop causation and advised disruptive history/restart actions without that evidence.

Change

Move the existing logRequestCost owner to src/server/request-cost.ts and migrate callers without a server re-export. Report factual message counts, byte counts and measured local preparation time; remove unsupported stall attribution and restart/compression advice. The msgs>1000 predicate, warn severity, existing UTF8 byte accounting, WebSocket annotation and noteRequest observation are preserved, NOT newly repaired.

Verification

Candidate32b8bb71:4 existing focused runtime checks passed, plus TypeScript, unused-export and test-import-graph gates. Separate direct logger smoke observed one warning at1001 messages, none at1000, and3 bytes for a multibyte outbound character. Those smoke observations are not claims of new permanent boundary tests.

Limits

This does not explain or fix historical long stalls. No threshold tuning, kernel, schema, wire, configuration or recovery-policy change. Related closed#4528 supplies context, not an issue this PR claims to close.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

查重: 不重复。 open/closed issue 与近期 PR 中无同主题条目(按主题/失败签名检索: large-history 告警 / event-loop stall 归因 / logRequestCost);PR 引用的已关闭 #4528 仅作背景,本 PR 不声称关闭任何 issue。

标签: bug + scope/wiring + p3(缺陷类:诊断日志在无实测证据下断言「事件循环饥饿」并建议重启会话等有损操作;请求管道诊断面;影响仅日志措辞级,无功能破坏)

审核进行中(方向 → 回归清点 → 代码 → 测试有效性 → diff 整洁度)。CI 镜像缓存快照:static-gates / mysql-contract / lane-guard 全绿,test 分片大部分绿、个别分片仍在跑。结论稍后以八问体例回复。

@ranxianglei ranxianglei added bug Something isn't working p3 scope/wiring labels Nov 1, 2026
ci-check added 2 commits November 2, 2026 00:35
…ression (ranxianglei#5481)

The positive test only asserted warn-count and info-line content, so the
factual rewording — the entire point of the PR — had no regression pin:
reintroducing 'starving the event loop' attribution would pass CI.
Restore content assertions on the warn line (label, inbound=/local= fields)
and pin the explicit non-attribution clause.
…ouched (ranxianglei#5481)

Entry said 12 call sites were changed to import from the new module;
git grep shows exactly 10 logRequestCost call sites in handle.ts (unchanged),
and what moved was the single import statement.
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

审核结论:可合并(CI 在新 head 6ed0a2ef4 上:30 项检查 0 失败,仅剩 2 个 test 分片在跑,e2e 门控车道按惯例 skip)。

结构化八问

  1. 是什么问题:日志里的「慢会话」告警只凭「入站消息数 > 1000」一条触发条件,就断言「O(messages) 同步扫描正在饿死事件循环」,还建议用户「关闭/重启会话或开启压缩」。但同一行自己就印着实测的本地耗时毫秒——大历史请求热缓存下几十毫秒完成本地准备时,文案与同行数据直接自相矛盾,还会把用户引向有损的重启操作。
  2. 什么原因导致的:Long sessions starve the event loop: a 4,600-message session blocks the proxy and the web UI for 7–50 s per turn #4528 时代的遗留文案。当时长停顿现象未证实,因果归因被写进了告警正文;之后停顿的真实成因始终未查明,文案却原样留了下来——本质是「把推测写进了观测面」。
  3. 影响范围与严重程度:仅影响日志文本内容(grep slow-session 旧标签的人、读日志建议的用户);不影响功能、wire、会话状态。严重程度 = 误导性诊断/体验瑕疵(p3)。
  4. 怎么修复的:措辞改为只陈述实测事实(消息条数、入站字节、本地耗时 ms),并明说「本行只报条数,不把它归因为慢请求」;整个单元从 src/server.ts 抽到 src/server/request-cost.ts,handle.ts 改导入、server.ts 不再转出。触发条件(>1000)、warn 级别、UTF-8 字节统计、ws 标注、noteRequest 观测点逐字保留——我逐项对照 diff 验证属实。
  5. 是否有回归问题:未发现回归。审过的既有行为及结论:info 行格式与旧版逐字节一致 ✓;handle.ts 全部 10 处调用点的参数与顺序不变 ✓;noteRequest 仍对每个请求执行(不只 >1000)✓;谓词边界(严格 >1000)不变 ✓;import 移出后无循环依赖(attach-heartbeat 只依赖 logger,fetch-transport 只依赖 fetch-util)✓;全树 grep 无 slow-session 残留引用 ✓;master 领先的 28 个提交中仅 [Feature][experimental] After compression, relocate the compress call pair to its own fold point (weak-attention models | [Feature][experimental] After compression, relocate the compress call pair to its own fold point (weak-attention models | [Feature… #5470 触碰 src/server.ts(compress-settings 区域),与本 PR 删除区不重叠,GitHub mergeable=True ✓。有意行为变更(披露):日志标签 slow-session: → large-history:(输出格式变化,grep 旧标签的脚本/习惯会失配);warn 正文重写(即本 PR 目的)。
  6. 是否破坏缓存:不涉及——纯诊断日志路径,不触碰任何缓存、重试、增量游标或去重键。
  7. 是否改了设计方向:没有。纯模块抽取 + 措辞修正,无架构/边界/数据流变化。
  8. 是否引入新配置:没有。无新 env/config/默认值。

审核中发现的两处小问题(按「小问题直接修」已推为独立标注 commit):

  • e95c88c9a test: 原正向测试只断言「warn 出现一次 + info 行含 sess-big/1500 msgs」,把旧版钉住 warn 正文的断言丢了——新措辞(本 PR 的全部目的)因此没有回归钉:若有人把归因措辞改回去,CI 照样绿。已恢复 warn 行内容断言(large-history: 1500 msgs、inbound=、local=\d+ms)并额外钉住非归因条款 not evidence of event-loop starvation。新增的一行注释是刻意的:说明为什么钉这个具体字符串(承重回归守卫,与该文件既有 // #4528: 钉法一致)。
  • 6ed0a2ef4 docs: CHANGELOG 条目写「12 处调用改从新模块导入」,实际 handle.ts 只有 10 处调用且均未改动,移动的是 import 语句本身。已改准确。

验证:本地定向测试 4/4 绿(含新钉)、tsc --noEmit 干净;全量套件以远端 CI 为准(见开头 CI 快照)。PR 自述的边界观察(1001 条出警告、1000 条不出)仅为一次性 smoke、未做成永久测试——PR 正文对此诚实披露,且原测试本来也没钉边界,不构成回归。

收工判定:可合并,等剩余 2 个 test 分片转绿即可。

@Maziar123

Maziar123 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor Author

The remaining red shard matches the pre-existing intermittent failure tracked in #5523, rather than a request-cost regression:

This links the CI signal to the existing flake tracker; it is not a request to hide the failure or substitute a retry for fixing #5523.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

核实了你的归因,结论一致(既有间歇失败、非 request-cost 回归),但引用需要更正一处,且我顺手把分支基线同步了:

1. 引用更正:#5523 不是这个 flake 的跟踪条目——#5523 是已合并的「gate-local 断言证据改读 bili.log」PR(Closes #5520),与 PFA 断言无关。这个 flake 的真实档案在 tests/persist-metadata-fold-gate.test.ts:14-19 的文件头注释里:#5506 明确记录了「PFA stamp silently missing after restart」在生产与 CI 两种形态,后者就是 tests/issue2129-restart-measurement-state.test.ts:327 这条「load-dependent CI flake」。根因修复 = #5506(487daa26e,经 #5512 已落 master)。

2. 为什么这个分支还会踩中:本 PR 的分叉点早于 #5506——我验证了 487daa26e 在 master 上但不在 PR head 上。master 当前全绿(tip 3a2d051ec,#4599 最新哨兵确认),所以这不是继承红,而是「旧基线上根因修复缺失 + 负载依赖 flake」的组合。PR diff 本身零触碰 persist/restart/PFA 路径,你贴的 run 签名与文档记录逐字吻合。

3. 已做的动作(无决策依赖,直接修):把 origin/master(3a2d051ec)merge 进 PR 分支 → merge commit 2af70db07(干净合入,无冲突;同时清掉分支 BEHIND 状态)。合并树上本地验证:issue4528 定向测试 4/4、issue903-request-cost-log 1/1、persist-metadata-fold-gate(即 #5506 的回归钉)3/3,tsc --noEmit 干净,已 push。CI 在 2af70db07 上重跑中,以它为准。

4. 顺带审了你在我工作期间新推的 62ff052b6(measure the final forwarded request body):实现正确——logRequestCost 从转发前点位移到 forwardCaptured 内的 onWireBody 回调,计量的是兼容重写 + V1 封装后真正交给 fetch 的最终 body;测试用故意拉长的 role 重写名制造前后差异,并对上游实收字节做 formatBytes 精确匹配,是真回归钉(旧代码会挂)。三处移除的前置调用点与回调收敛点一一对应,10 条原有 cost line 路径无一丢失、无一重复。两处小披露(均诊断面):① outbound= 数值语义从「转发前 buffer」变为「实际 wire 字节」(V1 封装/role 重写场景下两者不同,这正是本次目的);② codexForge 本地伪造路径不再报 outbound 大小(没有交给 fetch 的 body,符合该字段「不转发则省略」的既有契约);另有一处可接受的观测边界变化——若 forward 内部在发请求前就失败,该请求不再有 cost line(旧代码在尝试前就记了)。formatBytes 改 export 是被 issue903 测试引用的,非死导出。你在 CHANGELOG 里把我那句「10 处调用本身未动」删掉是对的——调用点确实动了,条目现在的表述准确。

判定维持:可合并,等 2af70db07 的 CI 转绿即可。flake 本身的根治已在 master(#5506),本分支合入后即携带。

ci-check added 2 commits November 2, 2026 19:55
…nxianglei#5481)

Review nits on PR ranxianglei#5481: the msgs>1000 predicate is claimed preserved
verbatim, so pin both sides of the boundary (1000 -> no warn, 1001 ->
warn) plus the unknown-count passthrough lane (no warn, '? msgs'), which
the existing 1500/500 pair left untested.
)

The entry said all local-forge/side/fail-fast accounting boundaries are
unchanged, but the codex local-forged path now logs its cost line without
an outbound= field (nothing is handed to fetch there) — disclosed in the
PR thread but not in the changelog sentence. auto-mode forge, side and
fail-fast lines are byte-identical.

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

APPROVE — the change does exactly what it claims: the large-history advisory now reports measured facts only (message count / inbound bytes / local preparation ms), drops the unsupported event-loop-starvation attribution and the restart/compression advice, and the unit moves to src/server/request-cost.ts without a server re-export.

Independent verification (re-done for this review, not taken from the thread): every one of the 10 master call sites is accounted for — seven unchanged direct sites (passthrough, dsh-authored compaction, dsh refusal, auto-mode forge, two side-lane sites, fail-fast) plus the three pre-forward sites (codexForge, codex compact non-intercepted, main intercept) consolidated into the single callback-bearing forward() at handle.ts:2891. In-request re-sends (ws-byte-shed relay.ts:922, role-ladder hop :1036, image-count shed resend :1387, overflow refold resend :1443) each build their own init and call fetchWithTimeout directly, so the onWireBody callback fires at most once per client request — no duplicate cost lines. The mainSend guard refactor (relay.ts:733) is logically equivalent to the old inline condition. No kernel/, config-surface, wire, or persistence change; no stale slow-session / SLOW_SESSION_MSG_WARN references remain anywhere.

Tests carry teeth: the issue903 e2e asserts outbound= equals formatBytes(bytes actually received upstream) EXACTLY under a deliberately length-changing compat-role rewrite (a revert to pre-forward measurement fails), pins the full line shape by regex, and asserts exactly one cost line per request; the issue4528 suite now also pins both sides of the preserved msgs>1000 boundary and the unknown-count lane (added this review). Targeted suites pass locally (issue4528 7/7, issue903 e2e green) and tsc --noEmit is clean.

Disclosed behavior changes (diagnostic surface only, all intended): (1) slow-session -> large-history relabel + rewritten warn text — the purpose of the PR; (2) outbound= now measures the final wire body handed to fetch instead of the pre-forward buffer (differs under V1 wrap / compat-role rewrite / egress shed); (3) codex local-forge requests lose their outbound field (nothing is handed to fetch there); (4) requests that die inside forward() before the wire point (413 fuses, circuit-open fast-fail, client disconnect) no longer emit a cost line or the #5408 noteRequest tick — those paths answer locally and instantly, so no stall observation is lost.

已顺手修:threshold-boundary & unknown-count test pins (commit 411e5e1) + CHANGELOG local-forge accounting wording corrected to match the code (commit fe4ffdb) — pushed to this branch, test/docs only, no runtime change.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

review-worker-r1 独立复核完成(基线 head 2af70db,另推两个 review-nit commit),结论:可合并,APPROVE 已提交(GitHub review id 5736175065)。

审核独立性

未沿用前两轮结论,关键点全部重新验证:master 与 PR head 的 logRequestCost 调用点逐一核对(10 处 → 8 处直接点 + 1 个回调);forwardCaptured 内所有重发路径确认各自独立 fetch、不会二次触发回调(ws-byte-shed relay.ts:922 / role-ladder hop :1036 / image-count shed resend :1387 / overflow refold resend :1443);全仓 grep 无 forward/forwardCaptured 递归再入;autoModeForge(handle.ts:2123)、dsh-authored compaction(:2062)、dsh refusal(:2080)等本地应答路径自带直接记账点、不受影响;mainSend 守卫重构(relay.ts:733)与旧内联条件逻辑等价;全仓无 slow-session / SLOW_SESSION_MSG_WARN 残留引用。

结构化八问

  1. 是什么问题:slow-session 告警只在「入站消息数 >1000」时触发,正文却断言事件循环被 O(n) 同步扫描饿死,并建议关闭/重启会话或开启压缩——触发条件与断言之间没有证据链;实测大历史请求常常几十毫秒就完成本地准备,告警与同一行 local= 毫秒数自相矛盾,还会把用户引向有损操作。
  2. 什么原因导致的:Long sessions starve the event loop: a 4,600-message session blocks the proxy and the web UI for 7–50 s per turn #4528 时代把「历史大」当作「主线程卡死」的代理指标,文案写死了未经证实的因果归因。本 PR 不改机制只改陈述——措辞不再声称任何成因,从根上消除归因问题(疏而非堵:删掉的是产生误导的断言本身,不是过滤输出)。
  3. 影响范围与严重程度:纯诊断面——仅 bili 日志中这一行的标签/措辞/计量点变化,请求行为、压缩决策、缓存零影响。严重度:误导/体验瑕疵(p3,标签维持)。
  4. 怎么修复的:措辞改为纯事实报告(条数/字节/实测毫秒 + 明说「不把它归因为慢请求」);单元抽到 src/server/request-cost.ts 并去掉 server.ts 转出面;outbound 计量点移到 forwardCaptured 真正交给 fetch 的最终 body(兼容重写/V1 封装之后),字段名副其实。
  5. 是否有回归问题:既有行为逐项清点——msgs>1000 谓词、warn 级别、inbound/outbound/view 字段集、noteRequest([Bug][dsh][storage] Compression permanently fails for a session: frozen ingest watermark, requests no longer observed, and no warning until the host dies with CONTEXT_WINDOW_EXCEEDED #5408) 观测点、每请求恰一行成本行(passthrough/side/fail-fast/autoModeForge/codexForge/主管道各车道全覆盖)全部保持;有意变更均已披露(见下);未发现 fail-fast 变吞错、阈值漂移或输出格式意外变化。
  6. 是否破坏缓存:不涉及——wire 字节零变化,prefix cache/增量游标/去重键均未触碰。
  7. 是否改了设计方向:无架构转向;仅诊断模块归属微调(server.ts → server/request-cost.ts,reference/architecture.md 同步一行)。
  8. 是否引入新的配置:无新 env/config/默认值。

行为变更清单(旧值→新值,均有意):

  • 标签 slow-session: → large-history:,warn 正文重写(去归因、去重启建议)——本 PR 目的所在;
  • outbound= 计量点:转发前字符串 → 实际交给 fetch 的最终 wire 字节(V1 wrap/角色重写/egress shed 场景数值不同;issue903 e2e 用加长角色名 + formatBytes 精确匹配钉住);
  • codex 本地 forge 路径成本行不再携带 outbound= 字段(该路径没有交给 fetch 的 body;CHANGELOG 表述已顺手改对);
  • forward() 内部在 wire 之前就退出的请求(413 fuse / circuit-open fast-fail / 客户端断开)不再记成本行与 noteRequest——这些路径都立即本地应答、不产生 stall,观测损失为零。

测试有效性:真测试——warn 文案断言带牙(回归到旧文案即红);e2e 对上游实收字节做精确匹配而非容差比较;每请求行数断言(恰好 3 行)防双发。本轮补钉三例:阈值边界(1000 不告警 / 1001 告警)与未知条数(passthrough 车道不告警、info 行记 ? msgs)——原套件只有 1500/500 两个点,若有人把 > 改成 >= 会静默通过。本地定向跑过:issue4528 7/7、issue903 e2e 通过、tsc --noEmit 干净;全量以 CI 为准(本次新增两 commit 仅 test/docs,无运行时改动)。

已顺手修:① large-history 阈值边界与未知条数测试钉(commit 411e5e1);② CHANGELOG 本地 forge 记账表述改为与代码事实一致(commit fe4ffdb)。两者均 test/docs,已推本分支。

判定:可合并(APPROVE 已提交;PR 仍为 draft,转非 draft 后由 owner 合并)。
协调汇报:review-worker-r1 @ #5481 完成 —— APPROVE,2 个 review-nit 已就地修复合入分支(head fe4ffdb)。

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

APPROVE (re-review at new head fe4ffdb) — the increment over my full review at 2af70db is exactly the two review-nit commits pushed to this branch last round, nothing else: git diff 2af70db07..fe4ffdb0b = 2 files, +23/−1, zero runtime code.

  • 411e5e1 (test): pins both sides of the preserved msgs>1000 predicate (1000 → no warn, 1001 → warn) plus the unknown-count passthrough lane (no warn, "? msgs") in tests/issue4528-event-loop-yield.test.ts — closes the silent >→>= drift hole the old 1500/500 pair left open.
  • fe4ffdb (docs): CHANGELOG local-forge accounting sentence corrected to match the code (codexForge cost line no longer carries an outbound field; auto-mode forge/side/fail-fast byte-identical).

Both were written and locally verified by this reviewer (issue4528 suite 7/7, tsc --noEmit clean). Mirror-cache check states at fe4ffdb: 0 failed across all completed checks (9 success / 15 skipped, 6 test shards still finishing); the substantive end-to-end review of the PR content stands as posted at 2af70db (review id 5736175065 + the eight-question analysis in the thread).

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

review-worker-r1 第二轮复核完成(新 head fe4ffdb),结论:可合并,APPROVE 已对新 head 重新提交(GitHub review id 5736454077)。

本轮对象是上一轮推入分支的两个「已顺手修」commit(2af70db07 → fe4ffdb),增量范围独立验证:git diff 恰好 2 个文件 +23/−1,零运行时代码——411e5e181(test:钉住 msgs>1000 边界两侧 1000 不告警 / 1001 告警 + 未知条数车道不告警记 ? msgs)与 fe4ffdb(docs:CHANGELOG 本地 forge 记账表述改对)。PR 主体内容的全量审核维持上一轮结论不变(review id 5736175065 + 线程内八问分析)。

结构化八问(本轮增量)

  1. 是什么问题:无新问题——本轮确认的是上轮两个顺手修 commit 与 CI 在新 head 的状态。
  2. 什么原因导致的:不涉及(非缺陷修复)。
  3. 影响范围与严重程度:零运行时改动;测试仅在 issue4528 单元套件新增 3 例,CHANGELOG 改一行措辞;无外部行为影响。
  4. 怎么修复的:本轮无新修复(两处修复在上一轮完成并已在分支内)。
  5. 是否有回归问题:无——diff 精确核对为 2 文件、未触碰任何 src/;本地定向验证 issue4528 7/7 + tsc --noEmit 干净;镜像缓存 CI 状态 failed=0(9 success / 15 skipped,6 个测试分片收尾中,lane 判定 green)。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入新的配置:无。

判定:可合并(两轮 APPROVE 均有效,最新一条覆盖当前 head;PR 仍为 draft,转非 draft 后由 owner 合并)。
协调汇报:review-worker-r1 @ #5481 第二轮完成 —— 增量(2 个顺手修 commit)复核通过,APPROVE 重提至 fe4ffdb,CI failed=0。

@Maziar123
Maziar123 force-pushed the fix/factual-request-cost branch from 27e2110 to 4954a12 Compare November 6, 2026 10:32
ranxianglei#5481)

The merge of origin/master into the branch (4954a12) resolved the
CHANGELOG conflict with the pre-review wording of the ranxianglei#5481 entry,
silently dropping the correction from fe4ffdb: the codex local-forge
path logs its cost line WITHOUT an outbound field now (nothing is
handed to fetch there), so '本地 forge ... 既有记账边界不变' was
inaccurate for that path. Re-applies the corrected sentence verbatim.

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

APPROVE (round 3, merge head 4954a12) — this round's delta is the author's merge of origin/master (be611a8) into the branch; I audited the merge itself, not just the diff stat.

Merge integrity (verified per-file, hunk level):

  • Pure merge commit, no content commits; effective PR diff vs current master is still exactly the 8 files reviewed in rounds 1–2 (+ my two nit commits), no kernel/ in the PR's own contribution.
  • Tree intact: every file present; PR-only blobs byte-identical to the pre-merge head; master-only blobs byte-identical to master.
  • src/server/relay.ts, src/server.ts, reference/architecture.md, both test files, request-cost.ts: PR content lines identical across the merge.
  • src/server/handle.ts: correct three-way union — master's new 14th forward() arg (throttleModel, #5696) and the PR's cost callback coexist in the right order at the single converging call site; the ../server.js import keeps master's warnModelNameMissIfNew while staying without logRequestCost (now imported from ./request-cost.js). All 9 cost sites present with unchanged argument shapes.

One regression found and fixed on the spot: the merge's CHANGELOG conflict resolution silently reverted my fe4ffdb correction — the entry again claimed "本地 forge、side 与 fail-fast 的既有记账边界不变", which is wrong for the codex local-forge path (it logs its line WITHOUT an outbound field now). Re-applied the corrected sentence verbatim: commit 64b1bac (docs only, pushed to this branch).

Local verification at 4954a12: issue4528 + issue903 suites 8/8 (the e2e drives the full merged pipeline — fastpath GA included — and asserts outbound= against exact upstream-received bytes), tsc --noEmit clean. Mirror-cache checks at 4954a12: 0 failed (test matrix re-running after the docs commit).

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

review-worker-r1 第三轮复核完成(merge head 4954a12 = 作者把 origin/master be611a8 合入分支),结论:可合并,APPROVE 已提交(GitHub review id 5799491834)。本轮对象是 merge commit 本身,逐文件做了 hunk 级 union 审计:

  • 纯 merge commit、无内容提交;相对当前 master 的有效 PR diff 仍是第一/二轮审过的 8 个文件(含我两个 nit commit),PR 自身贡献不触碰 kernel/;
  • 树完整:所有文件在场,PR 独有文件 blob 与合并前逐字节一致,master 独有文件与 master 逐字节一致;
  • relay.ts / server.ts / architecture.md / 两个测试 / request-cost.ts:PR 内容行跨合并零变化;handle.ts 为正确三方 union——master 新增的第 14 个 forward() 参数(throttleModel,[PR] fix: isolate gateway model-scoped 429 holds #5696)与 PR 的成本回调按序共存于唯一收敛调用点,import 保留 master 的 warnModelNameMissIfNew 且不含 logRequestCost;9 个成本记账点全部在场、参数形状不变。

结构化八问(本轮增量)

  1. 是什么问题:无新缺陷——复核对象是作者合入 master 的 merge commit;审计中发现一处文档回归(见下)。
  2. 什么原因导致的:CHANGELOG 冲突解决时采用了 review 前的旧措辞,把我 fe4ffdb 的更正句丢了(「本地 forge…既有记账边界不变」对 codex 本地 forge 路径不准确——该路径现在不携带 outbound 字段)。
  3. 影响范围与严重程度:仅 CHANGELOG 一行措辞与代码事实不符,无运行时影响;已就地修复合回(commit 64b1bac,docs only)。
  4. 怎么修复的:把 fe4ffdb 的更正版句子逐字重新落回 CHANGELOG 条目尾部,diff 验证与 P1 版本逐字节一致。
  5. 是否有回归问题:代码面无——hunk 级审计确认 PR 全部改动在合并后原样存活且与 master 新增正确叠加;本地定向验证 issue4528+issue903 8/8(e2e 穿过合并后完整管道)、tsc --noEmit 干净;镜像缓存 CI failed=0(docs commit 后测试矩阵重跑中)。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及(master 侧的新特性属其各自 PR 的审核范围,不在本 PR 内重复审)。
  8. 是否引入新的配置:无。

已顺手修:merge 丢失的 CHANGELOG 本地 forge 记账措辞重新落位 + commit 64b1bac(docs only,已推本分支)。

判定:可合并(第三轮 APPROVE 覆盖当前 head;PR 仍为 draft,转非 draft 后由 owner 合并)。
协调汇报:review-worker-r1 @ #5481 第三轮完成 —— master 合并审计通过(PR hunk 全部存活、union 正确),发现并就地修复 1 处 CHANGELOG 措辞回归(64b1bac33),APPROVE。

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

APPROVE (round 4, head 64b1bac) — the increment over 4954a12 is exactly one CHANGELOG line: my round-3 re-application of the local-forge accounting wording that the master-merge conflict resolution had reverted (verified byte-identical to the fe4ffdb correction). Docs only, no code, no tests touched.

Full-suite CI is now settled and green at this head: 30/30 checks completed, 0 failed (14 success / 16 skipped) per the mirror cache. The substantive end-to-end review stands as posted in rounds 1–3 (reviews 5736175065 / 5736454077 / 5799491834); nothing in this increment changes any of those findings.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

review-worker-r1 第四轮复核完成(head 64b1bac),结论:可合并,APPROVE 已提交(GitHub review id 5799593846)。本轮增量就是上一轮我推入的 docs commit 本身:git diff 4954a1226..64b1bac33 = CHANGELOG.md 一行(把 master 合并冲突解决丢掉的本地 forge 记账措辞更正句重新落回,已验证与 fe4ffdb 更正版逐字节一致)。无代码、无测试改动。

结构化八问(本轮增量)

  1. 是什么问题:无新问题——确认第三轮就地修复的 docs commit 与新 head 的 CI 状态。
  2. 什么原因导致的:不涉及(非缺陷修复)。
  3. 影响范围与严重程度:零运行时改动,仅 CHANGELOG 一行措辞与代码事实对齐;无外部行为影响。
  4. 怎么修复的:本轮无新修复(该修复即本轮对象本身)。
  5. 是否有回归问题:无——diff 精确核对为单文件单行;全量 CI 在本 head 完全落定且绿:30/30 checks completed、0 failed(14 success / 16 skipped)。PR 主体结论维持前三轮审核不变。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入新的配置:无。

判定:可合并(四轮 APPROVE 均有效,最新一条覆盖当前 head 64b1bac 且 CI 全绿;PR 仍为 draft,转非 draft 后由 owner 合并)。
协调汇报:review-worker-r1 @ #5481 第四轮完成 —— docs-only 增量确认、CI 全绿(30/30,0 failed),APPROVE。

@Maziar123
Maziar123 marked this pull request as ready for review November 9, 2026 09:56
…lake (no code change)

CI job 129092915572 (test ubuntu-24 shard 1): 'proxy exited before becoming
healthy (dsh-main-4, code=1)' in tests/issue5631-restart-survival.test.ts —
the 4th proxy spawn crashed at boot; pi lane and all other 3553 tests passed.
Not reproducible on this head: 3 consecutive full local runs green
(d2ad8bf). PR diff is diagnostics-only (request-cost log move), untouched
by the failing path. Empty commit to re-trigger CI.
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

CI fix run complete — test (ubuntu-latest, 24, 1) was a transient startup flake, not a regression from this PR. Re-triggered via empty commit bef87a7c; the full re-run on the new head is green (all 14 workflows success, incl. the core CI matrix).

1. What was red? One check: test (ubuntu-latest, 24, 1) (job 129092915572) on head d2ad8bf4. Inside it, exactly one test failed out of 3563: tests/issue5631-restart-survival.test.ts → subtest "dsh lane (openai chat shape)" → proxy exited before becoming healthy (dsh-main-4, code=1, signal=null) — the 4th proxy spawn crashed at boot before serving /__bili/health. The pi lane subtest and all other tests passed.

2. Why did it fail? Startup crash of a spawned proxy under shared-runner load (most likely the probe-port→listen race in the test's probeFreePort, or a boot-time crash under contention) — a transient environment flake. Decisive counter-evidence against a PR regression: this PR's diff is diagnostics-only (logRequestCost moved from src/server.ts to src/server/request-cost.ts, call sites routed through a new onWireBody callback in forwardCaptured, softened slow-session warning wording). It touches no startup path, no dsh-lane code, and not the failing test file; master 406193b2 (fully contained in the PR head) was green on all recent runs.

3. What did I do? Verified live state (mirror cache + single API reads), pulled the job log, confirmed the single failing test, checked the PR diff vs master, then built the exact PR head locally and ran the targeted suite node --import tsx --test tests/issue5631-restart-survival.test.ts: 3 consecutive full runs, 3 pass / 0 fail each. Pushed one empty commit (bef87a7c, zero diff, message documents the flake) solely to re-trigger CI. No code changes.

4. Evidence it's resolved? New-head re-run: all 14 workflow runs completed success, including the core CI matrix that hosts the previously red shard. Local: 3/3 clean runs on the identical tree.

5. Regression risk from this run? None — the only push is an empty commit; working tree and diff vs master are byte-identical to d2ad8bf4.

6. Anything outstanding? Nothing blocking. Optional follow-up (not done here): harden the test's port allocation if this flake recurs (e.g., retry the spawn once on early exit) — I deliberately did not touch the test file since the cause isn't provable from the runner-side log alone.

7. Verdict. Red-CI blocker cleared: re-run green on bef87a7c. Merge blockers remaining for this PR are outside the CI lane (e.g. review/approval state), not checks.

@ranxianglei

Copy link
Copy Markdown
Owner

冲突

- src/server.ts / src/server/request-cost.ts: keep this PR's module
  extraction; port master's ranxianglei#5907 once-per-session slow-warn dedup
  (SLOW_SESSION_WARNED map + bound, est-tok field,
  _resetSlowSessionWarnedForTest) into request-cost.ts. The warn line
  composes both intents as pinned by the merged test suite in
  tests/issue4528-event-loop-yield.test.ts: factual non-attributing core
  (ranxianglei#5481) + size picture with the bili sessions rm cleanup command
  (ranxianglei#5907); restart/enabling-compression advice stays out.
- src/server/relay.ts: master's ranxianglei#5998 strict-thinking-posture strip runs
  BEFORE this PR's requestBody extraction, so onWireBody captures the
  bytes actually handed to fetch.
- src/server.ts imports: drop queryLogLines (no longer used on master)
  and noteRequest (moved with logRequestCost); keep configureLogRetention.
- CHANGELOG.md / reference/architecture.md: union of both sides' entries.
- Targeted local runs green: issue4528-event-loop-yield,
  issue903-request-cost-log, issue5998-unsigned-thinking-egress (25/25);
  typecheck clean.
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

Conflict resolved and pushed — PR head is now d271b14476 (merge of upstream/master 4446301708), live-verified mergeable: true, no longer dirty. Seven-question summary:

1. What was blocked. The PR branch conflicted with master, which moved 406193b → 4446301 (109 files) since the branch point. Five files conflicted: src/server.ts (×2 hunks), src/server/relay.ts, tests/issue4528-event-loop-yield.test.ts, CHANGELOG.md, reference/architecture.md.

2. Root cause. Two sides evolved the same slow-session-warning surface in different shapes: this PR extracted logRequestCost into src/server/request-cost.ts and rewrote the warn line to facts-only wording (#5481); master's #5907 evolved the same function in place (once-per-session dedup map, est-token field, bili sessions rm cleanup command). Adjacent collisions: master's #5998 thinking-posture strip landed at the same spot as this PR's requestBody extraction in forwardCaptured; both sides added entries at the same CHANGELOG/module-map positions.

3. Scope of impact. PR branch only; nothing merged to master by me. User-visible effect is confined to one log line's final wording (disclosed in Q6).

4. How it was fixed. Chose MERGE over rebase (branch already uses merge style; no force-push; contributor commits preserved). All resolutions are unions:

5. Regression checks. The merged test file tests/issue4528-event-loop-yield.test.ts pins both wordings (PR's non-attributing assertions at lines 73–75 AND master's #5907 assertions at lines 124–125), so picking either side verbatim would have broken the other side's merged regression pins — the composition below is the unique minimal implementation satisfying all 25 assertions. Local: typecheck clean; targeted runs green 25/25 (issue4528-event-loop-yield, issue903-request-cost-log, issue5998-unsigned-thinking-egress). Full-suite verdict is the CI test lanes on the pushed head — new runs were just triggered; the previous head (bef87a7c13) was fully green (30/30 checks).

6. Behavior change disclosure (intended). The slow-session warn line after this merge: old (master pre-merge) = fired every turn, attributed stalls to event-loop starvation, advised restart/compression; new = fires once per session per process (#5907), carries ~N est tok + bili sessions rm <id> cleanup command (#5907), keeps this PR's factual non-attributing core ("measured facts only … not evidence of event-loop starvation", #5481), and contains no restart/enabling-compression advice (#5481's explicit rationale). If you'd rather keep master's exact #5907 sentence verbatim, it's a one-line revert in src/server/request-cost.ts — say the word.

7. Remaining. Awaiting the fresh CI run on d271b14476 (mirror poller lags a few minutes). mergeable_state: blocked is the normal external-PR-awaiting-review state, not a blocker. No design decision needed this run — nothing escalated.

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

APPROVE (round 5, head 5f09d75) — the increment over the previously reviewed content is the author's second master merge (d271b14 ← master tip 4446301) plus my one-line docs commit below. I audited the merge as a three-way union against current master; the effective PR diff stays within the same 8-file scope, no kernel/ in the PR contribution.

Key point of this round: during conflict resolution the author folded master's own #5744/#5907 evolution of the slow-session advisory (wall-clock trigger ms > SLOW_SESSION_MS_WARN, once-per-session dedup map with 512 cap, est-tok, bili sessions rm hint) INTO the new module, while keeping this PR's de-attributed wording. Verified against master tip:

  • src/server.ts −56/+0: exactly the moved block (noteRequest/currentFetchTransport imports, formatBytes, constants, dedup map, reset helper, logRequestCost); nothing else removed.
  • src/server/request-cost.ts (+60): predicate / dedup / estTok / info line / noteRequest observation are content-equivalent to master's latest logic; only the warn wording changed (disclosed below).
  • handle.ts: import now from ./request-cost.js (master's warnModelNameMissIfNew retained); the 3 pre-forward call sites collapse into the single forward() callback placed after master's new throttleModel arg. Call-site parity vs master: master's 10 sites → head's 7 direct + 1 callback covering the 3 consolidated — every master cost-line path still emits exactly one line.
  • relay.ts: onWireBody param + codexForge fire + wire-point measurement + mainSend refactor — content lines identical to the version approved in earlier rounds; retry/resend paths use separate fetch calls, so onWireBody fires ≤1× per client request.
  • tests/issue4528-event-loop-yield.test.ts: correct union — master's yieldToEventLoop cases intact; guard cases pin the wall-clock trigger both ways (big-but-fast → silent, tiny-but-slow → warn, #5744) and carry teeth on the wording (/not evidence of event-loop starvation/, doesNotMatch /starving the event loop/, doesNotMatch /restart|enabling compression/), plus once-per-session + est-tok (~6525000 for 26.1MB) + sessions-rm pins. The old count-boundary cases were correctly superseded (that predicate no longer exists).
  • tests/issue903-request-cost-log.test.ts: exact formatBytes match vs upstream-received bytes with a compat role rewrite so wire ≠ pre-forward — pins the measurement-point move.
  • CHANGELOG entry factually consistent with the code; architecture.md module line accurate.

Behavior change vs current master (disclosed): the slow-session warn text drops the causal claim "synchronous per-turn work is starving the event loop (#4528/#5744)" and the "or enabling compression" advice; it now states "past the 1000ms wall-clock budget (#5744); measured facts only, cause not attributed — not evidence of event-loop starvation (#4528)" and keeps only bili sessions rm. Rationale: elapsed local time alone cannot establish event-loop starvation, and restart/compression advice without evidence pushes a lossy action — this PR's original purpose. No threshold, field, severity, or observation-point change vs master.

Note for the author (non-blocking): the PR body's Limits section still says "preserve msgs>1000 predicate / no threshold tuning" — true when written, but master's #5744 then moved the trigger to wall clock and this merge carries it; the effective diff vs today's master changes no threshold. Worth a body refresh before undrafting.

已顺手修:src/web/sessions-data.ts:41 stale pointer — the comment cited SLOW_SESSION_MSG_WARN in src/server.ts; both the name (SLOW_SESSION_MS_WARN, an ms budget since master's #5744) and the location (src/server/request-cost.ts, where this PR moves it) were wrong. Comment-only, commit 5f09d75.

Local at head: issue4528+issue903 9/9 pass, tsc --noEmit clean. CI on the author's merge head d271b14: 28/30 completed, 0 failed (2 tail shards still running at read time); the matrix on 5f09d75 is running with 0 failed so far.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

Round 5 review complete at head d271b14476 (author's second master merge ← 4446301) — APPROVE posted (GitHub review id 5831044565), verdict: mergeable. The head now includes my one-line docs commit 5f09d75e8a.

The interesting part of this round: master independently evolved the same advisory (#5744 wall-clock trigger replacing the msg-count predicate; #5907 once-per-session dedup + est-tok + bili sessions rm hint), and the author's conflict resolution folded that evolution INTO the new module while keeping this PR's de-attributed wording. I audited the three-way union file by file: server.ts deletion is exactly the moved block (−56/+0); request-cost.ts logic is content-equivalent to master's latest with only the warn wording changed; handle/relay content lines identical to previously approved versions with correct placement of master's new throttleModel arg beside the PR callback; call-site parity holds (master 10 sites = head 7 direct + 1 callback); the merged test file is a correct union whose wording pins have teeth (doesNotMatch /starving the event loop/, /restart|enabling compression/). Local: targeted tests 9/9, tsc clean. CI on the author's head settled 28/30 with 0 failed; matrix on my docs commit running, 0 failed so far.

One non-blocking note for the author: the PR body's Limits section ("preserve msgs>1000 predicate / no threshold tuning") is stale relative to today's master — #5744 moved the trigger to wall clock before this merge; worth a body refresh before undrafting.

结构化八问(本轮增量)

  1. 是什么问题:无新缺陷——本轮对象是作者第二次合入 master 的 merge commit;冲突解决把 master 自身的 0.1.212: per-turn ingest is still O(history) — 96.5% of proxy CPU in StatementSync.run, event loop starves with 8 concurrent sessions (#4528 / #5469 follow-up) #5744/The default modelContextLimit of 200000 underestimates the context window for custom provider routing, and over-window | modelContextLimit 缺省 200000 会把自定义 provider 路由的窗口算小,且超窗的「无归因」请求会被照发而不是本地拒绝 #5907 演进(墙钟触发、每会话一次去重、est-tok、sessions rm 提示)折进新模块,同时保留本 PR 的去归因措辞。
  2. 什么原因导致的:不涉及(审核对象为合并提交而非缺陷)。
  3. 影响范围与严重程度:相对当前 master 的行为面变化仅 slow-session 告警一句文案(去掉「starving the event loop」归因断言与「or enabling compression」建议,改为纯实测事实陈述);触发条件、字段、级别、观测点相对 master 零变化;无可用性影响。
  4. 怎么修复的:本轮无需新修复——审计确认三方 union 正确(server.ts 删除 = 被搬块逐字、handle/relay 内容行与此前批准版一致、测试文件为带牙齿措辞钉死的正确并集)。
  5. 是否有回归问题:未发现——成本记账点账目对齐(master 10 处 = head 7 直接 + 1 回调覆盖 3 处收敛)、onWireBody 每请求至多触发一次、本地定向测试 9/9 + tsc 干净、CI failed=0;唯一回归性发现(sessions-data.ts:41 注释指向已失效的常量名+位置,名称失效系 master 0.1.212: per-turn ingest is still O(history) — 96.5% of proxy CPU in StatementSync.run, event loop starves with 8 concurrent sessions (#4528 / #5469 follow-up) #5744 遗留、位置指针被本 PR 搬迁打破)已就地修复。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及(模块搬迁此前各轮已审;本轮语义增量仅告警文案)。
  8. 是否引入新的配置:无。

已顺手修:src/web/sessions-data.ts:41 陈旧注释指针(SLOW_SESSION_MSG_WARN@src/server.ts → SLOW_SESSION_MS_WARN@src/server/request-cost.ts)+ commit 5f09d75(comment-only)。

判定:可合并(第五轮 APPROVE 覆盖当前 head 5f09d75;PR 仍为 draft,转非 draft 后由 owner 合并)。
协调汇报:review-worker-r1 @ #5481 第五轮完成 —— master 二次合并审计通过(union 正确、记账点对齐),发现并就地修复 1 处陈旧注释指针(5f09d75e8a),APPROVE。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

APPROVE — sixth independent review, on head 5f09d75e8a (the docs-only comment fix pushed after my fifth-round approval landed on d271b14476, which made that approval stale).

Re-verified independently at this head (not carried over from earlier rounds):

  • Call-site parity: master had 10 direct logRequestCost sites; this head keeps 7 direct sites plus exactly one callback site (handle.ts:3148) wired into the single converging forward() call. The three removed direct sites (codex forge, codex compaction passthrough, main-pipeline pre-return) all funnel into that one forward, so every request path that logged before still logs exactly once. No double logging: no other forward() caller passes a callback.
  • onWireBody fires exactly once: referenced at exactly three places in relay.ts (declaration :346, codex-forge branch :353, main send :1000). Every retry/resend path (ws-byte-shed, role ladder, pck strip, v1 drop, count shed, overflow refold) rebuilds {...init, body: finalizeEgress(...)} without re-firing — the reported outbound is the first fetch body, the same property master's pre-forward measurement had.
  • Measurement point is correct: the #5998 thinking-posture strip mutates the wire body (relay.ts:979–993) before requestBody = v1Wrap(wireBody) (:994), so the cost line measures the exact bytes handed to fetch — post compat-role rewrite, post V1 wrap, post strip. The e2e test pins this with an exact formatBytes match against what the fake upstream actually received (a deliberately long role name makes pre-forward ≠ wire bytes).
  • mainSend refactor (relay.ts:1062): Prepared.session is a required field (server.ts:1923), so prepared !== null && prepared.session !== undefined && !prepared.sidePassthrough && method-check is logically identical to master's inline condition.
  • Disclosed observation-boundary change (unchanged from earlier rounds): requests that exit forward() before the fetch — client disconnect (:699/:1043), egress-window fuse / too-large (:882/:943/:956/:969) — lose their cost line and noteRequest versus master, which logged at prepare completion. All of those paths answer locally immediately (no stall possible); diagnostic-only loss, acceptable.
  • Incremental d271b14476..5f09d75e8a: exactly one file, one comment line (sessions-data.ts pointer to the renamed constant) — confirmed by diff, nothing else moved.
  • CI green on this head: all test shards (ubuntu/windows × node 22/24) + static gates pass, zero failures. Targeted suites (issue4528, issue903) and typecheck also pass locally.

Behavior changes vs master (all intentional, disclosed in CHANGELOG):

  1. Warn wording de-attributed: drops "starving the event loop" and "or enabling compression"; now states measured facts only ("not evidence of event-loop starvation (#4528)"). Pinned bidirectionally in tests.
  2. Outbound field now measures the final fetch body instead of the pre-forward prepared string (more accurate for compat/V1 lanes); the codex local-forge path logs without an outbound field (it never reaches fetch).
  3. Unit move src/server.ts → src/server/request-cost.ts, no server re-export.

No threshold, kernel, schema, wire, or config changes. No kernel/ touched.

One non-blocking author-facing note (already raised last round, repeated for the undraft checklist): the PR body's "Limits" section still describes the old msgs>1000 predicate — after the master merge the trigger is the wall-clock budget from #5744. Worth a one-line touch-up before undrafting.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

Review complete — APPROVE posted (GitHub review id 5831310797, head 5f09d75e8a).

This round exists because my fifth-round approval landed on d271b14476 and the follow-up docs commit 5f09d75e8a (stale-comment pointer fix) made it stale. The incremental diff d271b14476..5f09d75e8a is exactly one file / one comment line (src/web/sessions-data.ts pointing at the renamed constant's new home) — verified by diff, nothing else moved.

Independent re-verification at this head (fresh, not carried over from prior rounds):

  • Call-site parity: master's 10 direct logRequestCost sites = this head's 7 direct sites + exactly one callback site (handle.ts:3148) wired into the single converging forward() call; every request path that logged before still logs exactly once, and no other forward() caller passes a callback (no double logging).
  • Single fire of onWireBody: referenced only at relay.ts:346/353/1000; all retry/resend paths rebuild {...init, body: finalizeEgress(...)} without re-firing — reported outbound is the first fetch body (same property master's pre-forward measurement had).
  • Measurement point correct: Violates Anthropic's constraint that "preserved thinking must be replayed verbatim." | 违反了 Anthropic「preserved thinking 必须原样重放」的约束 #5998 thinking-posture strip runs before requestBody = v1Wrap(wireBody) (relay.ts:994), so outbound measures the exact bytes handed to fetch (post compat-role rewrite / V1 wrap / strip); the e2e test pins it with an exact formatBytes match against what the fake upstream received.
  • mainSend refactor (relay.ts:1062) is logically identical to master's inline condition — Prepared.session is required (server.ts:1923).
  • CI green on this head (mirror cache: 14 success / 16 skipped / 0 failed); targeted suites (issue4528, issue903) 9/9 pass locally; typecheck clean.

No small findings to fix this round — nothing left on the branch. One author-facing note repeated from round 5 for the undraft checklist (non-blocking): the PR body's "Limits" section still describes the old msgs>1000 predicate; since the master merge the trigger is the wall-clock budget from #5744. Worth a one-line touch-up before undrafting.

结构化八问:

  1. 是什么问题:PR 把每请求成本日志(logRequestCost)从 src/server.ts 拆到独立模块 src/server/request-cost.ts,并把慢会话警告文案从「归因于事件循环饥饿」改为只陈述实测事实;本轮审核对象是第五轮批准后补推的纯注释修正提交 5f09d75,它使原批准失效。
  2. 什么原因导致的:master 侧 0.1.212: per-turn ingest is still O(history) — 96.5% of proxy CPU in StatementSync.run, event loop starves with 8 concurrent sessions (#4528 / #5469 follow-up) #5744/The default modelContextLimit of 200000 underestimates the context window for custom provider routing, and over-window | modelContextLimit 缺省 200000 会把自定义 provider 路由的窗口算小,且超窗的「无归因」请求会被照发而不是本地拒绝 #5907 与本 PR 在同一函数上各自演进产生冲突,合并后常量改名+搬家,src/web/sessions-data.ts:41 的注释指针指向了已不存在的旧名/旧位置——纯文档失步,与行为无关。
  3. 影响范围与严重程度:本轮增量不影响任何运行时行为(一行注释);对用户的唯一可见变化是日志文案去归因化(有意变更,CHANGELOG 已披露)。无缺陷,属信息更诚实的体验层改进。
  4. 怎么修复的:本轮无需修复代码——增量提交本身即修复(注释改指 SLOW_SESSION_MS_WARN=1000ms @ src/server/request-cost.ts);主修复面(模块拆分+文案去归因+出站测量点前移)在前几轮已独立审过,本轮按新头重新复核。
  5. 是否有回归问题:逐路径清点过——master 的 10 个记账点在本头 = 7 直连点 + 1 回调点(handle.ts:3148),每条请求路径恰好记一行,无重复无遗漏;onWireBody 仅 relay.ts:346/353/1000 三处引用,重试/重发路径不二次触发;Violates Anthropic's constraint that "preserved thinking must be replayed verbatim." | 违反了 Anthropic「preserved thinking 必须原样重放」的约束 #5998 剥离先于出站测量,测的是真正交给 fetch 的字节。已知披露差异:fetch 前本地应答的路径(客户端断开 :699/:1043、egress 熔断/超限 :882/:943/:956/:969)不再产生 cost line 与 noteRequest(master 在 prepare 完成时就记了)——这些路径即时本地应答、不可能卡滞,属观测面收窄而非行为回归。
  6. 是否破坏缓存:不涉及。缓存/重试策略零改动,成本日志是纯观测旁路。
  7. 是否改了设计方向:不改方向——诊断单元从 4700 行的 server.ts 拆出属边界整理,数据流不变;文案去归因是措辞修正不是机制转向。
  8. 是否引入了新的配置:无新 env/config/默认值;SLOW_SESSION_MS_WARN=1000ms 沿用 master 0.1.212: per-turn ingest is still O(history) — 96.5% of proxy CPU in StatementSync.run, event loop starves with 8 concurrent sessions (#4528 / #5469 follow-up) #5744 既有值,未漂移。

判定:可合(APPROVED,等 owner 合并)。

协调汇报:review-worker-r1 @ #5481 第六轮完成 — head 5f09d75 独立复核通过,CI 全绿(14 success/0 failed),已发 GitHub APPROVE(review 5831310797),无待修小项,无决策升级。

@ranxianglei
ranxianglei merged commit a9ba419 into ranxianglei:master Nov 10, 2026
56 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.1138-master.a9ba419 (rolling master tag).

npm install -g billion-context@0.0.1138-master.a9ba419  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

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

Labels

bug Something isn't working p3 scope/wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants