Skip to content

Make Codex state storage backend configurable beyond SQLite #23168

Open

Description

@QwertyJack

What variant of Codex are you using?

CLI

What feature would you like to see?

Please consider making Codex's persistent state/log storage backend configurable, instead of hard-coding SQLite-only runtime state.

Today Codex exposes sqlite_home, which helps relocate SQLite files, but it does not solve cases where multiple Codex instances need to share the same state across machines or cluster nodes. In those environments, ~/.codex / $CODEX_HOME is often placed on a shared filesystem, and multiple Codex processes may run concurrently on different hosts. SQLite/WAL semantics on shared filesystems can become a bottleneck or a correctness/reliability risk under concurrent writers.

A useful design would be a pluggable storage backend, for example:

[state]
backend = "sqlite" # default, current behavior

[state.sqlite]
path = "/local/scratch/$USER/codex-state"

# Optional future backend
[state.postgres]
url = "postgres://codex:...@db.example.com/codex"
pool_size = 10

The goal is not necessarily to remove SQLite. SQLite should remain the default for single-machine/local-first use. The request is to allow an optional server-grade backend, such as PostgreSQL, for users running Codex across multiple nodes, shared workstations, remote dev boxes, or managed enterprise environments.

Why this helps:

  • safe concurrent writers across nodes
  • central state for shared/remote Codex usage
  • better operational tooling: backups, retention, vacuuming, monitoring
  • configurable connection pooling and durability behavior
  • cleaner enterprise deployment where home directories are network-mounted

This request is related to, but broader than, several SQLite-specific reliability/performance issues:

Additional information

For now, the workaround is to keep sqlite_home and log_dir on node-local storage instead of a shared filesystem. That avoids many SQLite shared-FS problems, but it also means Codex state is no longer shared across machines. A configurable backend would support both local-first and cluster/enterprise deployments cleanly.

Activity

  1. added
    enhancementNew feature or request
    CLIIssues related to the Codex CLI
    configIssues involving config.toml, config keys, config merging, or config updates
    on May 17, 2026
  2. yoccodog commented on Oct 15, 2026

    @yoccodog

    Another concrete use case for this: moving an interactive Codex CLI conversation from a developer's laptop into a remote development VM (we use Fly Sprites), then continuing the same conversation there.

    We want to preserve the conversation ID, messages, tool calls/results, and the context needed to resume, while keeping authentication, permissions, working-directory configuration, and live processes specific to the destination host. We need sequential handoff with a single writer, not simultaneous editing of one conversation from multiple machines.

    Today our wrapper implements its own import path around native session files. One real conversation was about 28 MB and used history_mode=paginated, exposing both our transfer-size limit and our importer's lack of support for that format. Those are limitations of our wrapper, not evidence of a Codex size limit, but they illustrate the maintenance cost of building portability around internal storage formats.

    Alongside the PostgreSQL proposal, could the storage abstraction support user-owned object storage such as AWS S3 or Google Cloud Storage? Alternatively, a documented, versioned export/import or checkpoint API would address much of this workflow without requiring every integration to reconstruct native history itself.

    The important properties for us are:

    • Export and resume one exact conversation without copying the entire CODEX_HOME or credentials.
    • Preserve paginated history and any required lineage/checkpoint data, with integrity and version validation.
    • Explicit destination workspace/path mapping and destination-controlled permissions.
    • Safe single-writer handoff, with clear errors for active sessions, missing dependencies, or incompatible versions.
    • Large-session transfer and durable backup independent of the original machine staying online.

    This overlaps with #52050 (safe cross-node resume) and #47196 (supported portable export/import). A supported storage or portability boundary in the CLI harness would be valuable even if SQLite remains the default.

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

    CLIIssues related to the Codex CLIconfigIssues involving config.toml, config keys, config merging, or config updatesenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions