Skip to content

test(codex): 慢 thread/read 兜底标题用例放大预算,name/set 不再被 200ms RPC 超时掐断 - #2525

Merged
deepcoldy merged 2 commits into
masterfrom
test/codex-thread-name-rpc-budget
Oct 29, 2026
Merged

deepcoldy merged 2 commits into
masterfrom
test/codex-thread-name-rpc-budget

Conversation

@deepcoldy

@deepcoldy deepcoldy commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

修 #2454 中出事的那条用例;#2454 里建议的接口拆分是生产改动,本 PR 不包含,见下文「未处理」。

现象

PR #2523 head d82fe074f 首跑 run 40891465999 / bun-test:

error: Codex app-server thread/name/set timed out after 200ms
(fail) setCodexAppThreadName > still writes the fallback title when a slow thread/read exhausts the preview wait budget [458.88ms]

与 #2454 记录的第一次(run 40554189061)同形。

根因

setCodexAppThreadName 的 timeoutMs 同时是 preview 等待预算和之后每个 RPC(thread/name/set、校验用的 thread/read)的超时。这条用例只让第一次 preview 读慢 300ms(假服务器只延迟 name/set 之前的第一次读),用 timeoutMs: 200 让 preview 等待耗尽。但同一个 200ms 也成了 name/set 的 RPC 超时,繁忙 runner 上本机往返超过 200ms,用例就红在 name/set 上,而不是被测的兜底逻辑上。

修法(纯测试,两条用例)

  • 出事的这条(preview 等待):预算放大到 2s,慢读放大到 3s。
  • 同构的「still writes the title when a slow thread/read exhausts the updatedAfter wait budget」(首审指出的同一个假红面,慢读 300ms / 预算 200ms),同样改成慢读 3s / 预算 2s。

两条的被测关系「预算短于那次慢读」都不变,name/set 和校验读的 RPC 超时从约等于往返耗时变成远大于往返耗时,有十倍以上余量。代价是每条多跑约 2.5s。注释写明这个关系,以及 timeoutMs 一参两用的背景。

证据

确定性对照:在假 app-server 里临时把 thread/name/set 的响应推迟 250ms,模拟被拖慢的本机往返(只在实验中改,未提交):

  • 原写法:两条都失败,报错与 CI 逐字相同(thread/name/set timed out after 200ms);
  • 改后:两条都通过。

未处理(生产代码,单独说明)

同文件「issues no thread/read when the preview wait budget is below the poll floor」那条用例,必须传 40ms 的 timeoutMs(低于 50ms 轮询下限),它的 name/set 和校验读也就只有 40ms 的 RPC 超时。这比本 PR 修的这条更脆,但只改测试改不掉。根治是 #2454 建议的接口拆分:把等待预算与单次 RPC 超时分成两个入参,生产唯一调用方(src/worker.ts,传 10s)行为不变。这是生产代码的接口改动,按要求不混进本 PR,另行处理。

验证

  • vitest 跑本文件 + test-hygiene 58 例全绿;bun test --timeout=180000(全新 HOME/TMPDIR)跑本文件 32 例全绿。
  • 只改 test/codex-app-threads.test.ts,src/ 零改动。

🤖 Generated with Claude Code

setCodexAppThreadName 的 timeoutMs 同时是 preview 等待预算和之后每个 RPC 的超时
(#2454)。用例只让第一次 preview 读慢,需要的是「预算短于那次慢读、但远大于本
机 RPC 往返」;200ms 在繁忙的 CI runner 上掐断了普通的 thread/name/set。改为预算
2s、慢读 3s:被测关系不变,RPC 超时有十倍以上余量。

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@deepcoldy
deepcoldy merged commit 049be68 into master Oct 29, 2026
14 checks passed
@deepcoldy

Copy link
Copy Markdown
Owner Author

合后核验:落地提交 049be68(标题带 #2525、正文为空),落地树与「master 651a7d3 + 审过的 head bab6361」逐一相同。#2454 保持打开:同文件 40ms poll-floor 那条只能靠接口拆分(等待预算与 RPC 超时分参)根治,属生产改动,待维护者定。

@deepcoldy
deepcoldy deleted the test/codex-thread-name-rpc-budget branch October 29, 2026 16:11
deepcoldy pushed a commit to uestcwangci/botmux that referenced this pull request Oct 29, 2026
…ity-recovery-2473-final

在作者最新 head 36930a4 上同步 master 至 0345cc5(其 merge base
651a7d3 之后的 4 个提交:deepcoldy#2526/deepcoldy#2513/deepcoldy#2523/deepcoldy#2525)。唯一冲突在
worker-argv-reaction-status 首轮 re-arm 用例的启动等待段:作者已在
deepcoldy#2513 合入前用信号驱动 fixture(paint-phase 文件按观测阶段推进,消除
固定 6s 墙钟,即复审建议的根治方向)重写了该用例,merge 已把 fake
定义取为信号驱动版,故等待段配套取作者版(等 projected-working 采样器
再写 startup 信号);deepcoldy#2513 配 setTimeout fake 的 fresh-empty 等待与
信号 fake 不兼容、不采用,其启动保证被作者版更强的等待覆盖。
codex-app-runner.integration 自动合并,PR 容量用例与 deepcoldy#2523/deepcoldy#2526
改动并存。Pi 用例双引擎 + 2 核 isolate 重载 3 次绿、全文件 16/16;
codex 集成/容量/engine/deployment 共 210 项 vitest 绿。

Co-Authored-By: Claude Code <[email protected]>
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

🚀 Released in v3.56.0

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant