Skip to content

feat: session persistence #146

Closed
Closed

Description

@yuan-alex

Allow the user to continue a previously saved session/thread with the same current working directory by using a command like /session. This command can only be used before any message has been sent.

Incremental thread state is already persisted in ~/.codex/sessions/rollout-*.json but an alternative structure is necessary to store thread information.

A simple alternative could allow the user to continue the most recently saved thread state for the current working directory.

Activity

  1. tibo-openai commented on Apr 17, 2025

    @tibo-openai
    Collaborator

    Could you expand on

    an alternative structure is necessary to store thread information

    ?

  2. added
    enhancement
    on Apr 17, 2025
  3. igor-gorohovsky commented on Apr 18, 2025

    @igor-gorohovsky

    I agree, I really miss the feature to return to the old session

  4. scottleibrand commented on Apr 19, 2025

    @scottleibrand
    Contributor

    #341 is also asking for this, and has some good design ideas.
    #118 as well.

  5. yuan-alex commented on Apr 19, 2025

    @yuan-alex
    Author

    The existing rollout files store the entire thread state at each generation step. The session.id field of each rollout is a randomly generated UUID. There is no explicit or reliable index of what threads exist or how they're related to a specific project. A new thread structure will help map project directories to rollouts so we can easily restore the latest rollout.

    ~/.codex/threads.json

    [
      {
        "id": "thread_id",
        "cwd": "/path/to/project",
        "created_at": "2025-04-18T10:32:00Z",
        "updated_at": "2025-04-18T11:12:00Z",
        "first_prompt": "explain this codebase to me",
        "summary": "Codex Codebase Summary",
        "latest_rollout": "rollout-*.json"
      }
    ]
  6. codex-maintainers commented on Aug 7, 2025

    @codex-maintainers

    Thanks for the feedback! Please try the latest version of Codex CLI to see if this issue persists. If it does, we'd appreciate any further details or contributions to the codex-rs/ implementation.

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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions