openai / openai/codex

[macOS][Remote Control] Desktop/CLI ownership collision returns HTTP 409 and prevents iOS from opening CLI chats

Open
#39,547 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app-server bug CLI connectivity remote
Dominant language
Rust
Stars
125k
Forks
19.5k
PR merge metrics
PR metrics pending

Description

What version of Codex CLI is running?

codex-cli 0.147.0

What subscription do you have?

ChatGPT Pro

Which model were you using?

gpt-5.6-sol

What platform is your computer?

Darwin 25.6.0 arm64 arm (macOS 26.6.1, Apple Silicon)

What terminal emulator and version are you using (if applicable)?

Ghostty 1.3.1

Codex doctor report
{
  "schemaVersion": 1,
  "generatedAt": "1786951474s since unix epoch",
  "overallStatus": "ok",
  "codexVersion": "0.147.0",
  "checks": {
    "app_server.status": {
      "id": "app_server.status",
      "category": "app-server",
      "status": "ok",
      "summary": "background server is running",
      "details": {
        "app-server version": "0.147.0",
        "control socket": "<HOME>/.codex/app-server-control/app-server-control.sock",
        "daemon state dir": "<HOME>/.codex/app-server-daemon",
        "mode": "persistent",
        "pid file": "<HOME>/.codex/app-server-daemon/app-server.pid (file)",
        "settings": "<HOME>/.codex/app-server-daemon/settings.json (file)",
        "status": "running",
        "update-loop pid file": "<HOME>/.codex/app-server-daemon/app-server-updater.pid (file)"
      },
      "remediation": null,
      "durationMs": 157
    },
    "auth.credentials": {
      "id": "auth.credentials",
      "category": "auth",
      "status": "ok",
      "summary": "auth is configured",
      "details": {
        "auth file": "<HOME>/.codex/auth.json",
        "auth storage mode": "File",
        "stored API key": "false",
        "stored ChatGPT tokens": "true",
        "stored agent identity": "false",
        "stored auth mode": "chatgpt"
      },
      "remediation": null,
      "durationMs": 0
    },
    "config.load": {
      "id": "config.load",
      "category": "config",
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "CODEX_HOME": "<HOME>/.codex",
        "config.toml": "<HOME>/.codex/config.toml",
        "config.toml parse": "ok",
        "cwd": "<HOME>/Projects",
        "enabled feature flags": "shell_tool, view_image, unified_exec, shell_snapshot, code_mode_host, terminal_resize_reflow, sqlite, memories, hooks, enable_request_compression, multi_agent, apps, tool_search_always_defer_mcp_tools, tool_suggest, plugins, in_app_browser, in_app_updates, browser_use, browser_use_full_cdp_access, browser_use_external, computer_use, remote_plugin, plugin_sharing, image_generation, resize_all_images, item_ids, skill_mcp_dependency_install, skill_search, mentions_v2, steer, default_mode_request_user_input, guardian_approval, goals, collaboration_modes, tool_call_mcp_elicitation, auth_elicitation, personality, fast_mode, tui_app_server, remote_compaction_v2, workspace_dependencies",
        "feature flag overrides": "memories=true, default_mode_request_user_input=true",
        "feature flags enabled": "41",
        "log dir": "<HOME>/.codex/log",
        "mcp servers": "3",
        "model": "gpt-5.6-sol",
        "model provider": "openai",
        "sqlite home": "<HOME>/.codex"
      },
      "remediation": null,
      "durationMs": 0
    },
    "git.environment": {
      "id": "git.environment",
      "category": "git",
      "status": "ok",
      "summary": "git version 2.50.1 (Apple Git-155)",
      "details": {
        "PATH git #1": "/usr/bin/git",
        "PATH git entries": "1",
        "git build options": "git version 2.50.1 (Apple Git-155); cpu: arm64; no commit associated with this build; sizeof-long: 8; sizeof-size_t: 8; shell-path: /bin/sh; feature: fsmonitor--daemon; libcurl: 8.7.1; zlib: 1.2.12; SHA-1: SHA1_DC; SHA-256: SHA256_BLK",
        "git exec path": "/Library/Developer/CommandLineTools/usr/libexec/git-core",
        "git version": "git version 2.50.1 (Apple Git-155)",
        "repo detected": "false",
        "selected git": "/usr/bin/git"
      },
      "remediation": null,
      "durationMs": 159
    },
    "installation": {
      "id": "installation",
      "category": "install",
      "status": "ok",
      "summary": "installation looks consistent",
      "details": {
        "PATH codex #1": "<HOME>/.local/bin/codex",
        "PATH codex #2": "<HOME>/.local/bin/codex",
        "PATH codex #3": "<HOME>/.local/bin/codex",
        "PATH codex #4": "<HOME>/.local/bin/codex",
        "PATH codex entries": "4",
        "current executable": "<HOME>/.local/bin/codex",
        "install context": "standalone (unix, package <HOME>/.codex/packages/standalone/releases/0.147.0-aarch64-apple-darwin, bin <HOME>/.codex/packages/standalone/releases/0.147.0-aarch64-apple-darwin/bin, resources <HOME>/.codex/packages/standalone/releases/0.147.0-aarch64-apple-darwin/codex-resources, path <HOME>/.codex/packages/standalone/releases/0.147.0-aarch64-apple-darwin/codex-path)",
        "managed by bun": "false",
        "managed by npm": "false",
        "managed by pnpm": "false",
        "managed package root": "not set"
      },
      "remediation": null,
      "durationMs": 4
    },
    "mcp.config": {
      "id": "mcp.config",
      "category": "mcp",
      "status": "ok",
      "summary": "MCP configuration is locally consistent",
      "details": {
        "configured servers": "3",
        "disabled servers": "1",
        "stdio servers": "2",
        "streamable_http servers": "1"
      },
      "remediation": null,
      "durationMs": 357
    },
    "network.env": {
      "id": "network.env",
      "category": "network",
      "status": "ok",
      "summary": "network-related environment looks readable",
      "details": {
        "proxy env vars": "none"
      },
      "remediation": null,
      "durationMs": 0
    },
    "network.provider_reachability": {
      "id": "network.provider_reachability",
      "category": "reachability",
      "status": "ok",
      "summary": "active provider endpoints are reachable over HTTP",
      "details": {
        "ChatGPT base URL": "https://chatgpt.com/backend-api/ reachable (HTTP 403)",
        "reachability mode": "ChatGPT auth"
      },
      "remediation": null,
      "durationMs": 338
    },
    "network.websocket_reachability": {
      "id": "network.websocket_reachability",
      "category": "websocket",
      "status": "ok",
      "summary": "Responses WebSocket handshake succeeded",
      "details": {
        "DNS": "2 IPv4, 2 IPv6, first IPv4",
        "auth mode": "chatgpt",
        "connect timeout": "15000 ms",
        "endpoint": "wss://chatgpt.com/backend-api/<redacted>",
        "handshake result": "HTTP 101 Switching Protocols",
        "model provider": "openai",
        "models etag present": "true",
        "provider name": "OpenAI",
        "proxy env vars": "none",
        "reasoning header": "false",
        "server model present": "false",
        "supports websockets": "true",
        "wire API": "responses"
      },
      "remediation": null,
      "durationMs": 1133
    },
    "runtime.provenance": {
      "id": "runtime.provenance",
      "category": "runtime",
      "status": "ok",
      "summary": "running standalone on macos-aarch64",
      "details": {
        "commit": "unknown",
        "current executable": "<HOME>/.local/bin/codex",
        "install method": "standalone (unix, package <HOME>/.codex/packages/standalone/releases/0.147.0-aarch64-apple-darwin, bin <HOME>/.codex/packages/standalone/releases/0.147.0-aarch64-apple-darwin/bin, resources <HOME>/.codex/packages/standalone/releases/0.147.0-aarch64-apple-darwin/codex-resources, path <HOME>/.codex/packages/standalone/releases/0.147.0-aarch64-apple-darwin/codex-path)",
        "platform": "macos-aarch64",
        "version": "0.147.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.search": {
      "id": "runtime.search",
      "category": "search",
      "status": "ok",
      "summary": "search is OK (bundled)",
      "details": {
        "search command": "<HOME>/.codex/packages/standalone/releases/0.147.0-aarch64-apple-darwin/codex-path/rg",
        "search command readiness": "file exists",
        "search provider": "bundled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "sandbox.helpers": {
      "id": "sandbox.helpers",
      "category": "sandbox",
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "OnRequest",
        "codex-linux-sandbox helper": "none",
        "execve wrapper helper": "<CODEX_TEMP_PATH>",
        "filesystem sandbox": "restricted",
        "network sandbox": "restricted"
      },
      "remediation": null,
      "durationMs": 0
    },
    "state.paths": {
      "id": "state.paths",
      "category": "state",
      "status": "ok",
      "summary": "state paths and databases are inspectable",
      "details": {
        "CODEX_HOME": "<HOME>/.codex (dir)",
        "active rollout files": "603 files, 972154568 total bytes, 1612196 average bytes",
        "archived rollout files": "462 files, 613420854 total bytes, 1327750 average bytes",
        "goals DB": "<HOME>/.codex/goals_1.sqlite (file)",
        "goals DB integrity": "ok",
        "log DB": "<HOME>/.codex/logs_2.sqlite (file)",
        "log DB integrity": "ok",
        "log dir": "<HOME>/.codex/log (dir)",
        "memories DB": "<HOME>/.codex/memories_1.sqlite (file)",
        "memories DB integrity": "ok",
        "queue DB": "<HOME>/.codex/queue_1.sqlite (file)",
        "queue DB integrity": "ok",
        "sqlite home": "<HOME>/.codex (dir)",
        "standalone release cache": "8 entries in <HOME>/.codex/packages/standalone/releases",
        "state DB": "<HOME>/.codex/state_5.sqlite (file)",
        "state DB integrity": "ok",
        "thread history DB": "<HOME>/.codex/thread_history_1.sqlite (file)",
        "thread history DB integrity": "ok"
      },
      "remediation": null,
      "durationMs": 1067
    },
    "state.rollout_db_parity": {
      "id": "state.rollout_db_parity",
      "category": "threads",
      "status": "ok",
      "summary": "rollout files and state DB thread inventory agree",
      "details": {
        "default model provider": "openai",
        "rollout DB active files": "603",
        "rollout DB active rows": "603",
        "rollout DB archive mismatches": "0",
        "rollout DB archived files": "462",
        "rollout DB archived rows": "462",
        "rollout DB duplicate DB paths": "0",
        "rollout DB duplicate rollout thread ids": "0",
        "rollout DB malformed file names": "0",
        "rollout DB missing active rows": "0",
        "rollout DB missing archived rows": "0",
        "rollout DB model providers": "openai=1065",
        "rollout DB rows": "1065",
        "rollout DB scan cap reached": "false",
        "rollout DB scan errors": "0",
        "rollout DB sources": "subagent:thread_spawn=475, subagent:other=286, vscode=212, exec=52, cli=40",
        "rollout DB stale rows": "0"
      },
      "remediation": null,
      "durationMs": 738
    },
    "system.environment": {
      "id": "system.environment",
      "category": "system",
      "status": "ok",
      "summary": "OS language en-US",
      "details": {
        "EDITOR": "not set",
        "GH_PAGER": "set",
        "GIT_PAGER": "set",
        "LANG": "en_US.UTF-8",
        "LC_ALL": "C.UTF-8",
        "LC_CTYPE": "C.UTF-8",
        "PAGER": "set",
        "VISUAL": "not set",
        "os": "Mac OS 26.6.1 [64-bit]",
        "os language": "en-US",
        "os type": "Mac OS",
        "os version": "26.6.1"
      },
      "remediation": null,
      "durationMs": 4
    },
    "terminal.env": {
      "id": "terminal.env",
      "category": "terminal",
      "status": "ok",
      "summary": "terminal metadata was detected",
      "details": {
        "COLORTERM": "truecolor",
        "NO_COLOR": "1",
        "TERMINFO": "/Applications/Ghostty.app/Contents/Resources/terminfo (dir)",
        "TERM_PROGRAM": "ghostty",
        "color output": "disabled (NO_COLOR)",
        "effective locale": "C.UTF-8",
        "stderr is terminal": "false",
        "stdin is terminal": "false",
        "stdout is terminal": "false",
        "terminal": "Ghostty",
        "terminal size": "80x24",
        "terminal version": "1.3.1"
      },
      "remediation": null,
      "durationMs": 11
    },
    "terminal.title": {
      "id": "terminal.title",
      "category": "title",
      "status": "ok",
      "summary": "terminal title default",
      "details": {
        "terminal title activity": "true",
        "terminal title items": "activity, project-name",
        "terminal title project source": "cwd",
        "terminal title project value": "Projects",
        "terminal title source": "default"
      },
      "remediation": null,
      "durationMs": 0
    },
    "updates.status": {
      "id": "updates.status",
      "category": "updates",
      "status": "ok",
      "summary": "update configuration is locally consistent",
      "details": {
        "cached latest version": "0.147.0",
        "check for update on startup": "true",
        "last checked at": "2026-08-17T05:54:20.490686Z",
        "latest version": "0.147.0",
        "latest version status": "current version is not older",
        "update action": "standalone installer",
        "version cache": "<HOME>/.codex/version.json"
      },
      "remediation": null,
      "durationMs": 291
    }
  }
}
What issue are you seeing?

When ChatGPT Desktop Remote and Codex CLI Remote Control are active on the same Mac/account, CLI-originated chats are visible in both the desktop app and the iOS ChatGPT Remote chat list, but they cannot be opened from the phone.

The desktop app shows CLI-originated chats with a lock indicator. On iOS, tapping the same chat returns:

Error loading messages: Codex server returned an error.

Desktop-originated chats continue to open successfully on the same iPhone, so the phone connection, account, pairing, and desktop Remote host are working. Fresh CLI chats fail in the same way.

The CLI Remote Control transport repeatedly logs:

target: codex_app_server_transport::transport::remote_control::websocket
HTTP 409 Conflict
{"detail":"Remote app server already online"}

This occurs before mobile message loading and appears to be a relay ownership collision between the Desktop and CLI Remote app servers, rather than missing local transcript data.

A workaround was observed after quitting the desktop app and rebooting/restarting the CLI session: CLI Remote could take over and the iPhone could open the CLI-originated chat. That workaround prevents normal simultaneous use of Desktop and CLI Remote.

What steps can reproduce the bug?
  1. Sign into Codex CLI with ChatGPT on a Mac.
  2. Pair ChatGPT Remote on an iPhone and confirm that chats created by the ChatGPT desktop app open successfully on the phone.
  3. Leave the ChatGPT desktop app running with its working Remote connection.
  4. Start CLI Remote Control with codex remote-control start.
  5. Start a fresh chat from Codex CLI.
  6. Observe that the CLI chat appears in the desktop app with a lock indicator and also appears in the iOS Remote chat list.
  7. Tap the CLI-originated chat on the iPhone.
  8. Observe: Error loading messages: Codex server returned an error.
  9. Inspect the structured CLI log target codex_app_server_transport::transport::remote_control::websocket; it repeatedly reports HTTP 409 with {"detail":"Remote app server already online"}.
  10. Quit the desktop app and reboot/restart the CLI session. In the observed workaround, CLI Remote then takes ownership and the iPhone can open the CLI chat.
What is the expected behavior?

Desktop Remote and CLI Remote Control should either coexist for the same account and Mac, or perform an explicit, reliable ownership handoff. A CLI-originated chat that appears in the iOS Remote chat list should load its messages when opened. The relay should not retain or assign ownership in a way that makes the CLI app server receive Remote app server already online while the thread remains visible but unusable.

Additional information

The Desktop and CLI enrollments were distinct local records. The Desktop record had a named desktop client, while the CLI/headless enrollment used a blank client name. Removing only the stale CLI enrollment caused it to be recreated with the same identity, and the relay continued returning HTTP 409; the Desktop enrollment was not altered. This suggests that deleting the local row alone does not clear the relay-side owner/lease.

A clean local app-server start also showed matching CLI and app-server versions, so local version skew was ruled out.

Possibly related:

Structured CLI logs contain hundreds of repeated Remote WebSocket connection attempts returning HTTP 409 over three days. These are reconnect attempts, not unique chats. The response body is {"detail":"Remote app server already online"}.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the desktop/CLI ownership collision on codex-cli 0.147.0 on macOS and trace the remote-control request that returns HTTP 409. Compare the CLI and iOS chat-opening paths; done when iOS can open CLI chats without the collision response and regression coverage verifies the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, macos, rust
Domain
api, cli, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.