Skip to content

Commit f7673f3

Browse files
t3dotggclaude
andcommitted
fix(server): retryable child errors keep the child live and interruptible
The child error branch settled every error as systemError and dropped the live-turn entry, ignoring willRetry — a retrying child kept running but was orphaned from Stop and shown failed. Mirrors the root error handler: willRetry keeps the child running; only terminal errors clean up and emit systemError. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent aaf6916 commit f7673f3

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

‎apps/server/src/provider/Layers/CodexSessionRuntime.ts‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,12 +1208,19 @@ export const makeCodexSessionRuntime = (
12081208
payload: childIdentity,
12091209
});
12101210
return true;
1211-
case "error":
1211+
case "error": {
12121212
// A child error must surface as a failed agent, not vanish into
12131213
// the default swallow (review finding: the child stayed
1214-
// "running" forever). Reuses the statusChanged systemError path.
1215-
// Same live-turn cleanup as thread/closed: an errored child has
1216-
// no turn left to interrupt.
1214+
// "running" forever). Retryable errors (willRetry) keep the
1215+
// child RUNNING and interruptible — mirroring the root error
1216+
// handler; settling it would orphan a still-live child from
1217+
// Stop (review finding). Terminal errors clean up the live turn
1218+
// like thread/closed and reuse the statusChanged systemError
1219+
// path.
1220+
const willRetry = (notification.params as { willRetry?: boolean }).willRetry === true;
1221+
if (willRetry) {
1222+
return true;
1223+
}
12171224
yield* Ref.update(collabChildLiveTurnsRef, (current) => {
12181225
const next = new Map(current);
12191226
next.delete(child.agentThreadId);
@@ -1230,6 +1237,7 @@ export const makeCodexSessionRuntime = (
12301237
},
12311238
});
12321239
return true;
1240+
}
12331241
default:
12341242
// Routing table decides (single source of truth, asserted
12351243
// against captured wire traces): enumerated chatter is dropped,

0 commit comments

Comments
 (0)