Skip to content

codex: stop bind-mounting writable SQLite state through macOS VirtioFS #431

Description

@lroolle

Description

Default Codex mounting bind-mounts the complete host .codex directory into the container. This puts Codex's writable SQLite runtime state on macOS VirtioFS; a live deva container now has three corrupt Codex databases.

Type

  • Bug fix
  • New feature
  • Enhancement
  • Documentation

Details

Observed facts:

  • Codex CLI: 0.144.4.
  • /home/deva/.codex is mac[$HOME/.codex], virtiofs, rw.
  • PRAGMA quick_check reports state_5.sqlite, logs_2.sqlite, and memories_1.sqlite corrupt. goals_1.sqlite is OK.
  • The affected TUI's rollout emitted task_complete, but the TUI stopped accepting quit input.
  • The process was sleeping in normal futex_wait/epoll_pwait; SIGWINCH woke it and caused I/O. This was not a CPU loop or uninterruptible kernel wait.
  • The surviving process holds deleted logs_2.sqlite-wal and logs_2.sqlite-shm descriptors.

This does not prove the database corruption caused the TUI symptom. It does prove deva's default mount exposes mutable SQLite databases and their WAL sidecars through a shared host bind mount.

deva.sh treats .codex as one canonical config entry and mounts it wholesale. Split stable config/auth inputs from runtime state. Keep writable SQLite files container-local and persistent with the container. If shared host state remains supported, make it explicit and guard concurrent host/container writers.

Related Files

  • deva.sh
  • agents/codex.sh
  • scripts/test-mount-shape.sh
  • docs/how-it-works.md
  • docs/authentication.md
  • docs/troubleshooting.md

Test Plan

  • On macOS/OrbStack, default Codex runtime SQLite files are not written through VirtioFS.
  • ChatGPT and credentials-file auth still work.
  • Codex runtime state persists across reuse of one persistent deva container.
  • Two deva Codex sessions do not share one writable SQLite database by default.
  • After concurrent-session and forced-exit tests, all Codex databases pass PRAGMA quick_check.
  • Update mount-shape tests and documentation for the new boundary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions