Codex Desktop macOS: read_thread_terminal cannot see a working integrated terminal
Summary
In Codex Desktop on macOS, the integrated terminal is open and fully functional, but the agent-side read_thread_terminal tool cannot read it and always returns:
No app terminal session is attached to this thread yet.
The desktop logs show that the visible route uses the permanent thread ID while panel/session ownership continues to use a temporary client-new-thread:... ID. This appears to prevent the terminal snapshot lookup from finding the current thread's terminal.
Environment
- Codex Desktop:
26.623.141536(build4753) - Bundled Codex CLI:
0.142.5 - macOS:
26.5.1(25F80) - Architecture: Apple Silicon (
arm64) - Authentication: ChatGPT
- Thread type: local/projectless desktop thread
Actual behavior
- The integrated terminal opens inside the Codex app.
- Commands run normally.
codex doctor --allreports that stdin, stdout, and stderr are TTYs, withTERM=xterm-256color, and correctly identifies the current project. - Asking the agent to inspect the current terminal invokes
read_thread_terminal. - The tool responds that no app terminal session is attached.
- The same failure occurs with a second terminal tab.
Relevant sanitized desktop-log pattern:
conversationId=client-new-thread:<temporary-id>
ownerRoutePath=/local/<permanent-thread-id>
The IDs remain different after switching to another chat and returning.
Expected behavior
The terminal session visible in the current thread should be associated with the permanent thread ID, and read_thread_terminal should return the active integrated-terminal snapshot.
This is also the behavior described in the Codex app documentation: Codex can read the current integrated-terminal output.
Steps to reproduce
- Open Codex Desktop on macOS.
- Create a new local/projectless thread.
- Open the integrated terminal in that thread.
- Run:
``sh``
printf 'codex-terminal-check\n'
- Ask the agent to read/check the built-in terminal.
- Observe:
``text``
No app terminal session is attached to this thread yet.
Recovery attempts
- Closed and reopened the terminal panel.
- Created another terminal tab and selected it.
- Switched to another chat and returned.
- Quit and restarted Codex, then created a fresh terminal.
- Confirmed the Codex installation, databases, configuration, authentication, network, and thread inventory pass
codex doctor --all.
The issue persists.
Additional information
No raw logs or full thread identifiers are included here because they can contain private information. A sanitized log excerpt or an in-product /feedback session can be provided if needed.
4 Comments
I traced the shipped Desktop renderer and found the concrete lookup mismatch described here. Terminal sessions are stored under
clientThreadId, whileread_thread_terminalinitially queries by permanent thread ID. The renderer already maintains a permanent-ID → client-ID alias map; the minimal fix is alias-aware snapshot lookup rather than rekeying/restarting the PTY.A related route bug also returns
nullforclient-local-thread, causing the terminal toggle to silently no-op. Full findings, patch pseudocode, and regression cases are in: https://github.com/openai/codex/issues/28141#issuecomment-4953033965I did not open a public PR because these Desktop renderer symbols are not present in the public repository; the public app-server PTY layer does not own Desktop route/session aliases.
Reproduced on a newer macOS Desktop build.
Environment
26.707.72221(build5307)0.144.226.0.1arm64Observed behavior
read_thread_terminalconsistently returns:The visible terminal remains usable throughout.
Recovery attempts
The failure persists.
Sanitized local inspection shows no shell or PTY startup failure. The behavior is consistent with the reported terminal-owner lookup mismatch: the visible terminal exists, but the snapshot lookup for the permanent thread ID resolves no attached session.
No raw logs, task identifiers, filesystem paths, hostnames, account details, network addresses, screenshots, or credentials are included here.
I got the integration working thus recovering from this situation simply by choosing an avatar. I did not choose an avatar during installation.
I could then op-out of the annoying little bagger an still have the terminal connection working.
Additional reproducible evidence on the current macOS build:
Environment
26.820.60940(build7119)0.150.0-alpha.8Reproduction
open_in_codex({ target: { type: "terminal", sessionId } })for the currently visible thread.read_thread_terminal.Actual result
open_in_codexreturnsqueued./bin/zshon a different PTY as a child of the desktop app, with the same working directory.read_thread_terminalreturns that blank UI shell.Sanitized log sequence
open_in_codexcall assuccess=true.client-new-thread:<temporary>/ the home route and the permanent thread becomes inactive.This suggests the queued path may lose or replace the supplied
sessionId, creating a fresh UI PTY instead of attaching the requested backend PTY. Returning success/queued also hides the mismatch.Validated workaround
A shared terminal-multiplexer session joined by both the agent-side shell and the visible UI shell makes the marker visible and allows
read_thread_terminalto return it. This confirms that rendering/read-back works when both clients genuinely share one session, but it is not an acceptable default workaround.Expected
open_in_codexshould preserve the exact supplied session ID across queuing and bind the visible terminal to that backend PTY, or return an explicit attachment failure instead of silently creating another shell.