Remote Control cannot attach to a live CLI session on the workstation (completed threads work, in-progress ones fail)
What variant of Codex are you using?
CLI + ChatGPT iOS Remote Control (paired hosts)
What feature / fix would you like?
Support the normal workstation-primary workflow:
- Start and run the task in Codex CLI on the workstation
- Use the phone only to monitor progress, approve actions, and send short steering replies
- Return to the same live CLI session without quit/resume or forking
Today, Remote Control effectively allows the phone to open completed threads, but fails when the workstation CLI already owns a live / in-progress session.
Why this matters
Almost nobody’s main coding surface is the phone. The realistic loop is:
- keyboard + terminal on the workstation
- phone as a second screen for status + decisions while away from the desk
Claude Code Remote Control (/rc) matches this model: the local CLI session stays primary; mobile is another window into the same live session.
Codex Remote currently behaves more like: “pair a host → operate threads from mobile,” and does not reliably share an already-attached live CLI session with iOS.
What happens today (observed)
| Session state | iOS Remote result |
|---|---|
| Completed (no active CLI attach) | Opens and reads normally |
| Live / in-progress CLI session | Fails to load |
On the failing live session, iOS shows:
加载消息时出错:Codex 服务器返回了错误。
(“Error loading messages: Codex server returned an error.”)此任务无法重新连接
(“This task cannot reconnect”)
So the phone can act as a history viewer for finished threads, but cannot attach to the live session the CLI already owns.
Expected behavior
- Workstation CLI remains the primary client
- iOS can attach to that same live thread as a secondary client
- Monitoring, approvals, and short follow-ups work without forcing the user to start the task from mobile
- Returning to the workstation TUI does not require quitting and
resume, and does not create divergent continuations
Actual behavior
- Completed threads: OK from iOS
- Live CLI-attached threads: iOS cannot reconnect / server error
- Practical workaround pushed by the product shape: start work from Remote/App side instead of CLI — awkward for workstation-first developers
Suggested direction
Any of:
- Explicit multi-client live attach (CLI + mobile on the same thread)
- Or a clear “monitor/approve-only” secondary session mode for Remote
- Or document and enforce single-writer rules without hard-failing the phone on live threads (e.g. read-only view + queued approvals)
Related: #32445, #34632, #23011
Additional information
No response
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
- #37403
- #37450
- #37947
Powered by Codex Action
I can reproduce this exact iOS Remote error on macOS, with a more specific discriminator.
- Remote pairing works and all chats/projects are listed.
- Working chat: Codex CLI 0.146, historyMode: "legacy".
- Failing chats: Codex CLI 0.147, historyMode: "paginated".
- Multiple newer text-only paginated chats fail, so images are not required.
- Desktop 26.810.52044 build 6662; bundled app-server 0.148.0-alpha.9.
- Updating/restarting Desktop and reconnecting Remote did not help.
- Direct local thread/read succeeds for both the working legacy chat and failing paginated chat.
- The failing paginated response is smaller than the working legacy response, ruling out simple payload-size limits.
- Failed iOS opens do not reach the host as a thread/read.
iOS displays:
Error loading messages: Codex server returned an error.
This suggests the boundary may be paginated-history handling in the mobile/cloud Remote path, rather than only whether the CLI thread has an active writer.
iOS ChatGPT version: 1.2026.209
I can provide a feedback/session ID and sanitized logs privately.
Crazy this thing isn't implemented; and its partial impl is so flawed: control commands (to view/compact context for example) do not work from mobile
Your completed-vs-live table matches a specific mechanism in the thread store: cross-process writer locks. Every live thread holds an exclusive lock file under $CODEX_HOME/thread-writer-locks/ (https://github.com/openai/codex/blob/1f41cc5d92/codex-rs/thread-store/src/local/writer_lock.rs#L17-L34). The workstation TUI's process owns that lock for the in-progress session; when the Remote Control daemon — a different process — tries to open the same thread for iOS, the acquisition fails and surfaces as the generic "Codex server returned an error." Completed threads hold no writer lock, so they open fine. The same single-writer constraint is what blocks /fork-then-resume in another terminal (#38144, #38297) and produces the empty two-instance replay in #37987.
So "phone as second screen on the live session" needs one of: (1) a read-only attach path that never takes the writer lock — enough for monitoring, and probably the quick win; (2) routing mobile steering/approvals through the process that owns the lock (the app-server multi-client machinery exists; the remote-control daemon would proxy into the owning session rather than opening the thread itself). Option 2 is the Claude-/rc-style behavior you're describing; option 1 could ship first and already covers monitoring.
I can reproduce a closely related paginated-history failure on Android, with the important distinction that live steering still works: the phone can send a new message and receive the reply, but opening the thread is slow and the beginning of the conversation is not rendered.
Environment:
- Fedora host, standalone
codex-cli 0.149.0 codex app-server --remote-control --listen unix://, directly supervised by a user systemd service- Android 17 / ChatGPT
1.2026.230 - No Codex/ChatGPT desktop GUI process or desktop client attached to the app-server socket
- The affected thread was created from Android Remote and has
history_mode = paginated
The history is intact and locally readable. I queried the running app-server over its Unix WebSocket:
| Request | Result | Local latency | Encoded response |
|---|---|---|---|
thread/turns/list, ascending, itemsView: summary |
5 turns, nextCursor: null |
5 ms | 12,714 bytes |
thread/turns/list, ascending, itemsView: full |
the same 5 turns, nextCursor: null |
46 ms | 3,104,863 bytes |
thread/read, includeTurns: true |
the same 5 turns | 56 ms | 3,106,375 bytes |
The returned turn statuses are interrupted, completed, completed, completed, inProgress. The first user messages and assistant replies are present in both the rollout and thread_history_1.sqlite; the projection byte offset is current. There is no host-side read error in the app-server journal.
This produces two user-visible symptoms:
- Opening the thread on Android is much slower than before paginated history.
- The mobile UI shows the recent live exchange but omits the earlier conversation, even though the app-server returns all five turns and reports no next page.
The large full response can explain some latency, but not why the beginning is absent. The 12 KB summary response contains enough information to enumerate every turn, so this looks consistent with a mobile/cloud Remote paginated-history handling problem rather than lost host data or a writer-lock failure.
This is still reproducible on Android app 1.2026.230, newer than the iOS build reported above. Happy to provide sanitized protocol output if useful.
Confirmed temporary workaround on Fedora:
- keep the current 0.149 app-server as the single Remote Control host;
- connect the 0.146 TUI client to it with codex 0.146 --remote unix://;
- start new threads from that TUI.
A live test against the 0.149 server created a normal user thread with history_mode=legacy, while the server remained connected to Android. The server records cli_version=0.149.0 because it owns the thread, but the history contract is legacy.
This matches the tagged source: the 0.149 TUI explicitly sends ThreadHistoryMode::Paginated for non-ephemeral new threads, while 0.146 leaves history_mode unset and the app-server default remains legacy.
- 0.149: https://github.com/openai/codex/blob/rust-v0.149.0/codex-rs/tui/src/app_server_session.rs#L1681-L1695
- 0.146: https://github.com/openai/codex/blob/rust-v0.146.0/codex-rs/tui/src/app_server_session.rs#L1504-L1542
This does not convert existing paginated threads, but it provides a workable CLI-first path for newly created threads while retaining the current Remote server and its mobile connection.
This happens also to me with android, macbook and cmux.
Same issue, on my macbook iTerm session and iphone app.
I reproduced the same issue with VS Code + iPhone Remote Control: an active thread owned by VS Code cannot currently be opened on the iPhone, even for viewing. I added OS-level writer-lock evidence and a proposed read-only observer + “Take over here” handoff flow in #40157.
A workaround shaped differently. If you start the task as shell codex, the live PTY is exactly what the phone gets, there is no separate attach step or writer lock to fight, the browser link and the workstation terminal are the same session. Disclosure, I work on Pilot Protocol, which develops shell.online. The limitation, it only helps for sessions launched through it, it cannot adopt an already-running bare codex.
Status check after the 0.150.0 / 0.150.1 releases:
- This issue remains open and unassigned, with no maintainer response yet.
- The official changelog for ChatGPT on iOS
1.2026.230says long-thread loading was improved and older history is now fetched as needed. - The published
0.150.0/0.150.1CLI notes do not mention Android long-thread hydration, read-only Remote attach, writer-lock handoff, or stale-lock lifecycle. The listed0.150.1fix concerns retained-image budgeting during Remote compaction. - Android users continue to report unusable long-running tasks in #38023.
- #40157 now proposes read-only observer mode plus an explicit Take over here ownership handoff for threads already owned by another client.
Could a maintainer clarify:
- Is the incremental long-thread loading change planned or already rolling out on Android?
- Is the observer / writer-handoff design from #40157 under consideration for Remote?
- Does
0.150.xinclude any relevant unlisted fix, or should affected users continue using legacy-history workarounds?
Reproduced on macOS 26.2 (Apple Silicon), Codex standalone CLI 0.151.0, ChatGPT desktop 26.818.61809, with the CLI running inside tmux.
The Mac is paired to iPhone Remote. A live interactive CLI session appears in Remote but opening it returns Error loading messages. Retry indefinitely. The local tmux TUI remains healthy. Desktop-originated sessions do load normally.
There is also a repeated CLI Remote transport conflict in this setup: HTTP 409 Conflict with {"detail":"Remote app server already online"} while the Desktop Remote host is present. Detailed collision reproduction: https://github.com/openai/codex/issues/39547#issuecomment-5472069747
This blocks a key workflow: watch and steer a live tmux-based multi-agent Lead from iPhone.
Reproduced with the same workstation-primary use case.
Environment:
- macOS 26.5 (Apple Silicon)
- Codex CLI 0.149.0, installed at
/opt/homebrew/bin/codex - ChatGPT Desktop 26.831.11858
- ChatGPT Pro
- Long-running interactive CLI thread remains open and healthy on the Mac
Observed:
- The same CLI thread is visible in ChatGPT Desktop.
- Desktop shows the equivalent of “This is open in another app; close it there to continue here.”
- The desired workflow is not a writer takeover in Desktop. It is to keep the live CLI TUI as the primary writer while ChatGPT mobile Remote monitors, approves, and sends steering messages to that same live session.
codex remote-control start --jsoncannot retrofit this running Homebrew CLI session; it requires the installer-managed standalone layout and reports that the managed standalone install is missing.- A direct TUI session also has no app-server daemon control socket, so an already-running session cannot be adopted into the Remote host path without stopping/resuming or changing ownership.
Expected:
- One host-side live session with a single execution owner, plus multiple controller/view clients.
- CLI remains open and receives updates.
- Mobile Remote can inspect progress, approve actions, and enqueue follow-ups without acquiring a conflicting thread-writer lock.
- Desktop may show the session read-only or explicitly as remotely controlled, instead of requiring the CLI to close.
- A documented way to start or adopt a CLI TUI under the app-server daemon would also help.
This is distinct from merely opening the same thread in the local Desktop app. The mobile Remote documentation describes continuing existing chats, steering active work, and approving actions from a phone, so live CLI attachment is the missing bridge: https://learn.chatgpt.com/docs/remote-connections
The current message is especially confusing because it suggests closing the healthy primary CLI session, while the intended workflow is for the phone to be a secondary controller of that session.
Is it a tmux attach issue? Hope it gets resolved soon
Is it a tmux attach issue? Hope it gets resolved soon
no, it's a bug in their code
Reproduced on current builds, with deterministic host-side writer-lock evidence and an additional /fork variant.
Environment:
- macOS 26.5.1, Apple Silicon
- standalone Codex CLI 0.153.4
- ChatGPT Desktop 26.901.51231, build 8109
- desktop-bundled Codex runtime 0.153.4
- iOS Remote client reported by the host log as codex_chatgpt_ios_remote 1.2026.237
Reproduction and evidence:
-
Keep a standalone Codex CLI thread open and active on the Mac.
-
Enable Remote through ChatGPT Desktop. The phone reports connected and lists the CLI thread.
-
A different thread with no active CLI writer opens successfully on iOS, so enrollment, relay connectivity, and authentication are healthy.
-
Opening the active CLI thread on iOS fails to load the chat.
-
At that exact time, the Desktop remote app-server receives thread/resume and logs:
failed to initialize thread persistence: thread-store conflict: thread
already has an active writer Failed to create session: thread-store conflict: thread already has an active writer -
Running codex remote-control from the shell while the Desktop Remote enrollment is live starts app-server and then reports:
Error: Remote control is enabled on
but the connection is errored. -
Forking the active CLI thread does not provide a workaround. After two forks, the same original CLI PID held the writer-lock descriptors for the parent and both fork thread IDs. iOS then attempted thread/resume for the parent and a fork; both failed with the same active-writer conflict. Neither fork could be opened remotely.
The /fork lock retention overlaps #38144. The additional Remote impact here is that every fork remains unopenable from iOS while the originating TUI remains alive, so forking cannot create a remotely attachable branch.
Expected behavior: Remote should attach to or route through the live CLI app-server so the phone can monitor and steer the same in-progress task. At minimum, opening should fall back to a read-only follower view instead of treating the expected single-writer conflict as fatal. This matches the documented workstation-primary use case of continuing existing chats and steering active work from a phone: https://learn.chatgpt.com/docs/remote-connections
Privacy: host name, thread IDs, account and enrollment identifiers, repository paths, prompt contents, and raw logs are omitted. The raw INFO logs contain request headers, so only the relevant sanitized error lines are included here.
Reproduced on current builds on macOS (Apple Silicon) on 2026-09-17/18 UTC:
- Standalone Codex CLI:
0.154.0, launched from a terminal and kept running. - ChatGPT Desktop:
26.915.31029, bundled Codex0.155.0-alpha.9; updated and restarted before retesting. - iOS Remote client in the host log:
codex_chatgpt_ios_remote 1.2026.244.
The active CLI thread appears in Remote, but opening it on iOS fails to load the messages. A new thread started from iOS on the same host works. This reproduces with CLI threads in both a regular checkout and a separate worktree.
The desktop app's attempt to open the same CLI-owned thread gives a useful request sequence at 2026-09-18T00:25:56Z:
thread/read succeeded (errorCode=null)
thread/resume failed (errorCode=-32600): thread <redacted> already has an active writer
thread/turns/list succeeded (errorCode=null)
The desktop UI then logs Failed to resume conversation and Failed to load older thread history with the writer conflict. iOS Remote attempts thread/resume for the active thread and receives the same conflict. The owning CLI process remains healthy and holds the expected writer lock. No lock file was changed.
This narrows the failure: stored history is readable, but the client treats a failed writable resume as a failure to display that history. A read-only transcript fallback would help immediately; monitoring and steering the active session would require routing through its existing owner. The update to Desktop 26.915.31029 did not resolve it.
Private thread IDs, repository names, paths, prompts, and raw logs are omitted.
Additional Windows + WSL2 reproduction and a read-only Desktop use case (2026-09-23):
- Host: Codex/ChatGPT Desktop for Windows
26.915.4065.0, with Codex CLI0.155.1running inside WSL2 through a configured SSH host. ChatGPT Remote on iPhone is paired to the Windows host. - The iPhone shows the host as connected and lists the WSL threads. A different thread without an active CLI writer opens, but the CLI-owned thread fails when opening its messages.
- On WSL,
lsofshows the livecodex --yoloprocess holding that thread's<CODEX_HOME>/thread-writer-locks/<thread-id>.lock. The remote app-server log repeatedly reportsthread-store conflict: thread <redacted> already has an active writerwhen that thread is opened from Remote. I did not delete the lock or stop the running CLI task. - The Desktop-side read-only thread retrieval can still return the transcript. This looks like an ownership/resume failure being surfaced as a message-loading failure, rather than damaged conversation history.
Before recent updates, I could keep a WSL CLI conversation open and also open the same conversation in the Desktop app and on my phone. My normal workflow is CLI-primary: the CLI does the work, while the Desktop app is much more convenient for browsing earlier messages, copying and pasting content, or exporting the conversation to Markdown. I rarely need to write to the same thread from two clients at once.
Please allow the Desktop app and iOS Remote to open and display a CLI-owned conversation in a read-only follower mode when they cannot acquire its writer lock. Reading, copying, and exporting history should not require taking writer ownership. If a secondary client sends a new message or tries to steer, it could route through the existing owner or offer an explicit handoff, rather than making the whole transcript unavailable.
Thread IDs, local paths, account details, and conversation contents are omitted.
Follow-up: After the competing writer was no longer holding the WSL thread, the iPhone could open that same thread. The phone pairing and SSH connection did not need to be changed. This confirms that the observed failure is tied to concurrent ownership of this specific thread, not a general inability to access WSL. The request for read-only access while the CLI remains open still stands.
Additional macOS reproduction: active CLI thread spins indefinitely; a completed CLI thread opens
Observed on 2026-09-26 (UTC+09). Adding symptom-level corroboration here because the active-versus-completed contrast matches this report. A writer-lock failure has not been established in this case; large-history loading (#38653) remains another candidate.
User-observed behavior
- Open ChatGPT mobile > Codex/Remote on the same host.
- The existing active CLI session appears in the session list.
- Selecting it shows a loading screen indefinitely; waiting several minutes does not open the conversation.
- Another existing session whose CLI is no longer running opens on the same phone/host.
- The affected session continues accepting local instructions and responding.
The reported symptom is persistent loading, not a captured error toast. Mobile OS and exact ChatGPT mobile version have been requested but are not yet recorded.
Locally verified environment and storage snapshot
- macOS 26.5.2, Apple Silicon.
- Installed ChatGPT desktop app 26.915.31945, build 9922.
codex app-server daemon version: running managed app-server 0.154.0, local command 0.154.0. This is the managed daemon version, not a claim about the desktop-bundled runtime.- Both compared sessions have CLI source, creation version 0.154.0, and paginated history.
| Snapshot | Failing active session | Opening completed session |
|---|---|---|
| Rollout JSONL bytes | 216,498,388 | 81,656,194 |
| Persisted display items | 11,995 | 613 |
| Total UTF-8 bytes of stored item JSON | 35,099,736 | 26,458,591 |
| Largest turn's stored item JSON bytes | 10,596,825 | 22,693,495 |
These are local storage sizes, not measured mobile payload sizes. The opening control is also substantial and has a larger single stored turn, so this comparison does not establish a simple size threshold. It also does not isolate writer state: the two sessions have different histories. A same-session active/idle retest has not been performed.
Read-only checks found the original rollout and populated turn/item index for the affected session, with no orphan projected items. codex migrate-rollouts --thread <redacted> --json reports already_paginated. This is not a full storage-integrity certification. No mobile-correlated RPC trace or confirmed root cause has been captured.
Requested behavior: opening an active session should show recent messages and progress promptly. If writable resume is unavailable, please offer a readable follower view or an actionable error rather than an indefinite loading screen. Preserve complete history and use bounded initial paging.
No session database, writer lock, enrollment, or original rollout was edited. Task names/IDs, local paths, account/host identifiers, prompts, and raw logs are omitted.
Prepared and posted by Codex with the account owner's explicit authorization.
Follow-up to my earlier report: we now have host-side writer-conflict evidence for the currently affected CLI thread.
Environment: macOS / Apple Silicon, local Codex CLI 0.157.0, managed Remote app-server 0.154.0. The local launcher is a small wrapper around codex --yolo --search; it does not connect the TUI to the Remote daemon.
While the CLI-owned thread remains open, the managed app-server repeatedly logs:
failed to initialize thread persistence: thread-store conflict: thread <redacted> already has an active writer
Failed to create session: thread-store conflict: thread <redacted> already has an active writer
These entries identify the same thread that is failing to open in Remote. A metadata-only read is not sufficient to prove that mobile can attach. This is stronger evidence than my earlier symptom-only report, although we have not captured a full mobile RPC trace or isolated the effect of the CLI/server version difference.
Initially this looked like a restriction on --yolo, but the observed failure is a competing writer, not a documented rejection of full-access permissions. Please make this distinction visible in the UI rather than leaving the user waiting on a loading screen.
The desired workflow is straightforward: start work in the terminal, then connect the phone to that same live session without interrupting it. In my experience Claude Code's /rc provides this with a single command. Please consider an equally simple in-session attach/adopt flow for Codex that routes Remote through the existing execution owner, preserves the user's explicitly chosen approval/sandbox settings, and clearly displays the effective permissions. If full control cannot attach, a read-only progress/history view would still be far better than a loading failure.
We are preparing a stop/resume migration to a shared app-server (codex --yolo --search --remote unix:// resume <thread>), with server-side permission verification. This is a workaround under test, not yet a claim that mobile reconnection is fixed. Users should not have to understand writer-lock ownership or manually migrate their session just to check their running work from a phone.
Thread IDs, local paths, task details, and raw logs are omitted. Posted by Codex with the account owner's explicit authorization.