You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8be4ab3
Browse filesBrowse the repository at this point in the historyBrowse files
Reconcile upstream PR openai#361 into the already-merged openai#302 wall-clock timeouts.
Replace openai#302's captureTurn idle timer (armIdle / CODEX_TURN_IDLE_TIMEOUT_MS) with
openai#361's Promise.race([work, ceiling, stall, exit]) + interruptTurnBestEffort. This
also covers a start RPC that hangs or rejects before any ACK, and interrupts an
abandoned turn upstream so it cannot overlap a retry. Keep openai#302's app-server
request() wall-clock timeout untouched (complementary transport-layer guard).
Add broker idle self-shutdown (CODEX_COMPANION_BROKER_IDLE_MS, default 30m) and
onSocketGone teardown so an orphaned broker/turn self-heals instead of leaking;
close the listener before the upstream app-server on shutdown. Surface Codex
invocation failures verbatim instead of swallowing them into an empty response.
openai#361 supersedes openai#312 (the per-turn watchdog openai#312 attempted, implemented correctly here).
Dual security review (Opus + Codex gpt-5.5 xhigh): both APPROVE, all 9 red lines
clear, 0 security findings. Converged LOW non-blockers: onSocketGone error+close
double-event is idempotent but untested; CEILING_MS backstop untested; openai#355
background-job interaction noted (not merged). Full suite 98/98 in a clean env.
Upstream PR: openai#361
Co-Authored-By: geoff-ux <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copy file name to clipboardExpand all lines: plugins/codex/agents/codex-rescue.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ Forwarding rules:
39
39
- Otherwise forward the task as a fresh `task` run.
40
40
- Preserve the user's task text as-is apart from stripping routing flags.
41
41
- Return the stdout of the `codex-companion` command exactly as-is.
42
-
- If the Bash call fails or Codex cannot be invoked, return nothing.
42
+
- If the Bash call fails or Codex cannot be invoked, return its error output (stderr and any stdout) verbatim so the failure is visible — never swallow it into an empty response.
// `turnAbandoned` marks a failure where the turn may still be running upstream
617
+
// (a watchdog fired, or the app-server vanished) — as opposed to a turn that
618
+
// errored and is therefore already over. The catch below uses it to decide
619
+
// whether the upstream work needs to be actively stopped.
620
+
constceiling=newPromise((_resolve,reject)=>{
621
+
ceilingTimer=setTimeout(()=>{
622
+
reject(
623
+
Object.assign(
624
+
newError(
625
+
`Codex turn exceeded the ${Math.round(CEILING_MS/1000)}s ceiling without completing (raise CODEX_COMPANION_TURN_TIMEOUT_MS for long turns). Treating as stalled.`
626
+
),
627
+
{turnAbandoned: true}
628
+
)
629
+
);
630
+
},CEILING_MS);
631
+
ceilingTimer.unref?.();
632
+
});
633
+
634
+
conststall=newPromise((_resolve,reject)=>{
635
+
stallTimer=setInterval(()=>{
636
+
if(Date.now()-lastActivity>=STALL_MS){
637
+
reject(
638
+
Object.assign(
639
+
newError(
640
+
`Codex turn produced no activity for ${Math.round(STALL_MS/1000)}s (raise CODEX_COMPANION_TURN_STALL_MS for long silent turns) — likely a hung MCP server or wedged turn. Treating as stalled.`
641
+
),
642
+
{turnAbandoned: true}
643
+
)
644
+
);
645
+
}
646
+
},Math.min(STALL_MS,30_000));
647
+
stallTimer.unref?.();
648
+
});
622
649
623
-
try{
650
+
constexit=client.exitPromise.then(()=>{
651
+
if(state.completed){
652
+
returnstate;
653
+
}
654
+
throwObject.assign(
655
+
newError(client.exitError?.message??"codex app-server exited before the turn completed."),
656
+
{turnAbandoned: true}
657
+
);
658
+
});
659
+
660
+
// Wrap the start RPC and response processing so the guards also cover a start
661
+
// request that hangs or rejects before the turn is ever established, and so
662
+
// every guard is observed by Promise.race from the outset.
Copy file name to clipboardExpand all lines: plugins/codex/skills/codex-cli-runtime/SKILL.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,4 +40,4 @@ Safety rules:
40
40
- Preserve the user's task text as-is apart from stripping routing flags.
41
41
- Do not inspect the repository, read files, grep, monitor progress, poll status, fetch results, cancel jobs, summarize output, or do any follow-up work of your own.
42
42
- Return the stdout of the `task` command exactly as-is.
43
-
- If the Bash call fails or Codex cannot be invoked, return nothing.
43
+
- If the Bash call fails or Codex cannot be invoked, return its error output (stderr and any stdout) verbatim so the failure is visible — never swallow it into an empty response.
0 commit comments