Skip to content

fix(server): recover Codex sessions after process exits - #32

Merged
matheustimbo merged 4 commits into
fork-mainfrom
fix/fork-codex-dead-session-recovery
Sep 21, 2026
Merged

matheustimbo merged 4 commits into
fork-mainfrom
fix/fork-codex-dead-session-recovery

Conversation

@matheustimbo

Copy link
Copy Markdown
Owner

Summary

Port the reviewed Codex process-exit recovery fix from upstream PR pingdotgg#12922 onto this fork's v0.1.69 release line. It handles an App Server killed by SIGKILL, drops the dead adapter session, and lets the next turn resume without restarting T3 Code.

The port includes the original upstream authors' commits and the follow-up lifecycle fixes and regression tests. Related upstream issue: pingdotgg#12904.

Validation on this fork branch

  • Focused Codex adapter and runtime tests: 68 passed.
  • bun run fmt: passed; clean worktree.
  • bun run lint: passed with existing warnings.
  • bun run typecheck: passed across 15 workspaces.
  • git diff --check origin/fork-main...HEAD: passed.

Fork CI runs on this PR. Merging into fork-main will trigger the fork's own release workflow, which should publish v0.1.70 with installable Linux, macOS, and Windows assets. No running server is updated by this PR.

khaneliman and others added 4 commits September 21, 2026 11:38
Handle failed exit-status effects so signal termination emits the session exit event needed by the existing resume path. Cover killed-process recovery, numeric exit statuses, and intentional shutdown with process fixtures.

(cherry picked from commit 2faee12)
(cherry picked from commit 85dedbd)
Wait for piped responses to flush before the fixture exits so numeric-exit coverage cannot hang on a truncated response.

(cherry picked from commit b986d37)
(cherry picked from commit b4d0802)
The Codex adapter forwarded a runtime's session.exited event but left the dead session in its map, so hasSession and listSessions kept reporting the thread as live. Startup reconciliation trusts listSessions and the session reaper skips sessions holding an activeTurnId, so a thread whose Codex process died mid-turn stayed running and showed Working forever.

(cherry picked from commit 95c96c1)
(cherry picked from commit 636b575)
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Sep 21, 2026
@matheustimbo
matheustimbo merged commit 093eb43 into fork-main Sep 21, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants