Repository navigation
fix(herdr): 认窗格时单次 agent list 没应答不再判启动失败,截止放到 60 秒 - #2577
Merged
deepcoldy merged 4 commits intoOct 30, 2026
Merged
Conversation
… 立即失败;测试补真实超时形状、空响应、非 JSON,失败用例推进假时钟防变异死循环 Co-Authored-By: Claude Code <[email protected]>
Co-Authored-By: Claude Code <[email protected]>
nengqi
requested review from
47seek,
LucasIcarus,
deepcoldy,
xiaoxueSunn and
xiongz-c
as code owners
October 30, 2026 04:19
Owner
|
已合并,感谢贡献!这个修复直接解决了高负载 macOS 上 herdr 托管窗格偶发「会话启动失败」、需要手动重发的问题,思路和测试(五种「没应答」形状、假时钟推进防变异死循环、截止边界关系断言)都很扎实。 一个不阻断本 PR 的 follow-up 已记录在 #2584:检测循环的退避 欢迎继续贡献。 |
deepcoldy
pushed a commit
to uestcwangci/botmux
that referenced
this pull request
Oct 30, 2026
…ity-recovery-2473-final 五次同步 master(eb4311607..4896715,9 提交,含 deepcoldy#2563 真机沙盒跑道/deepcoldy#2547 沙盒 四修/deepcoldy#2577 herdr 认窗格/deepcoldy#2522 失效终端入口/deepcoldy#2558 白名单沙盒/deepcoldy#2552 会话控制 页精简/deepcoldy#2570 自动更新跳过/deepcoldy#2537 沙盒文档/deepcoldy#2580 Pi 恢复复制)。与本 PR 仅 worker-pool.ts / worker.ts 文件交集(deepcoldy#2547/deepcoldy#2522/deepcoldy#2558),git 自动合并干净、 无冲突标记;PR 关键接线(codexAppTurnFailureCode 四处、!turn.error 守卫、 pool 恢复落账、worker 签名 final 失败字段、Pi boot 20s 预算)逐处 grep 仍在 原位。合并树 build 过、codex 集成/容量/engine/deployment 243 项 vitest 绿、 容量 30 + Pi argv 1 项 bun 绿。 Co-Authored-By: Claude Code <[email protected]>
deepcoldy
pushed a commit
that referenced
this pull request
Oct 30, 2026
a247797 之后 master 进 #2547/#2577/#2580/#2563/#2540。3 文件 4 块冲突人工合成: - dashboard-ipc-server.ts:import 两边都留(本 PR 的 existsSync 与 #2540 的 sandbox-network-policy import),不重复 readFileSync。 - bot-defaults-page.tsx:保留 #2540 改的 export function SandboxSection,本 PR 的 CodexIsolatedConfigInfo 同存;networkUnsupported 调用逻辑已随 master 自动取三分支。 - i18n.ts(zh/en 真语义冲突): networkRequirements 合成双方意图「需 Linux 本地 PTY 后端 + 白名单隔离沙箱」; 删掉本 PR 仍引用的旧 networkUnsupported 单 key,采用 #2540 的 networkUnsupportedPlatform/Backend/Mode 三新 key,并把其中 oncall 文案 (Mode、networkPolicyBlocksChange)按本 PR 改名同步为白名单隔离/allowlist-isolation。 zh/en 各 3959 key 完全对称、无重复。 - 补落点回归 test/session-sandbox-drift-placement.test.ts(新增):钉 SandboxDriftChip 在会话表格 status 列与看板卡片头两个主视图都接上(#2552 拆分后 易在解冲突时丢失);SessionsTableBase 改 export 供断言。删任一落点双用例分别咬红。
This was referenced Oct 30, 2026
|
@nengqi @deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。 这次运行覆盖 e93ebf9…9b5544155(12 个提交),同批合入的还有 #2562 #2514 #2558 #2537 #2570 #2522 #2552 #2580 #2547 #2563 #2540,失败不一定由本 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.
现象
macOS,herdr 后端(Herdr ≥ 0.7.5,托管窗格启动)。机器负载高时,收到消息新起的会话偶发启动失败,话题里收到「会话启动失败」。近 7 天本机 4 次,日志两种:
手动重发一条消息就能起来。
根因
HerdrBackend.spawn起完 CLI 后轮询herdr agent list认窗格,截止 30 秒,每次调用的 exec 超时为 5 秒:herdr agent list失败(包括 5 秒 exec 超时、没有输出)都直接抛出,整个启动判死。负载高时 herdr CLI 偶尔一次答不上来,就被当成启动失败。消息触发的会话没有 daemon 侧的启动自动重试(worker-startup-retry 只重试没有 turn 的失败),所以这两种都会直接变成用户看到的「会话启动失败」。
改法
herdr agent list「没应答」时不判死,继续轮询到截止时间:ENOENT/EACCES/ENOEXEC/ENOTDIR(包括ETIMEDOUT、EAGAIN这类资源不够);PANE_AGENT_START_TIMEOUT_MS,导出供测试用关系式断言)。agent list的错误:… within 60000 ms (last agent list error: …)。「没应答」用
requiredJsonCommand抛出的错误上的herdrTransient标记表示;其余 11 处调用方只是原样抛出或透传,不看这个属性,错误信息不变。影响面
src/adapters/backend/herdr-backend.ts的托管窗格启动检测(Herdr ≥ 0.7.5 的 managed-facade 启动);所有 CLI 种类经此路径的都受益;PTY / tmux / zmx 后端不受影响。execFileSync+sleepSync),这段时间里 worker 的事件循环被阻塞,最长也从 30 秒变成 60 秒。查过 daemon 侧,spawn 阶段没有短于 60 秒的看门狗会杀 worker;READY_SIGNAL_TIMEOUT_MS(45 秒)从 spawn 返回之后才开始计时。独立对抗复核
两轮,均为未参与实现的独立上下文读 diff 推演。
ENOENT也会空转到截止agent list后没清掉上一次的错误,超时信息里会带上过期的错误code: 'ETIMEDOUT'、可能带半截 stderr)、空响应、非 JSON 都没有用例EAGAIN等,原判定会立即失败err.killed不会出现测试
新增用例:
ETIMEDOUT形状带半截 stderr、EAGAIN、被杀且无输出、空响应、非 JSON):前两次轮询这样失败、第三次认出窗格 → 启动成功,不关 workspace。did not detect,带上最后一次agent list的错误,关掉 workspace、清掉 launcher。ENOENT):第一次轮询就失败,只调一次agent list,不报did not detect。PANE_AGENT_START_TIMEOUT_MS断言。变异复验(每次只改一处,改完还原):
requiredJsonCommand里const transient = …改成false:4 条变红(ETIMEDOUT、EAGAIN、被杀无输出三条「继续轮询」,以及「失败到截止」)。空响应、非 JSON 两条在另一处直接打标记,不经过这个变量,所以不受这条变异影响。if (!err?.herdrTransient) throw err;:3 条变红,都走到截止时间、报did not detect,没有卡死(两条新的「第一次就失败」,加一条原有的agent list结构化错误用例。原有那条用真实时钟,变异下会多跑约 60 秒)。本地验证:Linux 开发机,bun 1.4.3,代码与本分支 tree 一致。
bun install --frozen-lockfile/bun run buildbun run typecheck:scripts/typecheck:test-mocksnpx vitest run test/herdr-backend.test.tsbun run test(全量)全量失败的文件:
credential-only-relay-lifecycle.integration、devbox-dashboard-export、ipc-current-execution-route、sandbox-relay-lifecycle.integration、worker-riff-env.integration。和同一台开发机上 master(567ec94a)对照跑出来的失败一样,都是 5 个文件、21 条:两个 relay 集成测试是开发机没有 Claude 登录凭证,其余是开发机~/.botmux/.env里有真实值等环境原因。这几个文件都不引用 herdr 后端。🤖 Generated with Claude Code