You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Codex Chat falls back to the terminal when Codex's state_5.sqlite has no -wal/-shm (SQLITE_CANTOPEN) #2444
Codex's state_5.sqlite is a WAL-mode database. When no Codex process holds it open (the shared app-server daemon releases it after a while), the -wal and -shm files are gone. Ovis opens the store read-only (new Database(…/state_5.sqlite, { readonly: true, create: false }), server/codex.ts), and SQLite cannot open a WAL database read-only without a -shm file it may create: every query fails with SQLITE_CANTOPEN (errno 14). codexTranscriptPath swallows the error and finds no candidates, so Chat falls back to the terminal for every Codex pane until some Codex process opens the store again.
Reproduction (test MacBook Air, macOS 27.0.1, Codex 0.163.0 TUI with the 0.166.0 app-server daemon, isolated herdr session)
Run Codex in a herdr pane with its own CODEX_HOME, finish a turn, and leave it idle.
Once the store is released:
$ ls $CODEX_HOME/state_5*
state_5.sqlite # no -wal, no -shm
$ od -A d -t u1 -j 18 -N 2 $CODEX_HOME/state_5.sqlite
0000018 2 2 # WAL mode
Read the pane's conversation from a freshly started Ovis: GET /api/pane/conversation?pane_id=… → {"source":"scrollback","turns":[]}. A direct open shows the cause:
new Database(home + "/state_5.sqlite", { readonly: true, create: false }).query("PRAGMA journal_mode").get()
→ SQLiteError: unable to open database file (SQLITE_CANTOPEN, errno 14)
A running Ovis that already bound the pane keeps showing it, so this shows after a restart or for a pane not yet bound.
Send any message in a Codex pane (the daemon reopens the store, -wal/-shm reappear): the same request now returns the pane's native conversation.
Seen on main (6c78047f, 0.4.21) and on the branches of #2443 and #2420.
Expected
Ovis reads Codex's store whether or not a Codex process holds it, never writing to it.
Suggested fix
Open the store so it needs no -wal/-shm of its own: SQLite's read-only immutable=1 URI when no -wal exists (nothing uncheckpointed to miss), or read a consistent copy. Never write to Codex's database.
Activity
fix(codex): read Codex's store when no Codex holds it open (devswha#2446
chore(release): 0.4.22 (#2473)
fix(chat): greet a new Codex pane whose footer names a custom provide…