codex icon indicating copy to clipboard operation
codex copied to clipboard

[macOS Desktop 26.1111] New chat creates a thread, the first send creates a second one — the empty 0-turn thread stays loaded as a blank chat

Open WGooold opened this issue 1 week ago • 2 comments

What version of the Codex App are you using (From “About Codex” dialog)?

Desktop 26.1111.21308 (production channel), bundled engine 0.169.0-alpha.11.1 (engine reports app_server.client_version="26.1111.21308"). macOS 27.2 (26B123), Apple Silicon / arm64. Local (non-remote) desktop execution.

What subscription do you have?

Not collected for this report.

What platform is your computer?

macOS desktop app, local execution, chat created inside an existing project.

What issue you are seeing?

One new-chat flow produces two engine threads, and the blank one stays behind.

Measured from the engine's own otel spans in ~/.codex/logs_2.sqlite (nothing inferred from UI or from a proxy):

  • Opening a new chat (navigating to an empty composer) already issues thread/start on the app's engine connection (app_server.connection_id=0, app_server.client_name="Codex Desktop").
  • Pressing send with the first message issues a second thread/start on the same connection, and the first turn/start is dispatched into that second thread 277–330 ms after it was created. The message never enters the first thread.
  • The first thread stays at 0 turns, receives no turn_input at all, is absent from thread/list (the app's own catalog), and in one sample is backed by an empty rollout file (rollout-…-<thread>.jsonl, zero turn_context records). In other samples it has no rollout file, so reading it returns no rollout found for thread id ….

Four consecutive samples (local time, same app session, project = one workspace):

# thread created on "new chat" thread created on the first send first turn dispatched into Δ(create → turn)
1 01a1f46f-c01e… 23:32:06.889 01a1f46f-f733… 23:32:21.004 f733 293 ms
2 01a1f472-39d8… 23:34:49.135 01a1f472-fc2b… 23:35:38.886 fc2b 330 ms
3 01a1f477-a88c… 23:40:45.156 01a1f477-d677… 23:40:56.934 d677 280 ms
4 01a1f266-c9e5… 14:03:05.062 01a1f266-e783… 14:03:12.001 e783 277 ms

(4/4 over two app sessions; the "new chat" thread was never the one that ran the turn.)

Excerpts from the engine's own spans (paths and ids shortened):

# "new chat"
app_server.request{otel.name="thread/start" rpc.request_id=thread/start:… app_server.connection_id=0
  app_server.client_name="Codex Desktop" app_server.client_version="26.1111.21308"}
  :app_server.thread_start.create_thread:thread_spawn:session_init:shell_snapshot{thread_id=01a1f477-a88c…}

# send (11.8 s later, same connection)
app_server.request{otel.name="thread/start" rpc.request_id=thread/start:… app_server.connection_id=0
  app_server.client_name="Codex Desktop"}…:shell_snapshot{thread_id=01a1f477-d677…}

# 280 ms later the user message is dispatched into the *second* thread
session_loop{thread_id=01a1f477-d677…}:submission_dispatch{… codex.op="turn_input"}

Read-back through the engine's own app-server RPCs (read-only):

a88c (created on "new chat"): status=idle, turns=0, path=<rollout file, 0 turns>, in thread/list: NO
d677 (created on send)      : status=active, turns=1, name matches the typed line, in thread/list: YES

A third thread/start also appears at send time, but it is ephemeral: true with threadSource: "thread_title" (title generation) — expected, not part of this report.

What steps can reproduce the bug?

  1. macOS desktop app, open a chat inside a project.
  2. Navigate to a new chat (empty composer) — engine logs thread/start; a thread id now exists.
  3. Type one short line and press send.
  4. Engine logs a second thread/start; the user message (turn_input) is dispatched into the second thread 277–330 ms after it was created.
  5. Inspect: the first thread has 0 turns, is missing from thread/list, and reads as no rollout found (or an empty rollout).

The exact timing between steps 2 and 3 does not matter in our samples (7.6 s, 11.8 s, 14.1 s, 49.7 s — all reproduced).

What is the expected behavior?

  • The first send should reuse the thread that the new-chat composer already created (same thread.id), or the composer should not create an engine thread before the first message.
  • A preparatory/prewarmed thread must not stay loaded, un-archivable and catalogued in a way that external app-server clients list it as a session.
  • If a prewarmed thread is intentionally discarded, it should be released (and ideally archived/deleted) at that moment, not left with 0 turns.

Why this matters beyond the app's own sidebar

Any client that attaches to the same app-server and lists loaded threads (mobile bridges, remote-control, IDE extensions) mirrors the leaked 0-turn thread as a real session. On our side it surfaces as a blank chat that opens with no rollout found for every message sent afterwards. The extra thread is invisible in the app's own thread/list, which is why it looks like a phantom.

What was ruled out in this measurement

  • No thread/archive, thread/unarchive, thread/revert, thread/delete or turn/interrupt was issued by any other connection in the affected windows.
  • During the final sample the only non-GUI client was a read-only observer issuing initialize, thread/loaded/list, thread/read, thread/turns/list (no thread/resume, no turn/start).
  • The thread_title ephemeral thread is separate and expected.

Related reports

Same family of "blank / ghost chat" symptoms, but without the two-thread/start mechanism documented above:

  • #53209 (blank ghost chats, missing rollout, macOS)
  • #39567 (un-archivable ghost thread, Windows)
  • #60807 (ghost chats left by project chat creation)

Suggestion for instrumentation

Log the reason for each thread/start (composer prewarm vs first turn) and assert that the first turn/start for a fresh composer targets the composer's current thread.id; if it does not, drop the prewarmed id explicitly instead of leaving it loaded.

WGooold avatar Nov 19 '26 15:11 WGooold

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #61164

Powered by Codex Action

github-actions[bot] avatar Nov 19 '26 15:11 github-actions[bot]

Reviewed the suggestion. #61164 is related but not a duplicate of this report, and #61164 was itself closed by a maintainer in favour of #45220.

What #61164 / #45220 leave open is precisely what is measured here:

  • #61164: "prewarmed-thread visibility, expiry cleanup, or notification ordering" — a plausible area, with "no deterministic race reproduction or proof of the failing implementation branch".
  • #45220 ("Investigation limits"): "The initiating UI event and whether the individual request was prewarm are not established."

This report settles both, deterministically:

  1. Initiating UI event = opening a new chat composer. thread/start is issued before any text is sent; no user turn exists.
  2. The prewarmed thread is then discarded at send: the same GUI connection (app_server.connection_id=0, client_name="Codex Desktop") issues a second thread/start, and the first turn/start is dispatched into that second thread 277–330 ms after it was created. The prewarmed thread keeps 0 turns, receives no turn_input, and is absent from thread/list.
  3. 4/4 over two app sessions — 23:32:06.889 → 23:32:21.004 → +293 ms; 23:34:49.135 → 23:35:38.886 → +330 ms; 23:40:45.156 → 23:40:56.934 → +280 ms; 14:03:05.062 → 14:03:12.001 → +277 ms. Deterministic, not intermittent.
  4. The prewarmConversation path found during the #61164 investigation is still present in 26.1111.21308 (app.asar), so this is the same area of the app one version later.

So: same defect family as #45220, plus the missing deterministic reproduction and the leaking step. If a single tracker is preferred, #45220 is the natural home — it already absorbed #61164. I have posted the mechanism summary there; happy to close this one on request.

WGooold avatar Nov 19 '26 15:11 WGooold