WSL tab close during running turn leaves resumed session stuck in Working (missing task_complete)

Resolved 💬 2 comments Opened Feb 26, 2026 by Ryogoooo Closed Feb 26, 2026

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)

  1. Start a normal interactive Codex session.
  2. While a turn is still running (Working shown), close the terminal tab using the tab bar x button (abrupt terminal close).
  3. Reopen terminal and run codex resume for that session.
  4. 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_started for turn_id=019c9578-4a8a-7e33-9d1e-d65708ffa679
  • originally missing: task_complete / turn_aborted for same turn

Session B:

  • file: ~/.codex/sessions/2026/02/15/rollout-2026-02-15T18-21-15-019c609a-ad65-7761-a862-3af2e958375a.jsonl
  • has: task_started for turn_id=019c9517-3f2d-7b50-8057-32c3df1d850d
  • originally missing: task_complete / turn_aborted for 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 unexpectedly
  • 305226: 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:

  1. Backup the affected session JSONL.
  2. Append a synthetic event:
{"timestamp":"<utc>","type":"event_msg","payload":{"type":"task_complete","turn_id":"<stuck_turn_id>","last_agent_message":null}}
  1. 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.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗