Repository navigation
Commit 93e29aa
fix(codex-rescue): default to --background; foreground inside the subagent is reaped at ~143s
Root cause (reproduced cleanly, not the daemon leak): a foreground (blocking)
`node companion task` call running INSIDE the codex-rescue Agent subagent is
auto-backgrounded by the harness and then reaped when the subagent ends —
observed at ~143s — which kills the detached Codex worker mid-run and silently
loses the work. Confirmed by lifetimes: foreground-via-subagent died at
142.1s / 143.3s (multiwarm) and 143.9s (controlled repro), while --background
via the subagent survived 309s and via direct Bash 461s / 492s. --background
returns immediately, so the worker reparents to launchd and survives.
Fix: codex-rescue now defaults to `task --background` whenever the user did not
explicitly pass `--wait`; foreground is reserved for short, clearly-bounded
`--wait` requests (well under ~140s), and substantial/long/write/uncertain work
always goes `--background`. The agent md and rescue.md document why (the
subagent reaping at ~143s, not the ~600s direct-Bash cap that the docs wrongly
cited). The main thread continues to arm the status --wait watcher for
background completion — the pattern proven reliable across this work.
Tests: assertions updated to the new default-background guidance + that the
incorrect ~600s foreground-cap claim is gone. Suite 119/119.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>1 parent 4de4d9c commit 93e29aa
3 files changed
Lines changed: 19 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
117 | | - | |
118 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
119 | 126 | | |
120 | 127 | | |
121 | 128 | | |
| |||
137 | 144 | | |
138 | 145 | | |
139 | 146 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
144 | 151 | | |
145 | 152 | | |
146 | 153 | | |
| |||
0 commit comments