Repository navigation
Commit 52bd80f
fix(rescue): default to --background, make Bash-tool timeout terminal (#8)
Closes #7 (rephrased from code, not the original misdiagnosis).
The codex:codex-rescue subagent hung because it defaulted to a foreground
`task` run; when Codex exceeded Claude's Bash-tool timeout the host auto-
backgrounded the call, and the rescue model then violated its one-Bash-call
rule by improvising `cat` / `sleep 60` / `until grep ...; do sleep 5; done`
polling — which itself violates Claude Code's foreground-sleep restriction.
The Codex turn had actually completed; the hang was the subagent's polling,
not the companion.
This was a behavioral-contract gap, not a broker bug (verified by code trace
and the recorded transcript): the companion foreground path correctly blocks
on state.completion, an explicit --cwd is preserved unchanged through to the
broker process argv, and runtime SessionEnd already reaps brokers/sockets.
The original issue's "wait pattern" and "wrong cwd" causes are refuted; the
"no reaping" cause conflates a real test-harness leak (fixed in PR #5) with
runtime behavior.
Fix the contract that actually failed:
- rescue now defaults to --background (rescue work is open-ended; a foreground
run that the host auto-backgrounds at its Bash-tool timeout cannot be turned
back into a foreground wait, so start in background). --wait still selects
foreground explicitly.
- terminal-on-timeout: if the single task Bash call returns by host Bash-tool
timeout, the subagent makes no second call (no status/result/cat/sleep/
until-grep). The Codex turn keeps running and is recovered by the caller
via /codex:status or /codex:result — never by the subagent.
commands.test.mjs assertions updated to the new contract.
Claude-Session: https://claude.ai/code/session_0189cGaohsYdpkB4otKZnpAt
Co-authored-by: axisrow <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>1 parent 31f04b0 commit 52bd80f
3 files changed
Lines changed: 13 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
159 | | - | |
160 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
| |||
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
171 | | - | |
| 172 | + | |
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
| |||
0 commit comments