Codex Desktop hides active local threads from sidebar/search while state_5.sqlite still marks them unarchived
Summary
Codex Desktop appears to hide some active local threads from the left sidebar and sidebar search even though they still exist locally and are not archived.
This does not look like data loss. The affected threads remain present in the local state database and their rollout files still exist, but the Desktop UI no longer provides a reliable way to discover or continue them from the sidebar.
Environment
- Codex Desktop: 26.602.71036
- Codex CLI: 0.137.0-alpha.4
- Platform: macOS
- Local threads / desktop app usage
- Affected threads include project-backed threads, projectless threads, and worktree-backed threads
What I observed
For affected thread IDs:
~/.codex/state_5.sqlitecontains the thread rowsthreads.archived = 0threads.archived_at IS NULLthreads.source = vscodethreads.rollout_pathpoints to existing session JSONL files- Some affected thread names are still present in
~/.codex/session_index.jsonl - Reading/resuming by direct thread ID still works
- The threads are missing from the Codex Desktop left sidebar
- Sidebar search does not find some of the affected threads by title or ID
The affected threads seem to fall into multiple categories:
- Threads whose
cwdis under a project/workspace root but are older than the recent sidebar window. - Threads whose
cwdis a worktree path that is no longer present inelectron-saved-workspace-roots/project-order. - Threads whose
cwduses a path that differs from a saved workspace root by path spelling/casing, for example a canonical project root vs another similarly named root. - Projectless or Codex-managed threads that exist locally but are not reliably discoverable through the sidebar.
Relevant local state fields
The following fields appear related to sidebar visibility / grouping:
electron-saved-workspace-rootsactive-workspace-rootsproject-orderprojectless-thread-idspinned-thread-idsthread-workspace-root-hintsthread-projectless-output-directories
The app bundle also appears to reference newer sidebar/project metadata fields such as:
thread-project-assignmentssidebar-project-thread-orderssidebar-thread-metadatasidebar-chat-thread-orderlocal-projectsproject-writable-roots
However, it is not clear which of these are authoritative, derived, stale, or safe for users/tools to inspect.
Expected behavior
Active, unarchived local threads should remain discoverable and resumable from the Desktop UI, either through:
- the relevant project sidebar,
- a full chronological/all threads view,
- sidebar search,
- or an official local thread management UI.
Search should include all persisted local threads, not only the currently loaded recent sidebar subset.
Project/worktree grouping should not make active threads effectively disappear.
Actual behavior
Some active, unarchived local threads are hidden from the sidebar and sidebar search. The only reliable way to access them is by knowing the thread ID in advance and using a direct thread read/resume path or deep link.
This makes long-term local thread management difficult because the Desktop sidebar cannot be treated as the source of truth for active conversations.
Questions
Could the Codex team clarify the intended model for local thread management?
- Is the Desktop sidebar expected to show all active local threads, or only a recent subset?
- Is there an official command/API to rebuild or refresh the local sidebar/search index?
- Is
state_5.sqlite.threadsthe supported source of truth for local active threads? - Is
session_index.jsonlauthoritative, derived, or cache-only? - Is there an official way to list all active local threads across projects, projectless chats, and worktrees?
- What is the recommended recovery path when a thread is active and unarchived locally but hidden from the sidebar?
- How should worktree-backed threads be associated back to their owning project?
- Are tools expected to use
app-server thread/list/thread/readfor full local thread management, and if so, is that API stable enough for user-facing thread dashboards?
Related issues
This seems related to several existing reports:
- #10522
- #14751
- #20254
- #20833
- #21128
- #22592
- #23979
- #25084
- #25119
The common theme is that local thread data remains present and unarchived, but Desktop sidebar/search visibility diverges from the local state database.
Suggested improvement
A robust fix could include:
- Full pagination by project/workspace root, not only a global recent-thread window.
- Sidebar search over all persisted local threads.
- A supported "rebuild local thread index" command.
- A documented source of truth for local threads and sidebar metadata.
- A first-party "All Local Threads" view with filters for active/archived/project/worktree/projectless.
- Stable deep links for every local thread.
19 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I reviewed the potential duplicates suggested by the bot.
The closest related issues seem to be #25761, #26157, and #26647:
This issue is probably in the same family, but I would like to keep the additional question visible unless maintainers prefer a specific canonical issue:
What is the supported way for users/tools to manage and recover all active local Codex threads when the Desktop sidebar/search is not a complete source of truth?
In my case the affected threads span:
archived=0rows instate_5.sqlite,I am happy to close this as a duplicate if the team identifies a canonical tracking issue, but it would be very helpful to know whether users should rely on
state_5.sqlite,session_index.jsonl,app-server thread/list,codex://threads/<id>, or some other supported mechanism for full local thread discovery and recovery.Additional fresh reproduction on macOS, with private project names/paths redacted.
Environment:
26.602.71036(CFBundleVersion 3685)com.openai.codexcodex-cli 0.130.0Observed local state:
~/.codex/state_5.sqlitecontains177unarchived local threads.141of those unarchived threads havecwdmatching saved project roots.33are date-stamped/projectless local chats.3are other unarchived local threads.electron-saved-workspace-rootscontains16saved roots.Current sidebar behaviour:
thread-project-assignments,thread-workspace-root-hints,projectless-thread-ids,session_index.jsonl), every non-empty project can be made to show at least some chats.50rows currently loaded by the sidebar, there are47saved-project threads and only3projectless chats, even though the local DB has33projectless chats in total.Renderer/app bundle evidence on this install:
Update after local unsupported patch test:
limit:50tolimit:500, repackedapp.asar, reinstalled the matchingapp.asar.unpacked, and locally re-signed the app.listRecentThreads({limit:500,cursor:this.nextRecentConversationCursor})listRecentThreads({limit:500*this.recentConversationPageCount,cursor:null})This strongly confirms the issue is the hardcoded recent-thread hydration window, not local data loss. The app-bundle patch is only a local workaround and will likely be overwritten by future Codex updates.
Impact:
Requested fixes:
Same for me, but one difference: Using search within Codex Desktop still finds results in at least some of the disappeared chats. They are indeed still there, they're just not listed anymore under the projects in the UI. Clicking a search result results in an empty chat window, so we still have no way to access these old chats. Hoping for a fix soon..
in case you're looking for a quick fix, That what my codex does after every update:
Patch
/Applications/Codex.app/Contents/Resources/app.asar: replace the single byte stringlet t=await this.listRecentThreads({limit:50*this.recentConversationPageCount,cursor:null});with same-lengthlet t={data:await this.listAllThreads({modelProviders:null,archived:!1}),nextCursor:null};, after backing up the original ASAR.Then fully quit and reopen Codex.
Thanks. You're a life saver.
Adding a macOS datapoint after updating to the latest Desktop build.
Environment:
~/.codexRecovery status on my affected project:
state_5.sqlitestill has 251 active/non-archived rows with the expected project cwd.~/.codex/sessions.So my current result is: 26.608.12217 looks like a partial recovery, not a full recovery. It would still be very helpful to have an official full local reindex/recovery command that rebuilds sidebar/project history from durable local state.
I built a small open-source helper for this: https://github.com/zjy365/codex-recall
It runs on localhost, searches local Codex sessions under
~/.codex, and has an experimental “restore to sidebar” action for one selected thread, with a backup first.If anyone here tries it, I’d be interested to know: is the bigger need finding hidden sessions, or restoring one back into Desktop?
Hi, seems like this snippet is no longer in the latest version of Codex app.asar. Could you confirm?
I can reproduce this on macOS, including with recently active threads.
Environment
Observed behavior
A recently active, project-backed thread disappeared from both the Desktop
sidebar and sidebar search.
However:
This indicates a sidebar/indexing failure rather than session deletion or an
invalid workspace association.
Additional evidence
I compared persisted thread metadata with the Desktop listing:
the audit.
A collapsed project group could explain some omissions, but not all affected
threads.
Suspected failure modes
Impact
A running agent can disappear from the supervision UI while continuing to
work. The user cannot reliably inspect, steer, stop, or collect its result
without already knowing its thread ID.
Requested improvements
I submitted in-app feedback containing the private session details.
Feedback/session ID:
019eb8a7-687e-73f3-9225-7886685edd86I can reproduce a very similar issue in the VS Code Codex extension on Windows.
Environment:
Observed behavior:
Local evidence:
state_5.sqliteunderthreads.active.Classification from my local metadata-only investigation:
EXACT_SESSION_CORRELATED_UI_MISSINGThis seems to match the pattern described in this issue: local Codex thread/session state remains present, but the VS Code/Codex UI no longer reliably hydrates or exposes the task in Tasks/history after restart.
For curr version:
I found that the current desktop bundle already has a feature-gated higher recent-thread discovery limit:
As a local workaround, I patched the first
&&to||in/Applications/Codex.app/Contents/Resources/app.asar:This forces
getRecentConversationDiscoveryLimit()to return500instead of50in normal runtime, sincee != nullis true. After restarting the app, more recent unarchived threads became discoverable again.This is only a local byte patch workaround and will be overwritten by app updates.
---
Update: my first workaround was not sticky enough.
The bundle already has a hidden/feature-gated recent-thread discovery limit:
I first patched the first
&&to||to force the limit to500:That helps initially, but after the app runs for a while, threads can disappear again. The reason seems to be that routine refresh can still avoid the expanded-history path and the expanded path also slices the active recent conversation ids back to 50:
The more stable local workaround was to patch those too:
and:
So the full current workaround is:
This keeps the recent-thread discovery limit at 500 and prevents routine refresh from collapsing the visible/recent thread ids back to 50.
This is still only a local byte-patch workaround for
/Applications/Codex.app/Contents/Resources/app.asar; it gets overwritten by app updates. I backed up the original ASAR before patching and restarted the app afterwards.Fresh Windows / VS Code reproduction with a narrower app-server discrepancy.
Environment:
26.707.715241.128.1(5264f2156cbcd7aea5fd004d29eaa10209155d66, x64)0.144.3codex_vscode/0.144.210.0.26200, x64Observed:
state_5.sqlitestill contained the row witharchived = 0, the correct projectcwd, title, preview, andthread_source = user.session_index.jsonlcontained the thread name.thread/readsucceeded and returned the expected thread withstatus.type = notLoaded.App-server reproduction using the same local Codex home:
thread/listwitharchived:false,limit:100,sortKey:updated_at, anduseStateDbOnly:falsereturned 31 threads and omitted the affected ID.useStateDbOnly:truereturned 32 threads and included the affected ID.thread/searchthen found the affected thread by its saved title.Recovery attempt also exposed an archive/index inconsistency:
codex archive <id>reported success.codex unarchive <id>returnedError: failed to unarchive session.sessions/, no archived copy remained, and the session-index row was present again.This looks like divergence between the normal filesystem/merged listing path and the state-database-only listing path, rather than data loss or a project-root mismatch. It would be helpful if the standard IDE list path converged with state DB results for valid unarchived threads, and if archive/unarchive were atomic or returned the actual final state. A supported sidebar reindex/rebuild command would also make recovery much safer.
Private repository names, paths, prompts, and the local thread ID are intentionally omitted.
Follow-up after a broader read-only inventory and rollback of all local workaround experiments. All identifiers, names, prompts, repository details, paths, and account information are omitted.
Data-loss check
Normal list vs state-database list
Using the bundled VS Code app-server against the same Codex home:
thread/listwitharchived:false,limit:100,sortKey:updated_at, anduseStateDbOnly:falsereturned 31 active threads.useStateDbOnly:truereturned 33 active threads.The full-history fork received a fresh ID and fresh rollout path, but the normal listing path omitted it exactly like the original. This indicates that the failure follows the copied transcript/history shape rather than the original thread ID, title, project assignment, or rollout filename.
Exact-read and empty-view evidence
thread/readwithincludeTurns:truesucceeded for both the original and the fork:Despite those successful exact reads, the UI displayed the recovery fork as if its prior conversation were empty. So there are at least two related failure surfaces:
thread/listcan omit valid active threads that the state-database path returns.A separate active thread with 53 turns and 976 hydrated items was returned by both normal and state-database list paths, yet the user also could not locate it in the VS Code/Desktop history UI. This suggests an additional sidebar cache/grouping/pagination layer can hide threads even when app-server listing succeeds.
Extension implementation clue
The installed VS Code extension bundle initializes its local manager with
supportsStateDbOnlyThreadList:false, while the bundled app-server successfully servesuseStateDbOnly:true. This may explain why the IDE remains on the divergent merged/filesystem listing path even when the state database has a complete valid record.Recovery safety
Archive/unarchive and UI-state experiments were fully rolled back. The original extension asset and global-state file were restored byte-for-byte from backups. The findings above were then reproduced using read-only database queries and app-server read/list/search requests.
Requested fixes:
Additional crash/recovery finding (sanitized; no project, repository, path, session, account, or custom-skill names included):
Crash symptom
The VS Code Codex integration reported
Codex process is not availableduring startup. The process log contained three errors saying localSKILL.mdfiles were missing YAML frontmatter delimited by---, even though each file visibly contained valid frontmatter.Root cause
Byte-level inspection showed that each affected UTF-8 file began with a byte-order mark (
EF BB BF) immediately before the opening---. The skill loader did not tolerate the UTF-8 BOM and therefore treated the frontmatter as absent.Recovery proof
Requested hardening
UTF-8 BOM before frontmatterdiagnostic rather thanmissing YAML frontmatter.This startup crash appears distinct from the thread-list/hydration defect above, but it occurred during the same degraded client episode and made the affected Codex surface completely unavailable until the local files were repaired.
Further sanitized cross-client inventory after the user observed mutually inconsistent sidebars (no titles, IDs, prompts, paths, repository details, or account information included):
Cross-client split is reproducible
A read-only inventory found 34 active user-root records in the durable state database. All 34 still have matching, non-empty rollout files.
Against the same Codex home and bundled app-server:
thread/list: 31 active user-facing threads.useStateDbOnly:true: 33 active user-facing threads.thread/readby exact ID succeeds for it (1 turn / 22 hydrated items).The two installed clients then diverge again above the app-server layer: one thread returned by both backend list modes appears only in the IDE sidebar, while a state-only recovery thread appears only in Desktop. This demonstrates that client-side filtering/grouping/cache behavior is independently suppressing different members of the backend result set.
Transcript integrity sweep
All 34 active user-root rollout files were parsed read-only:
The malformed record belongs to the thread that appears only in the IDE:
compactedrecord amid thousands of otherwise intact records.thread/read(includeTurns:true)does not return a result or a clean error within a bounded 75-second check.This adds a third distinct failure class to the earlier report:
Requested additional hardening:
Sanitized local recovery result (no titles, IDs, prompts, paths, repositories, or account information included):
A backup-first repair was tested against an isolated cloned Codex home and then applied locally.
Corrupted compaction recovery
thread/read(includeTurns:true)changed from hanging beyond 75 seconds to completing immediately with 55 turns and 999 hydrated items.Empty-preview filtering recovery
A separate intact root thread had an attachment-based initial request but empty
first_user_messageandpreviewdatabase fields. It was omitted by both list modes despite exact read succeeding. In the cloned database, restoring those two preview fields from the existing thread title causeduseStateDbOnly:trueto return it. The same metadata-only repair was then applied live.Final backend verification
Client workaround
The installed IDE bundle initializes its local manager with
supportsStateDbOnlyThreadList:false. A one-byte, backup-preserved local patch changes that flag to true; the asset passes JavaScript syntax validation. After client reload, the IDE should consume the same complete 34-thread state-database inventory as Desktop.This is only a local workaround and will be overwritten by an extension update. The product fix should enable the complete canonical listing path by default, backfill missing preview fields for attachment-originated conversations, and recover malformed compaction records without requiring byte-level user intervention.
Correction and final findings from a deeper client-level investigation (all identifiers and workspace details omitted):
The earlier metadata-only workaround was insufficient and should not be considered a UI fix.
I found several independent failure modes:
Recovery actions were performed only after consistent backups:
Direct UI verification now completed:
The local VS Code bundle patch is only a diagnostic workaround and may be overwritten by an extension update. The product-level fixes should make the state-backed list behavior consistent across clients, make catalog rebuilds resilient to remote-host failures, avoid stale projectless assignments overriding valid catalog data, and surface rollout corruption instead of silently omitting history.
Reproduced on macOS with ChatGPT/Codex desktop app 26.715.21425 (build 5488), local projects only. After update, project cards remain but task lists are empty; unfiltered default listing returns only 2 tasks. Data is intact: 128 local session transcripts remain; direct read/resume succeeds; targeted project-keyword search returns older tasks as
notLoaded; navigation/resume does not repopulate the project/sidebar index. Project directories and permissions are intact. I did not clear cache, log out, uninstall, delete data, or edit session/index files. This comment intentionally omits account identifiers, project names, local paths, task contents, and logs. Expected: active local tasks remain discoverable in their project sidebar, or a supported non-destructive rebuild-index action is available.