Repository navigation
Description
What version of the Codex App are you using (From “About Codex” dialog)?
- Codex Desktop (MSIX):
26.924.1866.0(x64) - Desktop runtime release recorded in logs:
26.924.20706 - Bundled app-server / CLI runtime:
0.158.0-alpha.2 - Last known-good build on the same machine:
26.917.71314
What subscription do you have?
No ChatGPT subscription, and the app is not signed in to ChatGPT. Codex Desktop is configured against a third-party provider with an API key (key redacted):
model_provider = "custom"
[model_providers.custom]
name = "<third-party provider>"
base_url = "https://<provider-host>"
wire_api = "responses"
requires_openai_auth = false
# experimental_bearer_token = <redacted>codex doctor reports auth OpenAI auth is not required for the active model provider, and no auth.json exists in CODEX_HOME.
What platform is your computer?
10.0.19045 x64 (Windows 10 Pro 22H2)
What issue are you seeing?
Clicking Archive on an existing local conversation (sidebar / Recent tasks menu) shows this toast, and the conversation is never archived:
Could not determine the account for worktree cleanup.
The conversation stays in the active list and never appears in Archived chats. The failure happens before any thread/archive request is sent - the desktop log shows the archive intent with no follow-up RPC:
info [electron-message-handler] Archive requested conversationId=<ID-A> ... source=recent_tasks_menu
<toast: Could not determine the account for worktree cleanup.>
<- no `method=thread/archive` for <ID-A>
info [electron-message-handler] Archive requested conversationId=<ID-B> ... source=recent_tasks_menu
info [AppServerConnection] response_routed ... conversationId=<ID-B> ... method=thread/archive ... errorCode=null
<- the only archive attempt on this build that reached app-server
Triggering the same archive action through the app itself (not the UI button) also returns success=false with the same message and emits no RPC.
What steps can reproduce the bug?
- Codex Desktop on Windows with a third-party provider, and not signed in to ChatGPT (
requires_openai_auth = false, noauth.json). - Right-click an older local conversation, then Archive.
- The toast
Could not determine the account for worktree cleanup.appears; the conversation stays in the active list.
Archive requested vs actual method=thread/archive emissions in all local desktop logs (deduplicated per log file by conversation id):
| desktop release | date | Archive requested |
thread/archive emitted |
|---|---|---|---|
| 26.908.40834 | 2026-09-12 | 4 | 4 |
| 26.915.31945 | 2026-09-19 | 8 | 8 |
| 26.917.71314 | 2026-09-25 .. 2026-09-26 00:49 | 6 | 6 |
| 26.924.20706 | 2026-09-26 | 13 | 1 |
Failing examples: <ID-A> (cwd D:\<workspace>\here), <ID-C> (cwd D:\<workspace>\test). The only success was <ID-B> (cwd D:\<workspace>\nai-prompt-assistant).
What is the expected behavior?
Archiving a local conversation from the desktop UI should succeed. When the active provider does not require OpenAI auth, archiving should not depend on a ChatGPT account being resolvable.
Additional information
This does not look like an auth-state change: the app-server log DB covers 2026-09-18 .. 2026-09-26 and contains no login/logout events, and the remote control requires ChatGPT authentication startup warnings appear in bursts both in sessions where archiving worked (2026-09-25 16:16-16:45, 2026-09-26 00:44-00:57) and in the failing session (2026-09-26 13:00+).
Duplicate check: searching the exact string Could not determine the account for worktree cleanup. (this repository and GitHub issues generally) returns no results, so this appears unreported.
Activity
baoyu0xxx commentedon Sep 26, 2026
I ve meet the same question
Additional local investigation points to the desktop app's managed-worktree cleanup path.
In the installed
app.asar,getManagedWorktreeCleanup(cwd)has an early branch that returnstruefor a local desktop runtime when the app-server supportsthreadAttachments. This happens before the function checks whethercwdis actually under a managed worktree root. Consequently, an ordinary local workspace can be treated as requiring managed-worktree cleanup.That leads the archive path through
prepareThreadArchive, whose account lookup throwsCould not determine the account for worktree cleanup.when no ChatGPT account is signed in. The error occurs beforethread/archiveis sent, consistent with the logs in the issue.I reproduced the same error through the app's
set_thread_archivedaction after restarting the official app. The example thread remains unarchived (archived = 0), and its rollout file still exists. In a separate test with the desktop app fully closed, the bundledcodex-cli 0.158.0-alpha.2was able to archive a local test thread, which further narrows the failure to the desktop archive path.It may be worth checking whether the
threadAttachmentsbranch should request cleanup for every local thread, and how account-free local providers should handle that cleanup.Liuu101 commentedon Sep 26, 2026
Same failure here, on a later build of the same release train, so the regression is still present:
requires_openai_auth = false
Observed behaviour matches the report exactly:
"info [electron-message-handler] Archive requested conversationId= ... source=sidebar_context_menu"
followed only by "thread_stream_view_activity_changed active=false" - no "method=thread/archive" line at all.
while successful archives from 2026-09-24/25 are present there, which dates the regression to the 26.924 build.
The CLI escape hatch does not work on an app-bundled CLI either:
codex archive -> "Error: failed to archive session" (also for a non-existent UUID, so it may be
"no daemon" rather than a real archive attempt)
codex app-server daemon start -> "Error: this CLI has no complete local package; install a packaged Codex CLI
or use the standalone installer"
Your code-level analysis is confirmed in the installed app.asar of 26.924.2738.0 as well:
getManagedWorktreeCleanup(cwd) returns true early for a local desktop runtime when the app-server supports
threadAttachments, before checking whether cwd is actually under a managed worktree root, and prepareThreadArchive()
then throws "Could not determine the account for worktree cleanup." because the account is null for hostId = "local".
The throw happens before any thread/archive request is sent, which is why nothing is logged and the UI only shows
the "Failed to archive chat" toast.
aquariuslt commentedon Sep 26, 2026
Also reproduces on macOS, including with ChatGPT signed in.
codex login statusreportsLogged in using ChatGPT, but the active model provider is a custom provider with its own auth command, andrequires_openai_authis not setProvider config (redacted):
Archiving fails from both the sidebar (
source=recent_tasks_menu) and the app's archive tool (source=dynamic_tool), and the tool returnsCould not determine the account for worktree cleanup.The affected threads are ordinary local threads, not managed worktrees. Desktop log counts:Archive requestedthread/archivesentSo the failure is not limited to users signed out of ChatGPT. With ChatGPT auth present but a custom provider active, the account lookup in
prepareThreadArchivestill resolves to null.EVERGRANDE-2018 commentedon Sep 27, 2026
Same issue here after the latest update on Windows. Archiving fails for every conversation I try, rather than just one particular thread.
Environment:
OpenAI.Codex_26.924.2738.0_x6426.924.221380.158.0-alpha.2.1requires_openai_auth = falsecodex login statusreportsNot logged inThe UI only shows “Failed to archive chat” (localized as “无法归档对话”). Local log inspection shows the archive action being requested, but no corresponding
thread/archiveRPC.Inspection of the installed desktop code is consistent with the analysis above:
getManagedWorktreeCleanupreturnstruefor the local desktop runtime whenthreadAttachmentsis supported, before checking whether the conversation actually uses a managed worktree.prepareThreadArchive, where account resolution can fail withCould not determine the account for worktree cleanup.My understanding is that local conversation archiving has become dependent on an account lookup intended for managed-worktree cleanup. For an ordinary local conversation using a custom provider, that seems like an unnecessary dependency.
I would expect archiving a local conversation to remain available without ChatGPT authentication. Could the cleanup prerequisite be limited to conversations that actually have a managed worktree requiring it? For those that do need cleanup, it would also help to distinguish cleanup failure from archive failure and show an actionable error.
The macOS report above, where ChatGPT is already signed in, also suggests that requiring users to sign in would not fully address this regression. The account-resolution behavior with custom providers seems worth checking as well.
going358 commentedon Sep 27, 2026
Confirming on 26.924.22138 (build 11645) as well, with one additional data point that may help localise this.
Environment:
OpenAI.Codex_26.924.2738.0, prod channelauth.jsoncontains only{"auth_mode":"apikey"}codex doctor:auth - OpenAI auth is not required for the active model providerThe failure is not uniform across threads, and the reason is visible in the shipped
app.asar:prepareThreadArchive()- and therefore the account lookup that throwsCould not determine the account for worktree cleanup.- is only entered whencleanupWorktreeis true. On this machine:thread/archiveRPC is emitted (same as reported above);So the trigger is "a thread that requires worktree cleanup", not "any thread" - consistent with
getManagedWorktreeCleanup()returningtruefor ordinary local conversations before it checks whether the cwd is actually a managed worktree (see the earlier analysis in this thread).Note that
#i()in the same bundle does contain an API-key fallback (getAuthMethod() === "apikey"), but it does not appear to be reached on this install.Workaround that works today:
codex archive <SESSION_ID>from the bundled CLI archives these conversations successfully (verified on several). One caveat: if the desktop app currently holds the rollout file open for that thread, the CLI returnsError: failed to archive sessionuntil the thread is unloaded or the app is restarted.ActiveSky commentedon Sep 27, 2026
Independent confirmation on another Windows machine. I encountered this on September 26, 2026, while archiving ordinary local conversations from the Recent tasks menu.
Environment
10.0.26200, x64.OpenAI.Codex_26.924.2738.0_x64.26.924.22138.codex-cli 0.158.0-alpha.2.1.model_provider = "custom"andrequires_openai_auth = false.codex login statusreportsNot logged in; noauth.jsonexists inCODEX_HOME.Steps to reproduce
Actual behavior
Failed to archive conversation.set_thread_archivedaction also fails and returns the more specific error:method=thread/archiverequest:archived = 0, and their referenced rollout files exist. Thearchived_sessionsdirectory also exists.PRAGMA quick_checkonstate_5.sqlitereturnsok.Expected behavior
Archiving an ordinary local conversation should succeed when the active custom provider does not require OpenAI authentication. An account lookup for managed-worktree cleanup should not block archiving a conversation that has no managed worktree to clean up.
Additional diagnostic evidence
Inspection of the installed desktop code matches the analysis already posted here:
getManagedWorktreeCleanup(cwd)returnstruefor a desktop runtime supportingthreadAttachmentsbefore checking whether the directory is a managed worktree. The archive flow then callsprepareThreadArchive(), which throws the account-resolution error before sendingthread/archive.The CLI workaround has not been tested on this machine. No database rows, rollout files, or provider settings were manually modified during diagnosis. Personal paths, conversation IDs, API endpoints, and credentials are omitted from this report.
thesobercoder commentedon Sep 27, 2026
Same bug on macOS, so it is not Windows-only.
thread/archivecalls in the logs. Before this update, archiving worked without signing in (thread/archivecalls succeeded on 2026-09-22).set_thread_archivedcall returns:Could not determine the account for worktree cleanup.sa_server_request_failed errorMessage="Workspace routing is unavailable"cczxuan commentedon Sep 28, 2026
Adding a measurement that pinpoints why the API-key fallback inside
#i()(noted earlier in this thread) is never reached, plus a config-level workaround that restores archiving on this build.Environment
OpenAI.Codex_26.924.2738.0_x64, desktop build26.924.22138, prod channel, reported as up to date0.158.0-alpha.2.110.0.26200model_provider = "deepseek",base_url = "https://<provider-host>",wire_api = "responses",experimental_bearer_token = "<redacted>"codex login statusreportsLogged in using an API key, andCODEX_HOME/auth.jsoncontains onlyOPENAI_API_KEYSo unlike the original report, an OpenAI API key is present here, and archiving still fails for every local thread. The app-level
set_thread_archivedcall returnsCould not determine the account for worktree cleanup., the thread staysarchived = 0, and nomethod=thread/archiveline is emitted - same signature as the reports above.Why the
apikeyfallback is unreachable in this stateA fresh, read-only app-server process using the same configuration returns:
getAuthStatus().authMethodisnull, not"apikey"and not"apiKey". InprepareThreadArchivethe lookup is:and
#i()ends withthis.#t = await e.getAuthMethod() === "apikey" ? "apikey" : null, so anullauth method resolves to no owner and the throw happens before anythread/archiverequest is sent.The important part: this
nullis produced by the active provider being a non-OpenAI one, not by missing credentials. An API key can be present inauth.jsonand the app-server will still reportauthMethod: nullwhile a third-party provider is selected. That also explains the macOS report where ChatGPT is signed in but the archive still fails.(The early
return trueingetManagedWorktreeCleanup()is what makes this path reachable for ordinary local threads that have no managed worktree, as analysed above.)Workaround: let the provider declare that it needs OpenAI auth
Adding
requires_openai_auth = trueto the third-party provider block:makes the same probe return:
{"authMethod": "apikey", "authToken": null, "requiresOpenaiAuth": true}With that value the client resolves the
"apikey"owner instead ofnull, so the archive preflight has an account and does not throw, while requests still go to the third-party endpoint with its own bearer token. I verified the auth-status transition on a fresh app-server process; confirming the full UI archive requires an app restart, since the config is only read at startup.Two side observations
account/read/getAuthStatusalso report no workspace, so account-scoped features logsa_server_request_failed ... "Workspace routing is unavailable" ... status=432for/wham/tasks/list,/wham/usage,/settings/user. The archive failure is one symptom of that state; accounting for it in the archive path alone may not fix the others.codex archive <uuid>escape hatch suggested earlier does not work on this install: the bundled CLI exits withError: failed to archive session(exit code 1) for a valid, existing session id, and the app-server is reached over stdio rather than a local websocket, so there is no--remoteendpoint to point the CLI at.No local state was modified while diagnosing this (archive state and rollout files are unchanged).
atishpatel commentedon Sep 28, 2026
🤖 Still reproduces on the newest primary runtime, on macOS.
26.924.22138, primary runtime26.927.11222(auto-updated 2026-09-28), macOS 26.6 arm64env_keyauth,requires_openai_auth = false, not signed in to ChatGPT26.923.10815(thread/archivereturned about 100 ms afterArchive requested)Since the update, every archive from the Recent tasks menu logs
Archive requested … source=recent_tasks_menu, and nomethod=thread/archivefollows. This matches the analysis above.getManagedWorktreeCleanup()returnstrueearly for ordinary local threads, andprepareThreadArchive()then throws because#i()resolves no owner whengetAuthStatus.authMethodisnull. So the fix hasn't shipped as of26.927.11222.The failing threads here were started from the CLI (
codex-tui0.156.0), with a plain local directory ascwd(not a git repo and not a managed worktree).pinchuan54 commentedon Sep 29, 2026
I am seeing the same archive failure after updating Codex through the Microsoft Store on September 27, 2026.
Environment
10.0.22631)OpenAI.Codex_26.924.2738.0_x6426.924.22138/ build11645prodcodex-cli 0.158.0-alpha.2.1responsesrequires_openai_auth = falseexperimental_bearer_tokenis configured, but the value is intentionally redactedcodex login statusreports:Not logged inProblem
The problem started after the Microsoft Store update on September 27, 2026.
Archiving fails for both existing and newly created local conversations:
聊天归档未成功(Chat archive failed).The failure is still reproducible after completely restarting Codex.
Read-only inspection shows that the local state database passes:
aquariuslt commentedon Sep 29, 2026
Follow-up to my macOS report above. Still reproduces on 26.924.22138 (build 11645), which is the current prod build as of 2026-09-29. Three findings that may help others hitting this:
requires_openai_auth = truedoes not work for providers that use[model_providers.<id>.auth]My custom provider gets its token from an auth command. With
requires_openai_auth = trueadded to that provider, the config no longer loads:The same override with
false, or an override of another field on the same provider, loads normally. I only tested this through-c; I did not write it toconfig.toml.The bundled CLI works on macOS, but the sidebar keeps a stale row
codex archive <thread-id>from the bundled CLI (0.158.0-alpha.2.1) archived all 19 local threads I tried while the app was running. I only ran it on threads that were not loaded in the app. Each thread was marked archived and its rollout moved toarchived_sessions/, but the sidebar kept showing it, even after restarting the app. Two actions removed the stale row:session <id> is archived. Run `codex unarchive <id>` to unarchive it first., and the row disappears. No restart needed.thread/archivereturnsno rollout found for thread id <id>, the app logsArchive skipped because thread has no active rollout, and the row disappears.Unarchive works from the app, but archiving the thread again does not
Through the app's
set_thread_archivedtool,archived: falsesucceeded (thread/unarchive, thenUnarchive succeededin the log). The followingarchived: truefailed withCould not determine the account for worktree cleanup.and sent nothread/archive. The thread stayed unarchived until I archived it again from the CLI.Related reports with the same failure: #48961 (macOS, ChatGPT signed in) and #49116 (Windows).
LGDoor commentedon Sep 29, 2026
Seeing the same archive failures
Environment
10.0.26200)26.924.22138(build11645)0.158.0-alpha.2.1codex login status:Not logged inObserved behavior
Archiving ordinary local project chats repeatedly shows “Failed to archive conversation.”
Logs show:
Archive requestedthread/attachment/listthread/archiverequestThis matches the reported cleanup account check blocking archival.
Expected behavior
Local chat archival should work without an OpenAI account identity when no managed-worktree cleanup is needed.
saidelike commentedon Sep 29, 2026
Confirmed workarounds
Getting the thread ID
The thread ID is the UUID after
/threads/:Local tasks
Codex Desktop must be fully exited first because its App Server holds an active writer for loaded threads.
Before exiting, wait for all active local tasks and commands to finish, or stop them explicitly. Exiting Desktop stops the local App Server and may interrupt local work that is still running.
After exiting Codex Desktop, run:
codex archive "<thread-id>"Example:
codex archive "01a0ec4c-67f5-7ac2-8e1b-201d5be1bbe3"Confirmed behavior:
Codex Desktop can then be reopened.
SSH-backed tasks
Run this directly on the remote host:
codex archive --remote unix:// "<thread-id>"Example:
codex archive --remote unix:// "01a0ec4c-67f5-7ac2-8e1b-201d5be1bbe3"This works while Codex Desktop remains open because the remote
app-server proxyexposes the live App Server through its default Unix socket.Underlying issue for developers
The original Codex Desktop failure occurs before the supported
thread/archiverequest is sent.Desktop performs an account-dependent worktree-cleanup preflight. When no ChatGPT account can be resolved, it fails with:
This also affects ordinary local tasks without managed worktrees, so the account/worktree-cleanup requirement appears to be applied too broadly.
There is also a transport and ownership difference between local and remote tasks:
codex archive --remote unix://connects to the same live remote App Server used by Desktop.codex archive "<thread-id>"succeeds.The expected Desktop behavior is:
thread/archivewithout requiring a ChatGPT account.These workarounds use Codex’s supported archive command and do not modify
state_5.sqlitedirectly.Reference: Official OpenAI CLI archive documentation
saidelike commentedon Sep 29, 2026
Hi @sinkaBot1 — based on the additional reproductions in the comments, could you update the title and issue description to make the bug more platform-generic?
The same
Could not determine the account for worktree cleanup.failure has now been reproduced on macOS with both local and SSH-backed tasks. The failure still occurs before Desktop sendsthread/archive, so it does not appear to be Windows-specific.Suggested title:
The original Windows/custom-provider environment can remain as the initial reproduction, but the summary, affected platforms, confirmed workarounds, and expected behavior could be broadened using the evidence from the above comments.
aquariuslt commentedon Sep 29, 2026
Follow-up to my earlier comment: I found a config change that makes in-app archive work again with a custom provider, without exiting Desktop or using the CLI.
The archive preflight needs an account. Setting
requires_openai_auth = trueon the custom provider gives it one, as long as Desktop is signed in with ChatGPT. Earlier I reported that this setting broke config loading. That only happens when the provider also has a[model_providers.<id>.auth]command block. Remove that block and put the provider key inexperimental_bearer_token.env_keyis ignored whenrequires_openai_authis on.I kept the provider id unchanged. Before restarting,
codex doctorshould reportauth.credentialsas configured with stored auth modechatgpt. Then restart Desktop.Verified on macOS, Desktop 26.924.22138 (build 11645): after the restart, archiving from the sidebar sends
thread/archiveand returnserrorCode=null.Could not determine the account for worktree cleanup.no longer appears in the log. Model requests still go to the custombase_urlwith the bearer token, and chats with tool calls keep working.Trade-offs: the provider key is stored in plaintext in
config.toml, so you have to update it there if you rotate the key. Desktop must also stay signed in with ChatGPT. This won't help users who can't or don't want to sign in, so the preflight itself still needs a fix.ttemple-shop commentedon Sep 29, 2026
Confirmed on another macOS installation on September 29, 2026.
Environment
26.924.22138(build11645)codex-cli 0.158.0-alpha.2.1requires_openai_authis not setcodex login status:Not logged inReproduction and result
This affected multiple conversations. A diagnostic retry through the built-in
set_thread_archivedtool returned the exact error:The tool returned
isError: true. A subsequent app-level conversation listing confirmed that the target was still unarchived. The tested conversation used an ordinary local directory, not a managed Git worktree.Desktop logs for the failed UI attempts show
Archive requestedand a successfulthread/attachment/list, but no correspondingthread/archiveresponse. Read-only inspection of the installed archive flow is consistent with the existing analysis: account-dependent cleanup preparation runs before the archive RPC, and the owner resolver has an API-key fallback but no fallback for a custom provider without OpenAI authentication.Expected behavior: archiving an ordinary local conversation should work with a custom provider without requiring a ChatGPT account for managed-worktree cleanup. The UI should also expose an actionable error if cleanup preparation fails.
Provider identity, endpoint, credentials, conversation identifiers, titles, and local paths are omitted.
HenryFone commentedon Sep 30, 2026
Same failure here - confirming it on another Windows machine, on the 26.924 train.
Environment:
codex login statusreportsNot logged in; no auth.jsonwire_api = "responses",requires_openai_auth = falseReproduction and observed behaviour:
Because this is a local-only setup with no ChatGPT sign-in, the account-dependent cleanup preflight leaves no workaround on my side. This matches the report in this issue exactly.
Not asking for the sign-in workaround - I just want archive to keep working for custom-provider users who are not signed in, as it did in 26.917.x. Happy to run any diagnostic build or share redacted logs if that helps.
chizkiyahu commentedon Sep 30, 2026
The bug was fixed in
26.928.21956.saidelike commentedon Sep 30, 2026
confirmed fixed for me too in:
aquariuslt commentedon Nov 6, 2026
Archiving works for me on macOS with
26.1029.61003. Thanks!