Listen to Claude Code's StopFailure hook to detect API-failed turns immediately
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start by reading the Claude profile's hook registration in bmad-loop init, then trace how the relay journals Stop and how the engine handles transport or environment faults. The issue does not name specific files or tests, so first locate those entry points and existing recovery paths. Done means StopFailure is registered and journaled, transient errors recover without charging a dev attempt, and account or quota errors pause with an escalation.
由索引模型根据 Issue 内容生成。
描述
Describe your idea
Register Claude Code's StopFailure hook event in the relay, so a turn that ends on an API error is seen at once instead of through the stall budget.
Why is this needed?
On bmad-loop 0.13.0 (Claude Code adapter, herdr backend, Linux), a dev session finished its work, then its turn ended on an API error ("Connection lost mid-response"). The relay recorded no Stop for that session. The pane sat idle for about 34 minutes until I unblocked it by hand with a message. Policy at the time: session_timeout_min = 90, dev_stall_grace_s = 600, dev_stall_nudges = 2. From the hook events alone I cannot tell whether the stall nudges fired.
bmad-loop init registers SessionStart, Stop, SessionEnd, PreCompact and Notification. Claude Code also emits StopFailure when a turn ends because of an API error. Its input carries error (rate_limit, overloaded, server_error, unknown, authentication_failed, billing_error, ...), error_details and last_assistant_message (type StopFailureHookInput in Claude Code's hook type definitions). Today this signal is lost, and the loop can only learn about the failure from silence. I found no mention of StopFailure in the 0.13.1 release notes or in existing issues.
How should it work?
initregistersStopFailurefor theclaudeprofile, next to the existing events, and the relay journals it likeStop.- On
StopFailure, the engine classifies the turn as a transport or environment fault without charging a dev attempt, then recovers through the existing path (nudge or relaunch) instead of waiting for the grace to expire. errordrives the choice: transient values (overloaded,server_error,unknown) retry; account or quota values (rate_limit,billing_error,authentication_failed) pause the run with a clear escalation, since a retry cannot succeed.
Additional context
Related: #194 (API failure charged as a timeout), #470 (stall detection arming), #764 (late transient 5xx classified as an environment fault), #610 (usage-limit pattern).
- 主要语言
- Python
- 星标
- 178
- 派生
- 73
- 平均合并
- 17 小时 56 分钟
- 30 天内合并 PR
- 95
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bmad-code-org/bmad-loop 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 69/100
bmad-code-org/bmad-loop#973 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
bmad-code-org/bmad-loop#965 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 72/100
bmad-code-org/bmad-loop#1004 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 36/100
bmad-code-org/bmad-loop#972 ·
维护者通常 1 天内回复
-
难度 4/5 1-2 天 新手友好度 49/100
bmad-code-org/bmad-loop#971 ·
维护者通常 1 天内回复
查看 bmad-code-org/bmad-loop 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 77/100
-
needs-triage tooling
难度 1/5 1 小时以内 新手友好度 90/100
neilsh/stunt-reel#317 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
TandoorRecipes/recipes#4926 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
PyTomography/PyTomography#431 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 74/100
igormcsouza/tether#278 ·
维护者通常 1 天内回复