Repository navigation
fix(codex): 线程改名的等待预算与单次请求超时拆成两个参数 - #2593
Merged
Merged
Conversation
setCodexAppThreadName 的 timeoutMs 同时是等待首条预览 / updatedAt 的总预算和之后 thread/name/set、校验 read 的单次请求超时;测试为压短等待传 40–200ms,name/set 也 只剩这么点时间,繁忙 runner 上偶发超时(#2454)。新增 waitBudgetMs 只管等待,默认 等于 timeoutMs;timeoutMs 只管单次请求(默认仍 7000)。生产调用方只传 timeoutMs: 10_000,两项都仍是 10 秒,行为不变。用例改用 waitBudgetMs 压等待,请求超时给足。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 30, 2026 09:20
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 30, 2026
|
@deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。 这次运行覆盖 89a9cea…22d1c8d0b(20 个提交),同批合入的还有 #2546 #2556 #2589 #2591 #2545 #2538 #2595 #2596 #2597 #2581 #2539 #2598 #2515 #2536 #2575 #2366 #2606 #2544 #2603,失败不一定由本 PR 引起。
|
This was referenced Oct 30, 2026
|
🚀 Released in v3.56.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2454。
问题
setCodexAppThreadName的timeoutMs一个值管两件事:waitForExistingPreview)/ 等 updatedAt 越过基线(waitForUpdatedAfter)的总预算,用完就降级、照样写标题,这是预期结果;thread/name/set和校验用thread/read的单次请求超时,超了就是失败。测试为了让等待阶段耗尽,传 40–200ms 的
timeoutMs,name/set 也就只有这么点时间,繁忙的 CI runner 上本机往返一超就红(#2454:run 40554189061、run 40891465999)。#2525 已经在测试侧把出事的两条用例放大到秒级,但「预算低于 50ms 轮询下限」那条必须传 40ms,只改测试修不掉。改动
新增选项
waitBudgetMs,与timeoutMs分工:timeoutMsthread/name/set、校验thread/read(以及initializeTimeoutMs的默认值,同原来)waitBudgetMs(新)timeoutMswaitForThreadPreview/waitForThreadUpdatedAfter内部逻辑不变(每次 read 取min(剩余预算, 2000ms),低于 50ms 下限就停)。对老用户无影响的依据
waitBudgetMs时它等于timeoutMs,两段用的值和改前完全相同;timeoutMs的默认 7000ms 也没变。src/worker.ts只传timeoutMs: 10_000,所以等待预算和请求超时仍都是 10 秒,与改前逐值相同。worker 内部还有一条不经过这个函数的路径(engine.waitForThreadPreview(10_000)等),本 PR 不涉及。timeoutMs: 1_000时,等待阶段最多发几次 read(默认值若不跟随timeoutMs,次数会多得多)。测试改动
timeoutMs压等待预算的 6 条用例(预览始终不可用、慢读耗尽预览预算、低于轮询下限、慢读耗尽 updatedAt 预算、两条钉住墙钟的尾窗用例),以及「尾窗里的非超时错误要穿透」那条,都改为waitBudgetMs压预算、timeoutMs: 20_000。被测关系都不变;test(codex): 慢 thread/read 兜底标题用例放大预算,name/set 不再被 200ms RPC 超时掐断 #2525 为绕开这个问题放大到秒级的两条,改回 200ms 预算 / 300ms 慢读,跑得更快。waitBudgetMs时等待预算等于timeoutMs(见上)。FAKE_CODEX_NAME_SET_DELAY_MS和FAKE_CODEX_VERIFY_READ_DELAY_MS,分别拖慢 name/set 和写后的校验 read,默认都是 0,不影响其他用例。验证
FAKE_CODEX_NAME_SET_DELAY_MS=250把每次 name/set 拖慢 250ms,模拟繁忙 runner:isolate-run,逐个改、跑、还原)4/4 被捕获:waitBudgetMs;timeoutMs。bun run build通过;相关 10 个文件 705 例 vitest 全绿;本文件bun test --timeout=180000(全新 HOME/TMPDIR)34 例全绿。🤖 Generated with Claude Code