Skip to content

[Windows][26.924.20706] Archive fails before the thread/archive RPC with "Could not determine the account for worktree cleanup." when no ChatGPT account is signed in (custom provider) #48367

Open

Description

@sinkaBot1

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?

  1. Codex Desktop on Windows with a third-party provider, and not signed in to ChatGPT (requires_openai_auth = false, no auth.json).
  2. Right-click an older local conversation, then Archive.
  3. 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

  1. added
    bug
    app
    windows-os
    session
    auth
    custom-model
    on Sep 26, 2026
  2. baoyu0xxx commented on Sep 26, 2026

    @baoyu0xxx

    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 returns true for a local desktop runtime when the app-server supports threadAttachments. This happens before the function checks whether cwd is 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 throws Could not determine the account for worktree cleanup. when no ChatGPT account is signed in. The error occurs before thread/archive is sent, consistent with the logs in the issue.

    I reproduced the same error through the app's set_thread_archived action 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 bundled codex-cli 0.158.0-alpha.2 was able to archive a local test thread, which further narrows the failure to the desktop archive path.

    It may be worth checking whether the threadAttachments branch should request cleanup for every local thread, and how account-free local providers should handle that cleanup.

  3. Liuu101 commented on Sep 26, 2026

    @Liuu101

    Same failure here, on a later build of the same release train, so the regression is still present:

    • MSIX package: OpenAI.Codex_26.924.2738.0_x64 (desktop build 26.924.22138)
    • Bundled app-server / CLI: codex-cli 0.158.0-alpha.2.1
    • OS: Windows 11 ProfessionalWorkstation 10.0.26200
    • Auth: not signed in to ChatGPT, no auth.json, custom provider (DeepSeek) with
      requires_openai_auth = false
    • Last known-good build on the same machine: 26.917.9434.0 (last successful archive 2026-09-26 02:49 local)

    Observed behaviour matches the report exactly:

    1. Desktop log shows the archive intent but no RPC:
      "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.
    2. The app-server log DB (codex_core / codex_app_server) contains no thread/archive request for that thread,
      while successful archives from 2026-09-24/25 are present there, which dates the regression to the 26.924 build.
    3. state_5.sqlite keeps archived = 0 / archived_at = NULL for the target thread.
    4. Reproduced twice after a full restart, and also for a brand-new local chat (so it is not chat-specific).

    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.

  4. aquariuslt commented on Sep 26, 2026

    @aquariuslt

    Also reproduces on macOS, including with ChatGPT signed in.

    • Desktop: 26.924.22138 (build 11645), prod channel, currently up to date
    • Bundled app-server / CLI: codex-cli 0.158.0-alpha.2.1
    • OS: macOS 27.0 (26A428), arm64
    • Last known-good build: 26.917.71314 (last successful archive at 2026-09-26 06:30 UTC)
    • Auth: the bundled codex login status reports Logged in using ChatGPT, but the active model provider is a custom provider with its own auth command, and requires_openai_auth is not set

    Provider config (redacted):

    model_provider = "custom"
    
    [model_providers.custom]
    wire_api = "responses"
    
    [model_providers.custom.auth]
    command = "<redacted>"

    Archiving fails from both the sidebar (source=recent_tasks_menu) and the app's archive tool (source=dynamic_tool), and the tool returns Could not determine the account for worktree cleanup. The affected threads are ordinary local threads, not managed worktrees. Desktop log counts:

    Build Archive requested thread/archive sent
    26.917.71314 3 3
    26.924.22138 15 0

    So the failure is not limited to users signed out of ChatGPT. With ChatGPT auth present but a custom provider active, the account lookup in prepareThreadArchive still resolves to null.

  5. EVERGRANDE-2018 commented on Sep 27, 2026

    @EVERGRANDE-2018

    Same issue here after the latest update on Windows. Archiving fails for every conversation I try, rather than just one particular thread.

    Environment:

    • MSIX package: OpenAI.Codex_26.924.2738.0_x64
    • Desktop version: 26.924.22138
    • Bundled app-server / CLI: 0.158.0-alpha.2.1
    • Custom model provider with requires_openai_auth = false
    • Bundled codex login status reports Not logged in

    The UI only shows “Failed to archive chat” (localized as “无法归档对话”). Local log inspection shows the archive action being requested, but no corresponding thread/archive RPC.

    Inspection of the installed desktop code is consistent with the analysis above:

    • getManagedWorktreeCleanup returns true for the local desktop runtime when threadAttachments is supported, before checking whether the conversation actually uses a managed worktree.
    • The archive flow then enters prepareThreadArchive, where account resolution can fail with Could not determine the account for worktree cleanup.
    • That failure blocks the archive request before it reaches the backend.

    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.

  6. going358 commented on Sep 27, 2026

    @going358

    Confirming on 26.924.22138 (build 11645) as well, with one additional data point that may help localise this.

    Environment:

    • Codex desktop 26.924.22138 (build 11645), MSIX OpenAI.Codex_26.924.2738.0, prod channel
    • Bundled app-server / CLI 0.158.0-alpha.2.1
    • Windows 11 10.0.26200
    • Not signed in to ChatGPT; auth.json contains only {"auth_mode":"apikey"}
    • codex doctor: auth - OpenAI auth is not required for the active model provider
    • Last successful UI archive 2026-09-25 23:21 local; the regression appeared after the 2026-09-26 app update

    The failure is not uniform across threads, and the reason is visible in the shipped app.asar:

    async registerArchiveThread(e, t) {
      if (t.cleanupWorktree && t.cwd != null)
        return this.options.worktreeArchiveQueue?.prepare({ conversationId: e, cwd: t.cwd })
    }

    prepareThreadArchive() - and therefore the account lookup that throws Could not determine the account for worktree cleanup. - is only entered when cleanupWorktree is true. On this machine:

    • normal project conversations: archive fails and no thread/archive RPC is emitted (same as reported above);
    • subagent threads, which need no worktree cleanup: archiving still succeeds from the UI.

    So the trigger is "a thread that requires worktree cleanup", not "any thread" - consistent with getManagedWorktreeCleanup() returning true for 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 returns Error: failed to archive session until the thread is unloaded or the app is restarted.

  7. ActiveSky commented on Sep 27, 2026

    @ActiveSky

    Independent confirmation on another Windows machine. I encountered this on September 26, 2026, while archiving ordinary local conversations from the Recent tasks menu.

    Environment

    • OS: Windows 11 Enterprise, version 10.0.26200, x64.
    • Installation: Microsoft Store / MSIX, OpenAI.Codex_26.924.2738.0_x64.
    • Desktop runtime release recorded in logs: 26.924.22138.
    • Bundled app-server / CLI: codex-cli 0.158.0-alpha.2.1.
    • Active provider: a custom Responses-compatible API provider, with model_provider = "custom" and requires_openai_auth = false.
    • Authentication: the bundled codex login status reports Not logged in; no auth.json exists in CODEX_HOME.
    • Affected conversations belong to an ordinary local project checkout, rather than a conversation created in Worktree mode.

    Steps to reproduce

    1. Launch the desktop app with the configuration above.
    2. Open the Recent tasks menu for an existing local conversation and choose Archive.
    3. Observe the failure and repeat with another local conversation.

    Actual behavior

    • The UI shows Failed to archive conversation.
    • The conversations remain in the active list.
    • The app's set_thread_archived action also fails and returns the more specific error:
    Could not determine the account for worktree cleanup.
    
    • Desktop logs record the archive intent, but the affected attempts have no corresponding method=thread/archive request:
    Archive requested conversationId=<redacted> ... source=recent_tasks_menu
    
    • Read-only inspection confirms that both checked conversation records still have archived = 0, and their referenced rollout files exist. The archived_sessions directory also exists.
    • PRAGMA quick_check on state_5.sqlite returns ok.

    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) returns true for a desktop runtime supporting threadAttachments before checking whether the directory is a managed worktree. The archive flow then calls prepareThreadArchive(), which throws the account-resolution error before sending thread/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.

  8. thesobercoder commented on Sep 27, 2026

    @thesobercoder

    Same bug on macOS, so it is not Windows-only.

    • App bundle: 26.923.10815, CLI 0.158.0-alpha.2.1
    • Custom provider (CLIProxyAPI), not signed in to a ChatGPT account
    • Archiving from the sidebar menu or the keyboard shortcut does nothing, and there are no thread/archive calls in the logs. Before this update, archiving worked without signing in (thread/archive calls succeeded on 2026-09-22).
    • The app-tools set_thread_archived call returns: Could not determine the account for worktree cleanup.
    • Each attempt is followed by sa_server_request_failed errorMessage="Workspace routing is unavailable"
    • The chat has no managed worktree, so no cleanup is needed. Archive should skip the account lookup, or treat a failed lookup as non-fatal.
  9. cczxuan commented on Sep 28, 2026

    @cczxuan

    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

    • Codex Desktop MSIX OpenAI.Codex_26.924.2738.0_x64, desktop build 26.924.22138, prod channel, reported as up to date
    • Bundled app-server / CLI 0.158.0-alpha.2.1
    • Windows 11 10.0.26200
    • Third-party provider selected: model_provider = "deepseek", base_url = "https://<provider-host>", wire_api = "responses", experimental_bearer_token = "<redacted>"
    • Auth: the bundled codex login status reports Logged in using an API key, and CODEX_HOME/auth.json contains only OPENAI_API_KEY

    So unlike the original report, an OpenAI API key is present here, and archiving still fails for every local thread. The app-level set_thread_archived call returns Could not determine the account for worktree cleanup., the thread stays archived = 0, and no method=thread/archive line is emitted - same signature as the reports above.

    Why the apikey fallback is unreachable in this state

    A fresh, read-only app-server process using the same configuration returns:

    // third-party provider active (model_provider = "deepseek")
    {"authMethod": null, "authToken": null, "requiresOpenaiAuth": false}
    
    // built-in provider instead (-c model_provider=openai)
    {"authMethod": "apikey", "authToken": null, "requiresOpenaiAuth": true}

    getAuthStatus().authMethod is null, not "apikey" and not "apiKey". In prepareThreadArchive the lookup is:

    let n = await this.#i() ?? (...);
    if (n == null) throw Error(`Could not determine the account for worktree cleanup.`);

    and #i() ends with this.#t = await e.getAuthMethod() === "apikey" ? "apikey" : null, so a null auth method resolves to no owner and the throw happens before any thread/archive request is sent.

    The important part: this null is produced by the active provider being a non-OpenAI one, not by missing credentials. An API key can be present in auth.json and the app-server will still report authMethod: null while 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 true in getManagedWorktreeCleanup() 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 = true to the third-party provider block:

    [model_providers.deepseek]
    base_url = "https://<provider-host>"
    wire_api = "responses"
    experimental_bearer_token = "<redacted>"
    requires_openai_auth = true

    makes the same probe return:

    {"authMethod": "apikey", "authToken": null, "requiresOpenaiAuth": true}

    With that value the client resolves the "apikey" owner instead of null, 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

    • With a third-party provider active, account/read / getAuthStatus also report no workspace, so account-scoped features log sa_server_request_failed ... "Workspace routing is unavailable" ... status=432 for /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.
    • The codex archive <uuid> escape hatch suggested earlier does not work on this install: the bundled CLI exits with Error: 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 --remote endpoint to point the CLI at.

    No local state was modified while diagnosing this (archive state and rollout files are unchanged).

  10. atishpatel commented on Sep 28, 2026

    @atishpatel

    🤖 Still reproduces on the newest primary runtime, on macOS.

    • Codex desktop 26.924.22138, primary runtime 26.927.11222 (auto-updated 2026-09-28), macOS 26.6 arm64
    • Custom Responses-compatible provider using env_key auth, requires_openai_auth = false, not signed in to ChatGPT
    • Last successful UI archive: 2026-09-25 on runtime 26.923.10815 (thread/archive returned about 100 ms after Archive requested)

    Since the update, every archive from the Recent tasks menu logs Archive requested … source=recent_tasks_menu, and no method=thread/archive follows. This matches the analysis above. getManagedWorktreeCleanup() returns true early for ordinary local threads, and prepareThreadArchive() then throws because #i() resolves no owner when getAuthStatus.authMethod is null. So the fix hasn't shipped as of 26.927.11222.

    The failing threads here were started from the CLI (codex-tui 0.156.0), with a plain local directory as cwd (not a git repo and not a managed worktree).

  11. pinchuan54 commented on Sep 29, 2026

    @pinchuan54

    I am seeing the same archive failure after updating Codex through the Microsoft Store on September 27, 2026.

    Environment

    • OS: Windows 11 Pro x64 (10.0.22631)
    • Installation: Microsoft Store / MSIX package
    • Package: OpenAI.Codex_26.924.2738.0_x64
    • Desktop release/build: 26.924.22138 / build 11645
    • Release channel: prod
    • The app currently reports that it is up to date.
    • Bundled app-server / CLI: codex-cli 0.158.0-alpha.2.1
    • Active provider: a custom third-party provider; provider name and endpoint omitted
    • Wire API: responses
    • requires_openai_auth = false
    • experimental_bearer_token is configured, but the value is intentionally redacted
    • codex login status reports: Not logged in

    Problem

    The problem started after the Microsoft Store update on September 27, 2026.

    Archiving fails for both existing and newly created local conversations:

    1. Open a local conversation.
    2. Choose Archive from the sidebar or conversation menu.
    3. Wait for the operation to complete.
    4. The UI shows the localized toast: 聊天归档未成功 (Chat archive failed).
    5. The conversation remains in the active list and does not appear in Archived chats.

    The failure is still reproducible after completely restarting Codex.

    Read-only inspection shows that the local state database passes:

    PRAGMA quick_check = ok
    
  12. aquariuslt commented on Sep 29, 2026

    @aquariuslt

    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 = true does not work for providers that use [model_providers.<id>.auth]

    My custom provider gets its token from an auth command. With requires_openai_auth = true added to that provider, the config no longer loads:

    codex doctor --json -c model_providers.<id>.requires_openai_auth=true
    config.load: fail ("invalid data")
    

    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 to config.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 to archived_sessions/, but the sidebar kept showing it, even after restarting the app. Two actions removed the stale row:

    • Opening the thread. Resume fails with session <id> is archived. Run `codex unarchive <id>` to unarchive it first., and the row disappears. No restart needed.
    • Clicking Archive after an app restart. thread/archive returns no rollout found for thread id <id>, the app logs Archive 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_archived tool, archived: false succeeded (thread/unarchive, then Unarchive succeeded in the log). The following archived: true failed with Could not determine the account for worktree cleanup. and sent no thread/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).

  13. LGDoor commented on Sep 29, 2026

    @LGDoor

    Seeing the same archive failures

    Environment

    • Windows 11 (10.0.26200)
    • Codex Desktop 26.924.22138 (build 11645)
    • Bundled CLI 0.158.0-alpha.2.1
    • Custom model provider
    • codex login status: Not logged in

    Observed behavior

    Archiving ordinary local project chats repeatedly shows “Failed to archive conversation.”

    Logs show:

    • Archive requested
    • Successful thread/attachment/list
    • No thread/archive request

    This 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.

  14. saidelike commented on Sep 29, 2026

    @saidelike

    Confirmed workarounds

    Getting the thread ID

    1. Open the target task in Codex Desktop.
    2. Run Copy chat deep link from the command menu.
      • On macOS, the shortcut is Option + Command + L.
    3. The copied value looks like:
    codex://threads/01a0ec4c-7db7-70e3-a3ed-35d9a32653b8
    

    The thread ID is the UUID after /threads/:

    01a0ec4c-7db7-70e3-a3ed-35d9a32653b8
    

    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:

    # With Codex Desktop running
    $ codex archive "01a0ec4c-67f5-7ac2-8e1b-201d5be1bbe3"
    Error: failed to archive session
    
    # After fully exiting Codex Desktop
    $ codex archive "01a0ec4c-67f5-7ac2-8e1b-201d5be1bbe3"
    Archived session 01a0ec4c-67f5-7ac2-8e1b-201d5be1bbe3.
    

    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 proxy exposes the live App Server through its default Unix socket.

    Underlying issue for developers

    The original Codex Desktop failure occurs before the supported thread/archive request is sent.

    Desktop performs an account-dependent worktree-cleanup preflight. When no ChatGPT account can be resolved, it fails with:

    Could not determine the account for worktree cleanup.
    

    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:

    • For remote tasks, codex archive --remote unix:// connects to the same live remote App Server used by Desktop.
    • For local tasks, Desktop runs its App Server over private stdio pipes and does not expose the default Unix socket.
    • Starting another local App Server while Desktop is running cannot archive a loaded task because Desktop owns its writer:
    thread <thread-id> already has an active writer
    
    • Fully exiting Desktop releases the writer, after which codex archive "<thread-id>" succeeds.

    The expected Desktop behavior is:

    1. Determine whether the task actually owns a Desktop-managed worktree.
    2. Perform account-dependent worktree cleanup only when applicable.
    3. Allow ordinary conversation archival to reach thread/archive without requiring a ChatGPT account.
    4. Keep local and remote archive behavior consistent.

    These workarounds use Codex’s supported archive command and do not modify state_5.sqlite directly.

    Reference: Official OpenAI CLI archive documentation

  15. saidelike commented on Sep 29, 2026

    @saidelike

    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 sends thread/archive, so it does not appear to be Windows-specific.

    Suggested title:

    [Desktop] Archive fails before thread/archive with “Could not determine the account for worktree cleanup”

    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.

  16. aquariuslt commented on Sep 29, 2026

    @aquariuslt

    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 = true on 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 in experimental_bearer_token. env_key is ignored when requires_openai_auth is on.

    [model_providers.my-provider]
    name = "..."
    base_url = "http://127.0.0.1:8317/v1"
    wire_api = "responses"
    requires_openai_auth = true
    experimental_bearer_token = "<provider API key>"
    # removed: [model_providers.my-provider.auth]

    I kept the provider id unchanged. Before restarting, codex doctor should report auth.credentials as configured with stored auth mode chatgpt. Then restart Desktop.

    Verified on macOS, Desktop 26.924.22138 (build 11645): after the restart, archiving from the sidebar sends thread/archive and returns errorCode=null. Could not determine the account for worktree cleanup. no longer appears in the log. Model requests still go to the custom base_url with 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.

  17. ttemple-shop commented on Sep 29, 2026

    @ttemple-shop

    Confirmed on another macOS installation on September 29, 2026.

    Environment

    • macOS 27.0, arm64
    • Desktop app: 26.924.22138 (build 11645)
    • Bundled CLI/app-server: codex-cli 0.158.0-alpha.2.1
    • Active model provider: a custom proxy; requires_openai_auth is not set
    • Bundled codex login status: Not logged in

    Reproduction and result

    1. Use the desktop app with the custom provider above.
    2. Choose Archive from the Recent tasks menu for an existing local conversation.
    3. The UI shows “Failed to archive conversation” and the conversation remains in the active list.
    4. Fully quit and restart the app, then retry. The same failure occurs.

    This affected multiple conversations. A diagnostic retry through the built-in set_thread_archived tool returned the exact error:

    Could not determine the account for worktree cleanup.
    

    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 requested and a successful thread/attachment/list, but no corresponding thread/archive response. 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.

  18. HenryFone commented on Sep 30, 2026

    @HenryFone

    Same failure here - confirming it on another Windows machine, on the 26.924 train.

    Environment:

    • MSIX package: OpenAI.Codex 26.924.2738.0 (desktop build 26.924.22138)
    • Bundled app-server / CLI: codex-cli 0.158.0-alpha.2.1
    • OS: Windows 11 23H2
    • Auth: bundled codex login status reports Not logged in; no auth.json
    • Active provider: custom (non-OpenAI) provider, wire_api = "responses", requires_openai_auth = false
    • Last known-good build on this machine: 26.917.x (archive worked, broke after updating to 26.924)

    Reproduction and observed behaviour:

    1. Right-click an existing local conversation and choose Archive.
    2. The UI shows "Failed to archive conversation"; the conversation stays in the sidebar list.
    3. The same happens for every conversation in the affected workspace, including brand-new ones, so it is not chat-specific.
    4. Delete works on the very same conversations - only Archive fails.
    5. Fully quitting and restarting Desktop does not help.

    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.

  19. chizkiyahu commented on Sep 30, 2026

    @chizkiyahu

    The bug was fixed in 26.928.21956.

  20. saidelike commented on Sep 30, 2026

    @saidelike

    confirmed fixed for me too in:

    Version 26.928.21956
    Released Sep 30, 2026
    
  21. aquariuslt commented on Nov 6, 2026

    @aquariuslt

    Archiving works for me on macOS with 26.1029.61003. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appauthbugcustom-modelsessionwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions