WSL tab close during running turn leaves resumed session stuck in Working (missing task_complete)
Summary
When an interactive Codex session is still running and the WSL Ubuntu terminal tab is closed via the tab-bar x button, reopening with codex resume can leave the session stuck in Working (...) forever.
In the affected session file, the last turn has task_started but no matching task_complete (and no turn_aborted).
Environment
- OS: WSL Ubuntu (user environment)
- Codex CLI:
0.104.0 - Date observed: 2026-02-25 to 2026-02-26 (UTC timestamps in logs)
Reproduction (observed flow)
- Start a normal interactive Codex session.
- While a turn is still running (
Workingshown), close the terminal tab using the tab barxbutton (abrupt terminal close). - Reopen terminal and run
codex resumefor that session. - UI remains in
Working (..s • esc to interrupt)and does not recover.
Expected
Session should recover gracefully on resume, or auto-mark the interrupted turn as aborted/completed so Working does not stay forever.
Actual
Working remains indefinitely. The underlying session JSONL has an unmatched task_started turn.
Evidence
1) Missing terminal turn-end event in session logs
Session A:
- file:
~/.codex/sessions/2026/02/25/rollout-2026-02-25T23-20-34-019c952c-4e6d-7dc3-bdfd-b070a914b7aa.jsonl - has:
task_startedforturn_id=019c9578-4a8a-7e33-9d1e-d65708ffa679 - originally missing:
task_complete/turn_abortedfor same turn
Session B:
- file:
~/.codex/sessions/2026/02/15/rollout-2026-02-15T18-21-15-019c609a-ad65-7761-a862-3af2e958375a.jsonl - has:
task_startedforturn_id=019c9517-3f2d-7b50-8057-32c3df1d850d - originally missing:
task_complete/turn_abortedfor same turn
2) TUI error around the same period
From ~/.codex/log/codex-tui.log:
305225: 2026-02-26T00:02:57.055045Z ERROR codex_tui::chatwidget::agent: failed to submit op: internal error; agent loop died unexpectedly305226: 2026-02-26T00:02:57.055061Z ERROR codex_tui::chatwidget::agent: failed to submit op: internal error; agent loop died unexpectedly
Temporary workaround (worked)
Manual log repair:
- Backup the affected session JSONL.
- Append a synthetic event:
{"timestamp":"<utc>","type":"event_msg","payload":{"type":"task_complete","turn_id":"<stuck_turn_id>","last_agent_message":null}}
- Resume/restart Codex.
After this, stuck Working was cleared in both reproduced sessions.
Notes
This looks like resume recovery does not reconcile dangling task_started turns after abrupt terminal/tab termination.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗