Remote Control active task causes duplicate internal message delivery on Windows
Summary
On Codex Desktop for Windows, an internal task-to-task message can be delivered twice when a Remote Control client (iPhone or iPad) has the destination task actively open.
The first delivery is local. A second delivery arrives through the enrolled Remote Control host route with a different message ID. This can duplicate callbacks and potentially repeat downstream actions.
Environment
- Windows Codex Desktop
- Bundled Codex CLI observed: 0.146.0-alpha.9.2
- Remote clients tested: ChatGPT/Codex on iPhone and iPad
- One Windows host enrolled in Remote Control
Deterministic reproduction
- Enroll one iPhone or iPad as a Remote Control client.
- On the mobile client, open the destination Codex task (opening the task is sufficient; sending a mobile message is not required).
- From another local Codex task, send one internal message to the destination task using the calling-host/default route (host omitted).
- Observe two distinct user-message records in the destination task:
- one normal local delivery;
- one Remote Control-wrapped delivery from the enrolled host, with a different message ID.
- Return the mobile client to the task list or close the app. Repeat the send: only one delivery occurs.
A/B results
- Zero remote clients: no duplicate.
- One enrolled client that has not opened the destination task: no duplicate.
- Two enrolled clients that have not opened it: no duplicate.
- iPhone alone actively viewing destination task: duplicate.
- iPad alone actively viewing destination task: duplicate.
- Mobile app open only at task list: no duplicate.
- Desktop showing another task while mobile alone views destination: duplicate.
- Explicitly targeting hostId=local for the receiving task: no duplicate.
- Omitting the recipient host while the remote client views the task: duplicate reproduced.
In the isolation test, local delivery occurred first and the Remote Control copy arrived about 16.7 seconds later. In other active-task trials the second copy sometimes arrived within milliseconds.
Expected behavior
A single internal send should create one logical delivery regardless of whether a Remote Control client is subscribed to the destination task. Remote Control fan-out should not reinsert the same message as a second user message.
Actual behavior
The same payload is persisted twice with distinct message IDs through local and Remote Control routes.
Temporary mitigation
For local destination tasks, explicitly setting hostId=local prevents the duplicate in the tested environment. A stored Remote Control host ID should not be used as send-time routing authority for a local task.
Impact
Duplicate callbacks can cause duplicate processing, repeated external actions, misleading audit trails, or unnecessary no-retry/HOLD recovery flows. The behavior also depends on whether a mobile client currently has the task open, making it difficult to detect.
I can provide sanitized timestamps and additional logs privately if needed. Internal thread IDs, host IDs, and account identifiers are intentionally omitted here.
3 Comments
Additional diagnostic evidence from a later recurrence:
I currently suspect that stale TCP connections in the Desktop app-server may be contributing to this issue.
During the failure state, the owning
codex.exeapp-server process had three IPv6 TCP connections remaining inCLOSE_WAIT. The Codex processes were still responsive, and no corresponding Windows application crash, reliability failure, or network disconnect event was found.After restarting Codex Desktop—but not Windows—the
CLOSE_WAITconnections disappeared. A task-message round trip then succeeded while the iPhone app was closed.Environment for this observation:
26.727.6591.0codex.exe ... app-server --analytics-default-enabledThis is a correlation and working hypothesis, not a confirmed root cause. On the next recurrence, I plan to capture the same diagnostics before recovery and then try restarting only the affected Desktop app-server process, identified from the connection's owning PID, parent process, and command line. The goal is to determine whether this minimal restart clears the stale connections and restores task delivery without restarting the entire Desktop app.
This may also be related to the host-routing/result ambiguity reported in #35394, although the causal relationship is currently unverified.
Follow-up diagnostic update (2026-08-08 JST)
This is additional correlation evidence, not a confirmed root cause.
codex.exe ... app-serverCode Mode host initially hadCLOSE_WAIT=0.CLOSE_WAIT=3(while 6 connections remained established). This was observed without a Windows reboot.Important boundaries / unknowns:
CLOSE_WAITsockets belonged to the global desktop Code Mode host process, not an individual task. There is no known supported way to safely terminate only one such socket or one affected task while preserving the rest of the Code Mode session.CLOSE_WAITstate at startup, but did not prove a durable fix: later task-message behavior was still intermittent.Current environment:
26.727.6591.0on Windowscodex.exe ... app-serverUseful product-side diagnostic direction: expose connection/transport health and reconnect events per logical task-message send, including whether a Remote Control route participates, without requiring users to inspect process sockets. Sanitized timestamps and before/after socket snapshots can be supplied if useful.
Suggested product-side fix / acceptance criteria
The immediate bug should be addressed at the message-delivery boundary, rather than by asking users to choose a host manually or restart the Desktop app.
CLOSE_WAITsockets or restart the entire Desktop app as the ordinary recovery path.Suggested acceptance test:
This would address both the duplicate-delivery symptom and the later intermittent send/readback symptom without turning the user into the recovery mechanism.