Skip to content

Codex Desktop: expose opt-in local Terminal API for visible terminal tabs #25586

Open

Description

@sky-zhang01

What feature would you like to see?

Expose an opt-in, local-only API for Codex Desktop visible terminal tabs, so trusted local controllers can list/create/write to the terminal tabs that are already visible in the Codex Desktop app without relying on keyboard/Accessibility/PTY input emulation.

Suggested shape:

  • Terminal/list: list visible Codex Desktop terminal tabs with stable terminalId, title, cwd, shell, busy/closed state, and owning window/thread metadata where available.
  • Terminal/create: create a new visible Codex Desktop terminal tab with optional cwd/profile/title metadata and return its terminalId.
  • Terminal/write: write text to a specific visible terminal tab by terminalId; never use implicit focused target semantics. Ideally support submit: true/false instead of requiring clients to append Enter manually.
  • Terminal/runAction: bounded terminal actions such as interrupt, clear, resize, close, or restart, again by explicit terminalId.

This is related to #15355, but the request here is specifically for Codex Desktop's integrated terminal tabs, not only the standalone CLI/TUI.

Why this matters

Codex Desktop already provides visible terminal tabs, which makes them a good control surface for local orchestration and cross-tool workflows. The missing piece is a supported local ingress API.

Today, local controllers that want to send a prompt or command to a visible Codex Desktop terminal tab must fall back to brittle UI/input emulation, for example:

  • Accessibility focus checks and paste/Return
  • AppleScript keyboard events
  • terminal multiplexer send-keys
  • direct PTY writes in other terminal hosts

Those approaches are unsafe for this workflow because text can land in the wrong place:

  • the Codex chat composer instead of the terminal
  • the wrong terminal tab
  • a shell tab instead of a teammate CLI route
  • a teammate CLI route instead of a shell tab
  • a non-empty draft or human typing state

A stable terminalId API would let local orchestrators fail closed instead of guessing from focus state.

What I observed

On macOS Codex Desktop codex-cli 0.135.0-alpha.1, the public app-server schema exposes useful process primitives such as command/exec, command/exec/write, and PTY-related output notifications.

Those are useful, but they are app-server-managed processes. They do not address an existing visible Codex Desktop terminal tab by stable tab/session identity.

The Desktop app itself appears to already have internal terminal operations such as terminal-create, terminal-attach, terminal-write, terminal-run-action, terminal-resize, and terminal-close between the renderer and Electron main process. The missing part is a supported external/local API boundary with explicit identity, authorization, and audit semantics.

Why existing paths are close but not enough

  • command/exec / command/exec/write: good for managed app-server processes, but not the same UX or evidence surface as writing to an existing visible Codex Desktop terminal tab.
  • queued turns / TUI follow-up work such as feat: expose queued turn app-server RPCs #23619 and feat: queue TUI follow-ups through app-server #25258: directionally useful for Codex turn scheduling, but they do not solve arbitrary visible terminal-tab input for local teammate CLIs or shell tabs.
  • Accessibility / keyboard emulation: works only as a fragile local workaround and cannot provide reliable target identity, route metadata, or auditability.
  • broad remote control: larger than needed. This can be local-only, opt-in, and same-user scoped.

Safety requirements

A supported API should fail closed unless the caller can address a specific terminal session by stable id. Recommended guardrails:

  • local-only by default, ideally Unix socket or existing app-server local auth/capability-token model
  • explicit terminalId; no focusedTerminal write endpoint
  • visible/auditable writes, with payload preview or payload hash in logs/events
  • non-empty draft/input-state detection where feasible
  • route metadata so a controller can distinguish shell, Codex CLI, Claude Code, OpenCode, or other teammate CLI tabs
  • one-writer lock or conflict signal for concurrent writes
  • output/closed notifications for transcript and lifecycle tracking

Suggested direction

If this fits the app-server direction, a small first step could be exposing Desktop terminal session enumeration and write by id:

  • Terminal/list
  • Terminal/write
  • Terminal/outputDelta or equivalent audit/output notification

Terminal/create and Terminal/runAction could follow later.

The goal is not to bypass the visible UI. The goal is the opposite: keep the terminal tab visible while replacing focus/keyboard emulation with an explicit, auditable, local API.

Activity

  1. added
    enhancementNew feature or request
    appIssues related to the Codex desktop app
    app-serverIssues involving app server protocol or interfaces
    on Jun 1, 2026
  2. barneysspeedshop commented on Oct 18, 2026

    @barneysspeedshop

    Adding a concrete desktop ↔ mobile use case from Rope Notes, a Flutter development workspace with an Android client that connects to a paired desktop through Codex Remote Control/app-server.

    We want to start a shell command in Codex Desktop's integrated terminal, continue viewing and interacting with that same shell from Android, and return to desktop with the commands and output visible in the original terminal tab. The reverse should also work: a terminal opened remotely should be discoverable and visible on desktop.

    Currently, Rope can create an interactive PTY using command/exec, stream output, send input, resize, and terminate that process. However, that shell is separate from the terminal visible in Codex Desktop. We haven't found a documented API to enumerate or attach to the desktop-visible sessions. Sharing the conversation alone doesn't provide shell continuity.

    The capabilities we need are:

    • Enumerate eligible terminal sessions with stable IDs, shell, cwd, title, lifecycle state, and workspace/chat association.
    • Attach to an existing session and receive live output, plus bounded scrollback or a replay cursor to recover output missed while disconnected.
    • Send input, interrupt the current command without destroying the shell, and resize the PTY.
    • Detach or reconnect without terminating the shell or its running processes.
    • Keep the same session visible in Codex Desktop's existing terminal UI, including input and output originating on mobile.
    • Expose these operations to an explicitly authorized paired remote client, preserving the desktop's permission boundaries. Clear handling of simultaneous input and competing resize requests would help avoid accidental interference.

    For example: start a build or test watcher on desktop, check its output or send Ctrl-C from the phone, then return to the same desktop terminal with its working directory, environment, and process state intact. We would prefer a supported terminal-session API over requiring users to install a terminal multiplexer or automate desktop focus and keystrokes.

    This extends the local-controller request in this issue to paired remote clients; the underlying need is the same explicit identity and control of the desktop-visible terminal session. Related terminal inventory work in #20907 also looks relevant, especially if output subscription/replay can be supported alongside discovery.

    Prepared with AI assistance at my request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appapp-serverIssues involving app server protocol or interfacesenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions