Skip to content

Session lost after battery shutdown + update — no rollout persisted for resumable session #19037

Open

Description

@ildeb

What version of the Codex App are you using (From “About Codex” dialog)?

codex-cli 0.122.0

What subscription do you have?

ChatGPT Plus (monthly subscription)

What platform is your computer?

Linux Mint 21.3 (kernel 5.15.0-174-generic, x86_64)

What issue are you seeing?

A long-running Codex CLI session was lost and cannot be resumed after a normal system shutdown (battery depletion) followed by a Codex update.

The session had already reached the usage/query limit and stopped accepting input, so it should have been in a stable terminal state.

After restarting the system and updating Codex (as prompted), the session is no longer available via codex resume.

No session rollout exists for that day under ~/.codex/sessions.

What steps can reproduce the bug?

  1. Start a long Codex CLI session
  2. Work until the usage/query limit is reached
  3. Leave the machine running on battery
  4. System performs normal shutdown due to low battery
  5. Restart the machine
  6. Launch Codex and attempt to resume session
  7. Codex prompts for update → perform update
  8. Attempt to resume again

What is the expected behavior?

A session that has reached a terminal state (such as usage/query limit) should be persisted to disk and recoverable via codex resume after restart.

Additional information

Diagnostics:

  • ~/.codex/sessions contains only:
    • 2026/04/14
    • 2026/04/19
  • No directory exists for 2026/04/22
  • ~/.codex/history.jsonl was updated on 2026-04-22 (activity confirmed)
  • ~/.codex/state_5.sqlite exists but is reused from previous sessions
  • No rollout .jsonl file exists for the lost session

System shutdown was clean (battery threshold triggered OS shutdown).

In previous similar situations, codex resume worked correctly after restart.

This suggests that the session was never flushed to disk in a resumable form.

Impact:
Several hours of work lost with no recovery path.

This behavior makes Codex unreliable for long-running sessions unless external logging is used.

Activity

  1. added
    appIssues related to the Codex desktop app
    on Apr 22, 2026
  2. added
    bugSomething isn't working
    CLIIssues related to the Codex CLI
    sessionIssues involving session (thread) management, resuming, forking, naming, archiving
    on Apr 22, 2026
  3. github-actions commented on Apr 22, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  4. ildeb commented on Apr 22, 2026

    @ildeb
    Author

    Regarding the potential duplicate suggested above (#18690):

    This does not appear to be the same issue.

    The linked issue describes rollout files not being written until the first API turn completes (i.e. very early in the session lifecycle).

    In my case:

    • the session was long-running (multiple API turns already completed)
    • it reached the usage/query limit (terminal state)
    • interaction had already stopped
    • the system then performed a normal shutdown
    • after restart, no rollout file exists for that session

    Given that rollout files are written after the first API turn, a rollout file should already have existed long before shutdown.

    The absence of any rollout file suggests a failure in persistence after an established session, not a delay in initial rollout creation.

    This appears to be a different and more severe failure mode, as it results in complete loss of a progressed session.

  5. added
    agentIssues related to the core agent loop
    and removed
    CLIIssues related to the Codex CLI
    appIssues related to the Codex desktop app
    sessionIssues involving session (thread) management, resuming, forking, naming, archiving
    on Apr 22, 2026
  6. ildeb commented on Apr 23, 2026

    @ildeb
    Author

    Not sure if this is directly related, but this issue was automatically linked to #19081 (macOS app crash on long tasks).

    In my case:

    • no crash occurred
    • the system performed a normal shutdown
    • the issue is loss of session persistence

    However both cases seem to involve long-running sessions and possible state persistence problems.

  7. Necmttn commented on Jun 21, 2026

    @Necmttn

    A resumable session should have an append-only checkpoint before it reaches any long-lived terminal state.

    When usage limit is hit, write and flush a stable record with session id, cwd, model, last completed turn id, limit/error state, and source file path. Then shutdown/update recovery can list the session even if no later assistant turn is accepted.

    The missing rollout is the hard part to diagnose after the fact.


    Generated with ax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentIssues related to the core agent loopbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions