Keep shared history when running Codex in containers
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
What variant of Codex are you using?
App, CLI
What feature would you like to see?
When running agents in containers, the containers should be disposable but the conversations/threads/history should not.
I would like to be able to run multiple codex in own containers while also using Desktop, and still retain the history and resume functionality.
Basically, I'd like to run the agent in containers, while keeping the history permanent (and ideally shared with non-contained codex, Desktop, etc), allowing to resume in a different container etc.
Mounting ~/.codex into the containers seems like the obvious solution, but sharing live SQLite files across that boundary causes corruption.
This came up after Codex 0.153.4 started failing to resume conversations with “database disk image is malformed”. A small test using fresh SQLite databases with both Apple Containers and Docker reproduced broken locking and lost writes on macOS. This does not prove what damaged the original history, but it shows that sharing the directory is unsafe in these setups.
Could Codex support this out of the box?
This is just thinking out loud, but some ideas: Perhaps a local daemon could own history and state, with containerized instances talking to it? Or app-server could keep history on the host while execution stays in disposable containers?
Related: #30957 (NFS corruption), #23168 (storage backends), #10450 (desktop remote development).
Additional information
My personal workflow is to start disposable containers with access to only to only the folders needed to get the job done, using a script to make this seamless and exactly as if starting CLI in a local folder, without requiring a copy or git checkout.
But I do believe this is a common concern, and a direction we're going in: agents will run in containers or VMs, but the persistent session history and ability to resume is still needed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the app-server direction and how persistent history is stored under ~/.codex, with attention to the SQLite database and the container boundary. Define a safe host-owned history flow that supports disposable containers, sharing with Desktop and non-containerized Codex, and resuming from another container without database corruption.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, rust, sqlite
- Domain
- backend, cli, database, devops
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100