Skip to content

[Bug]: Codex account switching leaves T3-owned writer locks on current nightly, blocking conversation resume #30630

Open

Description

@ViperJuice

Area

apps/server — Codex provider-instance handoff

Summary

Switching existing conversations between two Codex account/provider instances leaves the original T3-managed Codex app-server holding their writer locks. The destination instance cannot resume them. This was observed in four conversations on 0.1.7-nightly.20261104.4151.

This appears to be a recurrence of closed issues #8259 and #10414. Related open issue #28678 concerns an external Codex client; here the identified lock owner was T3's own previous-account app-server.

Environment

  • Linux x86_64, headless T3 server accessed remotely.
  • T3 Code 0.1.7-nightly.20261104.4151.
  • Codex CLI/app-server 0.166.0.
  • Two Codex provider instances, each with its own account home and credentials. Both account homes resolve sessions to the same shared session directory. This shared-session configuration is relevant to the reproduction.

Steps to reproduce

Observed workflow (not a fresh automated minimal reproduction):

  1. Use an existing T3 conversation with Codex account/provider instance A.
  2. Select Codex account/provider instance B for the same conversation.
  3. Send a message using B.
  4. Repeat for other existing conversations previously opened by A.

Expected behavior

T3 should hand off the original native conversation to the selected account, releasing its old writer before the destination resumes it. If an active turn prevents handoff, defer or clearly reject the switch. Preserve conversation identity and history, and leave unrelated turns running.

Actual behavior

Four conversations failed with:

This conversation is open in another Codex client, such as the Codex app,
the Codex CLI, or an IDE extension. Codex lets one client write to a
conversation at a time. Quit that client, then send your message again.

The message suggests another user-opened client, but the identified owner was the old account's app-server launched by T3 itself.

Evidence

Sanitized server trace:

CodexAdapterV2.resumeThread
ProviderAdapterThreadInUseError: This conversation is open in another Codex client ...
  cause: CodexAppServerRequestError:
    thread <native-conversation-id> already has an active writer

Read-only process inspection showed:

  • Account A and account B each had a separate codex -c check_for_update_on_startup=false app-server process with the same T3 server parent PID.
  • Each process had its corresponding account-specific CODEX_HOME.
  • /proc/<account-A-pid>/fd contained both the rollout JSONL and thread-writer-locks/<native-id>.lock for all four native conversation IDs extracted from the errors.
  • Account B's process held none of those files.
  • A separate standalone Codex process existed, but did not hold any of these four conversation files/locks.

This establishes the old T3-managed provider as the immediate blocker. We have not isolated the exact upstream lifecycle code responsible or tested an upstream patch.

Workaround and verification

Before recovery, a read-only query of T3's orchestration state showed no running, starting, preparing, or waiting turns for account A. We sent SIGTERM only to the verified idle account-A app-server, without restarting T3 or account B and without deleting lock files.

Verified afterward:

  • The account-A process exited normally.
  • All four lock files disappeared through normal process cleanup.
  • Account B's app-server remained alive.
  • T3 environment discovery still returned HTTP 200.

The user was then asked to retry. Lock release is verified; successful post-recovery model turns have not yet been verified. No conversation files were modified or removed.

Impact / regression coverage

Blocks continuation of affected existing conversations when changing accounts. Please cover switching compatible Codex instances that share session storage, including old idle sessions, preservation of native conversation identity, and avoiding interruption of unrelated active turns. The handoff should wait for actual writer release rather than simply starting a competing app-server.

Report prepared with Codex assistance from live process and trace evidence. Account names, host addresses, conversation IDs, and private paths are omitted.

Activity

  1. ViperJuice commented on Nov 4, 2026

    @ViperJuice
    Author

    Additional evidence: reproduced the same conflict on a second Linux T3 server running the same nightly. Two more affected native conversations were held by that server's T3-managed account-A app-server. Terminating that idle old-account process released both locks without restarting T3 or the destination account.

    On the first machine, a previously affected conversation has now successfully started a turn under account B after the earlier lock release (T3 reports running, with a provider turn start). The original four locks are now held by the destination account as expected. This supports the handoff diagnosis; it is not evidence of a durable fix.

  2. kevin-david commented on Nov 10, 2026

    @kevin-david

    I hit this on macOS too on 2026-11-10. T3 desktop and server are both 0.1.8, macOS 27.0.1 on arm64. Installed Codex CLI is 0.167.0.

    One Codex account ran out of workspace credits. After switching to another configured Codex account, three existing conversations failed with "This conversation is open in another Codex client." before the provider turn started, multiple attempts.

    Had an agent use t3_thread_send with freshContext: true - this got all three responding again without restarting T3 or killing any processes. This starts a new provider session, so I supplied a summary of the unfinished work for each conversation. The existing history stayed visible in T3, but the new sessions needed those summaries for context.

  3. ViperJuice commented on Nov 13, 2026

    @ViperJuice
    Author

    More data from two Linux servers on 0.1.10-nightly.20261111.4529 with Codex CLI 0.167.2. In both cases the old account's T3-managed app-server held the lock, and stopping that idle process let the conversation resume. In the first case, the lock was still held 19 minutes after the old account's last turn. That is far longer than the 60-second thread_unload_delay described above.

    Case 1: held for at least 19 minutes

    • After a usage-limit hit, account A (out of weekly quota) failed three runs in a row. Each failed about 2.5 s after it started. The last one completed at 14:51:26Z.
    • The conversation was then switched to account B. B's run at 15:10:15Z failed with "This conversation is open in another Codex client."
    • A's app-server still held thread-writer-locks/<id>.lock. It had no child processes, and A had no unfinished runs on that server.
    • I sent SIGTERM to A's process. The lock became free immediately and T3 stayed healthy.

    So a turn that fails quickly on usage limits seems to leave the thread loaded on the old app-server with no unload at all, not just a delayed one. It stays loaded until the process exits.

    Case 2: the retry falls inside the window

    • Account A failed at 01:44:00Z (finished 01:44:03Z). T3 then ran the same conversation on account B at 01:44:19Z, 16 s later. B failed with the same conflict.
    • After A's idle app-server was stopped, B started a run at 01:45:12Z. It has completed normally since.

    Pattern: retries on an account that is out of quota keep re-loading the conversation on that account's app-server. Each failed attempt takes the writer lock back, so the lock problem recurs until the conversation stays off that account. The workaround is still to stop the old account's idle app-server once it has no active runs. #30647's unsubscribe-and-wait would cover case 2, but I'm not sure it covers case 1. Case 1 has no account-switch detach before B's resume: the A turn simply ended as failed.

    Not tested: #30647's head, Codex versions other than 0.167.2, and macOS/Windows.

    Investigated with Claude Code (claude-opus-5-5) in T3 Code.

  4. guillem-roig commented on Nov 16, 2026

    @guillem-roig

    I'm consistently experiencing the same issue on macOS with T3 Code 0.1.9.

    My setup:

    • macOS
    • T3 Code 0.1.9
    • Multiple ChatGPT Business accounts configured using access tokens rather than OAuth authentication
    • Account switching is performed directly through T3 Code's account selector

    Steps to reproduce:

    1. Start or continue an existing Codex conversation using account A.
    2. Switch to account B directly through T3 Code.
    3. Try to send another message in the same conversation.

    Actual behavior:

    I consistently receive the following error:

    This conversation is open in another Codex client, such as the Codex app, the Codex CLI, or an IDE extension. Codex lets one client write to a conversation at a time. Quit that client, then send your message again.

    This happens every time I switch accounts within an existing conversation, even though the conversation is not open in another Codex client.

    Workaround:

    If I fork the affected conversation in T3 Code, I can immediately switch to the other account and continue working without any errors.

    This workaround is consistently successful.

    Additional observation:

    Since the same accounts and access tokens work correctly after forking, this suggests the issue may be related to the original conversation's writer lock or provider-session handoff rather than authentication.

    This also confirms that the issue affects token-based ChatGPT Business configurations, not only OAuth-based account switching.

    Hopefully this helps with reproducing the issue and validating the proposed fix.

  5. xande commented on Nov 16, 2026

    @xande

    I can reproduce this on current main, and I found the cause. My setup is different from the setups above. It shows that the problem also occurs when both instances use the same Codex home.

    Setup

    • T3 Code built from source at commit 83e3c4f60d. The server runs headless on Linux arm64 in a Docker container.
    • Codex CLI 0.169.0.
    • Two Codex provider instances. Both use the default CODEX_HOME. Neither instance has a shadow home.
    • Instance B adds -c launch arguments. These arguments select a different model and different credentials. Instance A has no launch arguments.

    Steps to reproduce

    1. Start a new thread with instance A.
    2. Send one message. Let the turn complete.
    3. In the model picker, select instance B for the same thread.
    4. Approximately 10 seconds after step 2, send a message.

    Actual behavior

    The turn fails with "This conversation is open in another Codex client". Instance B never receives the request.

    Timeline

    This data is from the orchestration events, the effect outbox and the provider protocol log of the thread.

    Time (UTC) Event
    18:22:59.377 Instance A: turn/completed
    18:23:09.410 Event provider-thread.updated binds the provider thread to the session of instance B
    18:23:09.410 Event provider-session.detached for the session of instance A
    18:23:09.423 Effects provider-session.detach (instance A) and provider-turn.start (instance B) are created
    18:23:09.461 provider-session.detach completes with status succeeded
    18:23:09.566 Instance B: first thread/resume fails with thread <id> already has an active writer
    18:23:11.282 Instance B: fifth thread/resume fails with the same error. The run fails.

    T3 did not send thread/unsubscribe to instance A. Instance A did not send thread/closed. The protocol log does not filter these methods, and it routes them to the thread log by native thread ID. Thus, these messages did not occur.

    Cause

    In Orchestrator.ts, the selection change emits provider-thread.updated before the detach effect runs. This event binds the provider thread to the session of instance B.

    ProviderSessionManager.detach gets the provider threads to unload with this filter:

    projection.value.providerThreads.filter(
      (thread) => thread.providerSessionId === input.providerSessionId,
    )

    input.providerSessionId is the session of instance A. The projection already shows the session of instance B. Thus, the filter returns an empty list. detach does not call unloadThread, and T3 does not send thread/unsubscribe to instance A.

    detach also deletes the entry for the thread from idleThreadUnloads and stops its idle-unload fiber. Thus, the idle timeout does not unload the thread later. The app-server of instance A keeps the writer lock until that process stops. This agrees with the 19-minute case above.

    A second problem can occur after the first one is fixed. unloadThread sends thread/unsubscribe and records a pending thread/closed in threadClosings. threadClosings exists for each app-server connection. A resume on instance B uses a different connection, so it does not wait for thread/closed from instance A.

    Possible fix

    1. Make the detach effect find the threads to unload without the current session binding. For example, capture the provider thread IDs in the effect request when the orchestrator creates it.
    2. In detach, wait for thread/closed from instance A after thread/unsubscribe, with a timeout.
    3. Start the turn on instance B only after step 2.
    4. If the timeout occurs, show an error that names T3's own old instance. Do not show the "another Codex client" message.

    Workaround

    Do one of these steps:

    • Start a new thread with instance B.
    • Restart the T3 server. This stops the app-server of instance A and releases the lock.

    Do not wait for the idle timeout. detach stops the idle-unload fiber, so the lock stays.

  6. andrewfree commented on Nov 16, 2026

    @andrewfree

    Observed on macOS 27.3 arm64 with T3 0.1.10-nightly.20261116.4761. The installed Codex executable reports 0.167.1; I did not capture the existing worker's loaded version.

    The trigger was a follow-up message while the old turn was still running. Its accepted message.dispatch command changed the conversation to a different configured Codex provider instance and scheduled provider-turn.restart with sessionTransition.type = "replace". The old provider used a shared app-server.

    Persisted events and the native protocol recorded this sequence on 2026-11-16 UTC, for the same native conversation:

    20:55:41.145  provider-thread binding changed from instance A to instance B
    20:55:41.182  old shared session: turn/interrupt
    20:55:41.223  old shared session: turn/completed
    20:55:41.685  replacement session: thread/resume
    20:55:41.872  replacement session: -32600, already has an active writer
    

    All 20 resume attempts through 20:57:10.645 failed with that error. The protocol log contains no outgoing thread/unsubscribe for this conversation between its earlier shared-session resume and those failures. A process/lock inspection identified the holder as the old Codex app-server launched by T3. Its launch arguments included -c thread_unload_delay_secs=0.

    For #36326, this suggests a regression case covering replacement after an interrupted active turn on a shared session, in addition to the completed-turn account switch.

    Later observation: at 21:41:08.200 UTC, a new thread/resume for the same native conversation succeeded; a turn started at 21:41:10.970 and the agent replied. A later process check found the original lock holder gone and a new T3 worker holding the same conversation's lock. This investigation did not stop or restart any process or change T3 configuration. I have not established when or why the old worker exited.

    This is evidence from the installed nightly, not a test of #36326's head. The successful later retry does not establish a durable fix.

    Investigation and comment preparation by GPT-6.1 Sol in the Codex harness through T3 Code. Independent report search and comment review by Claude Fable 5.2. Additional comment review by Claude Opus 5.5. Both Claude models used T3 Code's Claude Agent route.

  7. dlevy233 commented on Nov 17, 2026

    @dlevy233

    Confirmed a related failure on T3 Code 0.1.10, macOS 27.0, with additional evidence of a stale provider-session binding.

    Setup: a managed codex instance (Codex 0.169.0) and an existing-login codex-cli instance (ChatGPT desktop bundled 0.169.0-alpha.11.1) share the same Codex home.

    Observed sequence in one existing T3 conversation:

    1. An older run, ordinal 3, was queued against instance codex.
    2. After switching to codex-cli, run 4 completed successfully.
    3. About two seconds later, the older queued run 3 attempted to start and failed with the active-writer error.
    4. Restoring the thread's visible/default model selection to codex-cli did not repair continuation. Further attempts 5 and 6 failed with the same writer conflict.

    Read-only state inspection after those failures:

    app thread modelSelection.instanceId = codex-cli
    provider thread providerInstanceId   = codex-cli
    provider thread providerSessionId    = provider-session:provider-instance:codex:shared
    referenced session providerInstanceId = codex
    

    The native conversation ID was unchanged. OS-level file inspection identified the writer-lock holder as T3's existing-login Codex app-server, while the failed RPCs were logged under the old codex:shared provider-session ID. Both app-servers had the same T3 server parent. This was not an independently opened editor holding the conversation.

    Only the affected conversation had this provider-instance/session-instance mismatch in a read-only comparison of current projection records. Other workers were actively using the shared existing-login app-server, so terminating it would interrupt unrelated work; no app-server was terminated and no lock/session/history files were deleted.

    Relevant source observations, not yet a tested fix:

    • Orchestrator.ts can reuse targetProviderThread.providerSessionId when the provider-thread instance already matches the requested instance, even if the referenced session belongs to another instance.
    • ProviderSessionManager.open reuses a live entry by session ID and returns its runtime without checking that the runtime instance matches input.modelSelection.instanceId.

    Please cover an old queued run captured before a compatible provider switch, followed by a successful new-provider run and later retries. Session reuse should validate the provider instance as well as the session ID, and preserve native conversation identity without interrupting other active conversations.

    The successfully completed work and saved transcript remain intact. The failure affects subsequent message delivery.

  8. realsamrat commented on Nov 18, 2026

    @realsamrat

    Note

    🤖 Claude Opus 5.5 responding on behalf of realsamrat

    Reproduced on macOS 27.0 arm64, T3 Code Desktop 0.1.11-nightly.20261118.4877 (local server, same version), Codex CLI app-server spawned by T3.

    Setup: default codex instance ("Codex Main", default CODEX_HOME, no shadow home) plus a managed-setup Codex instance on a second ChatGPT account.

    Sequence (UTC, 2026-11-18), one existing conversation:

    • 21:06:04: Main turn fails with usageLimitExceeded (turn/completed status failed, ~1.2s).
    • 21:06:43: user switches the conversation to the second account in the model picker and sends. The new instance's thread/resume returns -32600 thread <id> already has an active writer. There were 10 attempts through 21:07:04, plus a second send, all failing the same way. The UI shows "This conversation is open in another Codex client…".

    lsof shows the lock file ~/.codex/thread-writer-locks/<id>.lock and the rollout JSONL held by the old Main codex app-server (its parent is t3 serve), which had been running for 31 min. That process also still holds a lock on one other conversation. No outgoing thread/unsubscribe for that conversation appears in the provider log before the resume attempts. This matches the usage-limit case described above: a fast-failing turn on the old account leaves the thread loaded, and the switch never unloads it.

    Still present on this nightly. #30647 and #36326 remain unmerged.

    What the user saw:

    t3-codex-active-writer-error.png

    Triaged with Claude Code inside T3 Code.

  9. crestonepeaks commented on Nov 20, 2026

    @crestonepeaks

    Additional anonymized reproduction on macOS, observed November 20, 2026.

    Environment and trigger

    • macOS 26.5.1, arm64; T3 desktop/local server 0.1.11.
    • Installed Codex CLI reports 0.171.0. The already-running old worker's loaded version was not independently queried.
    • Two existing-login Codex CLI provider instances, A and B, with separate account homes/credentials. Both homes resolve their sessions and thread-writer-lock directories to the same shared local directories.
    • Four existing top-level T3 conversations. The operator switched accounts because A was approaching its subscription allowance; the captured old turns were manually interrupted, not quota failures.

    Observed workflow, not a fresh automated minimal reproduction:

    1. Run the existing conversations on A.
    2. Stop their active turns; native logs confirm turn/completed with status interrupted.
    3. Select B in those same conversations.
    4. Resume each conversation with B.
    5. All four fail before a provider turn starts. Each failed run makes five native resume attempts and receives -32600: thread <native-id> already has an active writer.

    Evidence

    Read-only inspection identified the old A app-server, launched by the same T3 server, holding all four matching native writer-lock files. Nonblocking OS lock probes confirmed exclusive ownership was still held; this was not inferred from file existence alone. B's app-server was a different process.

    The four scoped native protocol logs show the interruptions and B's resume attempts, but no thread/unsubscribe or thread/closed between them. A stayed alive and retained the writers during diagnosis. T3's detach effects had nevertheless completed with status succeeded.

    This is consistent with the already-discussed projection-binding/detach failure. We have not tested #30647's branch or established a shipped fix.

    Bounded workaround and result

    Before acting, we rechecked the whole old provider: zero active/queued runs, zero active native turns, zero pending background tasks, and zero pending provider effects. Its only additional held conversation was completed and idle. We then revalidated process identity, account home, T3 parent, and ownership and sent SIGTERM only to that idle old A app-server.

    Verified:

    • A exited; all four affected OS locks were released.
    • B and the T3 server stayed alive, and T3's environment API still responded.
    • The settings file and all four native conversation mappings were unchanged immediately after release.
    • On subsequent operator retries, all four original T3 conversations got past the writer failure on B. One turn completed with an assistant reply; three were running at readback. B held the original four writer-lock files.

    No lock files or history were deleted, no database state was rewritten, and the recovery did not invoke freshContext: true, create replacement top-level tasks, or restart T3. This verifies a local workaround, not durable handoff correctness or completion of the conversations' application work.

    Waiting can appear to help when an old worker eventually unloads/exits, but a fixed delay is not a reliable repair for this missing-release case. Please retain regression coverage for account switches after explicitly interrupted turns on a shared app-server, preserving conversation history and unrelated active work.

    Account names, emails, repository/task names, host addresses, PIDs, native IDs, private paths, credentials, and raw transcripts are omitted. Investigated with GPT-6.1 Sol through the Codex harness in T3 Code.

  10. maorbez commented on Nov 20, 2026

    @maorbez

    Hit the exact same issue on macOS, adding another data point (including a small extra detail on cleanup after switching away):

    Environment

    • macOS 27.2.1 (arm64)
    • T3 Code 0.1.8-nightly.20261111.1
    • codex-cli 0.171.0
    • Two T3-managed codex app-server instances under the same T3 Code process:
      1. Default codex app-server using ~/.codex
      2. Managed openai_token_sharing Codex instance using a shadow CODEX_HOME whose thread-writer-locks symlinks to ~/.codex/thread-writer-locks

    What happened

    1. Switched an existing Codex conversation from instance (1) to instance (2) and sent a message.
    2. Instance (2) retried thread/resume and failed with:
      code: -32600, message: "thread <id> already has an active writer"
      surfacing the "This conversation is open in another Codex client..." error.
    3. lsof +D ~/.codex/thread-writer-locks confirmed the lock file was still held by T3's own instance (1) codex app-server process (which was also serving other active threads, so killing it wasn't safe).
    4. Extra detail: Even after switching the conversation away from Codex to a non-Codex provider, T3 only sent thread/unsubscribe to instance (2) (which replied {"status": "notLoaded"}), so instance (1) still kept holding the lock until T3 Code is restarted.

    Would love to see #30647 / #36326 landed!

  11. paulm commented on Nov 22, 2026

    @paulm

    Reproduced on macOS with T3 Code desktop 0.1.11, using the documented shadow-home setup and a clean switch (no usage-limit failure involved). T3 never sent thread/unsubscribe to the old account's app-server before the destination resumed the thread.

    Setup (per docs/user/providers-codex.md, "Multiple CLI logins")

    • macOS 27.2, arm64. T3 desktop 0.1.11. T3's bundled Codex 0.166.0 for both instances, existing-login mode.
    • Instance A: CODEX_HOME empty (resolves to ~/.codex), no shadow home.
    • Instance B: CODEX_HOME ~/.codex, shadow home ~/.codex-b, with its own ChatGPT login. Both share the continuation key codex:home:~/.codex.

    Steps

    1. New thread on instance B. One turn completed normally.
    2. Switched the thread to instance A in the model picker (also changed model, 6.2 Astra → 6.1 Terra) and sent a message.

    Result

    • "Provider turn failed to start: This conversation is open in another Codex client…"
    • The thread's provider event log shows, after B's turn/completed: thread/sample, then five thread/resume requests, each answered "already has an active writer". There is no thread/unsubscribe and no thread/closed anywhere in the log.
    • lsof on ~/.codex/thread-writer-locks/<id>.lock shows B's app-server (codex app-server -c thread_unload_delay_secs=0 …) still holding it 5 minutes later. A's app-server holds only its own conversations.

    So in this case the old instance never detached at all, even though the B turn ended normally. That fits ViperJuice's case 1 rather than a timing window, and suggests the restart_and_resume path for a same-continuation instance change doesn't unload the thread from the old instance's runtime when that runtime serves multiple threads. #30647's unsubscribe-and-wait would cover this, provided it runs on that path.

    Not tried yet: forking the thread, or a fresh-context send, as workarounds.

    Investigated with Claude Code (claude-opus-5-5) in T3 Code.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions