Codex Desktop bug report: recent conversation history hidden/stale despite local DB containing threads
What version of the Codex App are you using (From “About Codex” dialog)?
26.429.30905
What subscription do you have?
Pro
What platform is your computer?
Darwin 25.4.0 arm64 arm
What issue are you seeing?
Codex Desktop appears to show a stale or incorrectly filtered conversation sidebar after recent CLI/extension/app history imports. Recent conversations exist in the local Codex state database and are returned by the app-server thread/list API, but the Desktop UI does not show them. Manual repairs to global/sidebar state are overwritten on app startup.
The issue appears related to the Desktop "Imported agent setup" flow. I clicked the "Import again" button multiple times. The visible badge count decreased from 16 to 0, and the card reported "Last imported 16h ago", but the sidebar remained stale after repeated imports and after restarting the app.
Impact: I experience this as lost conversation history. Multiple recent project conversations are missing from the visible sidebar, especially recent Mother OS and BlueChimp work. The sidebar appears to show conversations up to roughly 14-16 hours ago, then jumps to much older history, despite the database containing many conversations in between.
Environment:
- Product: Codex Desktop app on macOS
- Platform: Darwin 25.4.0 arm64 arm
- Observed app version from process metadata:
26.429.30905 - Electron version from process metadata:
41.2.0 - Local Codex state database:
~/.codex/state_5.sqlite - Global UI state file:
~/.codex/.codex-global-state.json - Global UI state backup file:
~/.codex/.codex-global-state.json.bak
Evidence:
- Local DB contains the missing recent conversations with
archived = 0. - A direct app-server
thread/listrequest withlimit: 30,sortKey: "updated_at",sortDirection: "desc",archived: false, anduseStateDbOnly: truereturned the expected recent list, including the missing Mother OS and BlueChimp conversations. - This suggests the database and app-server listing path are correct, while the Desktop sidebar display/state path is stale or filtered incorrectly.
Current hypothesis:
Codex Desktop startup or sidebar state reconciliation is restoring stale selected-remote-host-id and active-workspace-roots from app memory, migration logic, or another source of truth even after both global state files are repaired. This stale active project/remote state appears to affect the visible conversation list, while the underlying DB and app-server recent conversation API remain correct.
What steps can reproduce the bug?
- Click the Desktop "Imported agent setup" / "Import again" action multiple times.
- Observe the import badge count decrease from
16to0, suggesting the importer believes it processed the pending items. - Restart Codex Desktop.
- Observe that the sidebar still shows stale history with recent conversations missing.
- Inspect
~/.codex/state_5.sqliteand confirm the missing threads exist and are not archived. - Run
PRAGMA integrity_check; it returnsok. - Query app-server
thread/listwith state DB only and confirm the missing conversations are returned. - Inspect global UI state and observe stale state similar to:
{
"selected-remote-host-id": "[redacted remote host id]",
"active-workspace-roots": ["[redacted stale workspace root]"],
"electron-persisted-atom-state": {
"sidebar-workspace-filter-v2": "all",
"sidebar-organize-mode-v1": "recent",
"sidebar-keep-projects-in-recent-v1": false
}
}
- Edit
~/.codex/.codex-global-state.jsonwhile Codex is running; the app overwrites the edit. - Fully quit Codex and repair both
~/.codex/.codex-global-state.jsonand~/.codex/.codex-global-state.json.bakto clearselected-remote-host-idandactive-workspace-roots. - Reopen Codex.
- Observe that Codex rewrites
selected-remote-host-idandactive-workspace-rootsback to stale values on startup, and the sidebar remains wrong.
What is the expected behavior?
The Desktop sidebar Recent view should show all unarchived recent conversations sorted by updated_at, including recent conversations across projects such as Mother OS and BlueChimp.
Repeated use of "Imported agent setup" / "Import again" should not cause visible conversation history to disappear, become stale, or be filtered by an old project/remote workspace state.
If local thread/session data exists in ~/.codex/state_5.sqlite and is returned by app-server thread/list, the Desktop sidebar should surface it correctly.
Additional information
Possible areas to inspect:
- Startup reconciliation of
selected-remote-host-id - Startup reconciliation of
active-workspace-roots - Interaction between Recent sidebar mode and active workspace/project selection
- Import/reindex behavior behind the "Imported agent setup" / "Import again" flow, especially repeated imports where the pending badge count decreases to zero but sidebar state remains stale
- Any fallback/restore behavior involving
.codex-global-state.json.bak - Remote project migration logic that may select the first saved workspace root when active roots are empty
Related public reports:
- https://github.com/openai/codex/issues/18364 - Mac app hides older local conversations after update because bogus root-level
statussessions flood recent local history. Very relevant because it mentionsstate_5.sqlite, local data not deleted, recent local history being displaced, and DB-only repairs not surviving relaunch. - https://github.com/openai/codex/issues/17354 - Recent thread history wiped in app, present in CLI. Very relevant symptom match: GUI history wrong while CLI/local state is correct.
- https://github.com/openai/codex/issues/14389 - Codex Desktop App does not display existing local sessions from shared CODEX_HOME. Similar Desktop sidebar/history enumeration issue where SQLite and disk data exist but older sessions do not show.
- https://github.com/openai/codex/issues/15368 - Increase cap of sessions in VS Code extension. Relevant to the hidden recent-conversation cap theory; report calls out
RECENT_CONVERSATIONS_PAGE_SIZE = 50and suggests auto-pagination/load-more. - https://github.com/openai/codex/issues/10547 - Desktop app stuck in cloud-only mode; local sessions ignored even with
codexCloudAccess=disabled. Older closed issue involving Desktop ignoring local sessions and persistedactive-workspace-roots. - https://github.com/openai/codex/issues/15448 - Codex App hides existing threads when a project is reopened via a symlinked workspace path on macOS. Related path/workspace identity case where data exists but project history is hidden.
This is high impact because the user perceives recent local work as lost, even though the underlying history is present. The app should either avoid applying stale workspace filters to Recent history, or surface/clear the active filter clearly, and should not silently overwrite repaired state with stale project/remote selection on startup.
10 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I reviewed the suggested duplicates. #20493 is the closest because it also involves the Imported agent setup flow and hidden local chats, but this issue has a different diagnostic signature:
state_5.sqliteintegrity is OK, app-serverthread/listwithuseStateDbOnly:truereturns the missing rows, and Codex Desktop restores staleselected-remote-host-id/active-workspace-rootson startup even after repairing both.codex-global-state.jsonand.codex-global-state.json.bak.#20608, #20959, #20833, and #20419 are related sidebar/history visibility issues, but they do not cover the imported-agent trigger plus stale remote/workspace state restoration. I do not think this is an exact duplicate, though it may share the same broader sidebar/history indexing root cause.
Adding another reproduction/evidence set from Windows Desktop.
Reporter: @nemesistms
Environment observed:
OpenAI.Codex_26.506.3741.0_x64__2p2nqsd0c76g0%USERPROFILE%\.codexstate_5.sqlite,session_index.jsonl,.codex-global-state.jsonWe have now seen two related failure modes where chats/projects disappear from the Desktop sidebar/search while the local SQLite DB still contains the data.
Failure mode 1: project/sidebar state loss
state_5.sqlitestill contained the threads..codex-global-state.jsonwas rewritten to a minimal state.electron-saved-workspace-roots,project-order, andactive-workspace-roots.thread-workspace-root-hintswas reduced to only one entry.state_5.sqliterestored the project groups in the sidebar.Failure mode 2: stale/incomplete
session_index.jsonlstate_5.sqlite, not in the last backup.session_index.jsonl.session_index.jsonlfrom current SQLite fixed the visible chat list.db_active=192,index_ids=192,missing_from_index=0,extra_in_index=0.Local mitigation we added:
.codex-global-state.jsonandsession_index.jsonlagainststate_5.sqlite.session_index.jsonlhas missing/extra/duplicate IDs, it atomically rebuilds the index from SQLite instead of restoring an old backup.db_active=190,index_entries=190,index_ids=190,missing_from_index=0,extra_in_index=0.Other observations:
\\?\paths..codex-global-state.jsonorsession_index.jsonlstale/incomplete, while SQLite remains correct.Suggested product-side fix:
.codex-global-state.jsonandsession_index.jsonlwrites atomic and crash-safe.state_5.sqlitewithsession_index.jsonl; rebuild if inconsistent.C:\...vs\\?\C:\....Adding another macOS reproduction/evidence set from Codex Desktop.
Environment observed:
26.506.3142126.3.1 (25D771280a),arm64~/.codexstate_5.sqlite,session_index.jsonl,.codex-global-state.jsonSymptom:
Concrete local evidence:
state_5.sqliteintegrity check returnsok.session_index.jsonl, and their rollout paths point to existing files under~/.codex/sessions/....Global/sidebar state observations:
electron-saved-workspace-rootsincluded both project roots:project-orderincludedadvisorybut did not includeflex.thread-workspace-root-hintshad no entries for eitheradvisoryorflex; it mostly contained projectless~/Documents/Codexmappings.Attempted local mitigation:
.codex-global-state.json./Users/rajesh/flextract/src/flextoproject-order.thread-workspace-root-hintsfor 41 activeadvisory/flexthread IDs from SQLite.This looks like the same broader failure class: SQLite/session/index data exists, archive state is correct, but the Desktop sidebar project view is applying another stale/incomplete filter or source of truth and hiding valid local project threads.
One more important signal from my case: the same chats are visible in the mobile app, but not in Codex Desktop. So the data is not lost; this appears to be a Desktop sidebar/recent-conversations loading issue.
Desktop seems to load/group only the first 50 recent conversations. For users with many local chats, older project chats disappear from the visible sidebar and projects show “No chats”, even though the threads still exist locally.
Impact: this looks like lost chat history. In my case I need at least 200 visible/recent chats, or proper pagination/per-project loading so projects do not appear empty just because their chats are outside the first 50.
Please increase the Desktop recent conversation cap substantially, or load project conversations independently from the initial recent-conversations page.
Adding another data point, this time from Windows, because it looks like the same user-visible failure mode but with a more specific local-state clue.
Environment:
OpenAI.Codex 26.513.4821.0Microsoft Windows 11 Pro 10.0.26200, 64-bit%USERPROFILE%\.codex\state_5.sqlitecodex --versionon PATH:codex-cli 0.130.0Observed behavior:
session_index.jsonl/ rollout JSONL files.state_5.sqlitewitharchived = 0.Important DB difference found locally:
source = 'vscode',archived = 0, andthread_source IS NULL.source = 'vscode',archived = 0, andthread_source = 'user'.92unarchived Desktop rows withthread_source IS NULL.PRAGMA integrity_checkreturnedok.Local repair that restored visibility:
After that update, the hidden project thread appeared again in local enumeration, and the count of unarchived Desktop rows with null
thread_sourcewent from92to0.Hypothesis:
There may be a migration or sidebar filtering path that treats older Desktop-created rows with
thread_source IS NULLas non-user/non-sidebar threads, while newer Desktop-created rows correctly getthread_source = 'user'. This makes existing local history look deleted even though the DB and rollout files still contain it.Suggested fix area:
source = 'vscode'andthread_source IS NULL, or migrate those rows tothread_source = 'user'.This comment intentionally avoids naming the user’s private project/thread details; the key reproducible signal is the
thread_sourcedifference above.Adding another macOS data point. This looks like the same broad Desktop sidebar/project visibility failure class, but with one extra reconciliation detail that may help narrow the bug.
Environment:
26.513.3131326.4.1, arm64~/.codex/state_5.sqlite~/.codex/.codex-global-state.json~/.codex/session_index.jsonl~/.codex/sessions/.../rollout-*.jsonlObserved behavior:
threads.cwdinstate_5.sqliteand repairing.codex-global-state.jsonwas not enough. After restart, Desktop would reintroduce stale project/workspace state.Additional local finding:
thread/listand usesession_meta.payload.cwdas a metadata repair source.session_meta.payload.cwd.Local repair that finally restored the project sidebar:
state_5.sqlite.codex-global-state.jsonrollout-*.jsonlsession_meta.payload.cwdin the affected rollout JSONL.threads.cwdrows instate_5.sqlite..codex-global-state.jsonproject roots / labels / thread workspace hints.After the rollout JSONL
cwdwas aligned with the DB/global state, the missing project conversations reappeared.Hypothesis:
There may be a startup/sidebar reconciliation issue where rollout JSONL, SQLite thread metadata, and Desktop global sidebar state disagree. If rollout JSONL is treated as an authoritative repair source, stale
session_meta.payload.cwdvalues can override corrected SQLite/global state and make valid local project threads appear missing or grouped under the wrong/empty project.Suggested fix area:
threads.cwd/ sidebar state from stale rollout JSONL.If the missing threads still exist in
state_5.sqlite/ rollout JSONL files, one thing worth checking is whether the local history is split across differentmodel_providerbuckets.I maintain an unofficial helper for that specific case: https://github.com/Wangnov/codex-threadripper
Start with the read-only diagnostic first:
If it shows threads split across providers,
codex-threadripper synccan reconcile the local metadata so Codex Desktop /codex resume/ app-server clients see the same history again. It writes backups before changing local state, but I would still back up~/.codexfirst.Caveat: this only targets provider-bucket visibility drift. If the root cause is sidebar cache/state, workspace path normalization, or encrypted-content ownership across accounts, it may not fix the underlying issue.
Thanks for the suggestion. I checked my local
state_5.sqliteand the first lines of the rollout JSONL files, and all threads are currently undermodel_provider = openai, with no provider-bucket mismatch found.So this specific case does not look like provider visibility drift, but the diagnostic idea was helpful. In my case the remaining suspect still seems to be cwd/sidebar/project state reconciliation between rollout JSONL, SQLite, and global state.
Additional Windows data point with a very consistent ~7-day visibility window.
Environment:
26.519.5221.010.0.19045.0x64%USERPROFILE%\.codex\state_5.sqlite%APPDATA%\CodexObserved:
session_index.jsonlandthread-workspace-root-hintsfrom the DB succeeds, but the Desktop UI still hides conversations older than the recent window.Local diagnostic counts from
state_5.sqlite:9089updated_at < now - 7 days:43updated_at:2026-04-17 00:18:37 UTCupdated_at:2026-05-25 09:16:25 UTCA temporary workaround that changes older threads'
updated_atvalues into a syntheticnow - 6 dayswindow makes the conversations visible again, but they begin falling out of the sidebar again the next day. That strongly suggests the Desktop sidebar, or the app-server path feeding it, is applying a sliding recency filter/window rather than losing the underlying data.Expected:
updated_atis outside a recent time window.I am intentionally omitting exact workspace paths and conversation contents here, but can provide more redacted diagnostics if useful.