Repository navigation
Description
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
sessionsto 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):
- Use an existing T3 conversation with Codex account/provider instance A.
- Select Codex account/provider instance B for the same conversation.
- Send a message using B.
- 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-serverprocess with the same T3 server parent PID. - Each process had its corresponding account-specific
CODEX_HOME. /proc/<account-A-pid>/fdcontained both the rollout JSONL andthread-writer-locks/<native-id>.lockfor 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
ViperJuice commentedon Nov 4, 2026
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.
kevin-david commentedon Nov 10, 2026
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_sendwithfreshContext: 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.ViperJuice commentedon Nov 13, 2026
More data from two Linux servers on
0.1.10-nightly.20261111.4529with 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-secondthread_unload_delaydescribed above.Case 1: held for at least 19 minutes
thread-writer-locks/<id>.lock. It had no child processes, and A had no unfinished runs on that server.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
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.
guillem-roig commentedon Nov 16, 2026
I'm consistently experiencing the same issue on macOS with T3 Code 0.1.9.
My setup:
Steps to reproduce:
Actual behavior:
I consistently receive the following error:
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.
xande commentedon Nov 16, 2026
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
83e3c4f60d. The server runs headless on Linux arm64 in a Docker container.0.169.0.CODEX_HOME. Neither instance has a shadow home.-claunch arguments. These arguments select a different model and different credentials. Instance A has no launch arguments.Steps to reproduce
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.
turn/completedprovider-thread.updatedbinds the provider thread to the session of instance Bprovider-session.detachedfor the session of instance Aprovider-session.detach(instance A) andprovider-turn.start(instance B) are createdprovider-session.detachcompletes with statussucceededthread/resumefails withthread <id> already has an active writerthread/resumefails with the same error. The run fails.T3 did not send
thread/unsubscribeto instance A. Instance A did not sendthread/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 emitsprovider-thread.updatedbefore the detach effect runs. This event binds the provider thread to the session of instance B.ProviderSessionManager.detachgets the provider threads to unload with this filter:input.providerSessionIdis the session of instance A. The projection already shows the session of instance B. Thus, the filter returns an empty list.detachdoes not callunloadThread, and T3 does not sendthread/unsubscribeto instance A.detachalso deletes the entry for the thread fromidleThreadUnloadsand 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.
unloadThreadsendsthread/unsubscribeand records a pendingthread/closedinthreadClosings.threadClosingsexists for each app-server connection. A resume on instance B uses a different connection, so it does not wait forthread/closedfrom instance A.Possible fix
detach, wait forthread/closedfrom instance A afterthread/unsubscribe, with a timeout.Workaround
Do one of these steps:
Do not wait for the idle timeout.
detachstops the idle-unload fiber, so the lock stays.andrewfree commentedon Nov 16, 2026
Observed on macOS 27.3 arm64 with T3
0.1.10-nightly.20261116.4761. The installed Codex executable reports0.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.dispatchcommand changed the conversation to a different configured Codex provider instance and scheduledprovider-turn.restartwithsessionTransition.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:
All 20 resume attempts through 20:57:10.645 failed with that error. The protocol log contains no outgoing
thread/unsubscribefor 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/resumefor 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.
dlevy233 commentedon Nov 17, 2026
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
codexinstance (Codex 0.169.0) and an existing-logincodex-cliinstance (ChatGPT desktop bundled 0.169.0-alpha.11.1) share the same Codex home.Observed sequence in one existing T3 conversation:
codex.codex-cli, run 4 completed successfully.codex-clidid not repair continuation. Further attempts 5 and 6 failed with the same writer conflict.Read-only state inspection after those failures:
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:sharedprovider-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.tscan reusetargetProviderThread.providerSessionIdwhen the provider-thread instance already matches the requested instance, even if the referenced session belongs to another instance.ProviderSessionManager.openreuses a live entry by session ID and returns its runtime without checking that the runtime instance matchesinput.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.
realsamrat commentedon Nov 18, 2026
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
codexinstance ("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:
usageLimitExceeded(turn/completed status failed, ~1.2s).thread/resumereturns-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…".lsofshows the lock file~/.codex/thread-writer-locks/<id>.lockand the rollout JSONL held by the old Maincodex app-server(its parent ist3 serve), which had been running for 31 min. That process also still holds a lock on one other conversation. No outgoingthread/unsubscribefor 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:
Triaged with Claude Code inside T3 Code.
crestonepeaks commentedon Nov 20, 2026
Additional anonymized reproduction on macOS, observed November 20, 2026.
Environment and trigger
Observed workflow, not a fresh automated minimal reproduction:
turn/completedwith statusinterrupted.-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/unsubscribeorthread/closedbetween them. A stayed alive and retained the writers during diagnosis. T3's detach effects had nevertheless completed with statussucceeded.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:
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.
maorbez commentedon Nov 20, 2026
Hit the exact same issue on macOS, adding another data point (including a small extra detail on cleanup after switching away):
Environment
0.1.8-nightly.20261111.1codex-cli 0.171.0codex app-serverinstances under the same T3 Code process:codex app-serverusing~/.codexopenai_token_sharingCodex instance using a shadowCODEX_HOMEwhosethread-writer-lockssymlinks to~/.codex/thread-writer-locksWhat happened
thread/resumeand failed with:code: -32600, message: "thread <id> already has an active writer"surfacing the "This conversation is open in another Codex client..." error.
lsof +D ~/.codex/thread-writer-locksconfirmed the lock file was still held by T3's own instance (1)codex app-serverprocess (which was also serving other active threads, so killing it wasn't safe).thread/unsubscribeto 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!
paulm commentedon Nov 22, 2026
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/unsubscribeto the old account's app-server before the destination resumed the thread.Setup (per
docs/user/providers-codex.md, "Multiple CLI logins")~/.codex), no shadow home.~/.codex, shadow home~/.codex-b, with its own ChatGPT login. Both share the continuation keycodex:home:~/.codex.Steps
Result
turn/completed:thread/sample, then fivethread/resumerequests, each answered "already has an active writer". There is nothread/unsubscribeand nothread/closedanywhere in the log.lsofon~/.codex/thread-writer-locks/<id>.lockshows 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_resumepath 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.