Skip to content

app-server: no way to list running sessions or steer one, and nothing marks liveness outside the daemon #36571

Open

Description

@hampsterx

Summary

There is no supported way to list which Codex sessions are currently running, or to send input to one mid-turn, even though the app-server protocol already models both.

Per the schema emitted by codex app-server generate-json-schema, thread/list returns a per-thread status (notLoaded | idle | active | systemError), and turn/steer / turn/interrupt act on an in-flight turn. That surface is only reachable through the app-server daemon, and nothing about a running session is persisted outside it. For anyone running several agents in parallel terminals, the capability is effectively unavailable.

Environment

  • codex-cli 0.146.0, installed via npm
  • Linux

What I can verify

A running session is indistinguishable from a finished one in the persisted store.

I have a TUI session running right now. Its thread row in ~/.codex/state_5.sqlite:

id            019fc100-eebe-7ec0-83a9-9d3b4acedd13
cwd           /home/me/project
git_branch    feat/some-branch
source        cli
thread_source user
updated_at    1785652655
archived      0

A thread from a codex exec run that finished an hour earlier has the same shape, differing only in source and updated_at. The threads table has no status, no pid, and no liveness column of any kind, so there is no offline way to tell the two apart:

id, rollout_path, created_at, updated_at, source, model_provider, cwd, title,
sandbox_policy, approval_mode, tokens_used, has_user_event, archived, archived_at,
git_sha, git_branch, git_origin_url, cli_version, first_user_message,
agent_nickname, agent_role, memory_mode, model, reasoning_effort, agent_path,
created_at_ms, updated_at_ms, thread_source, preview, recency_at, recency_at_ms,
history_mode, name, is_pinned

Everything else useful for a fleet view is already persisted there: cwd, git_branch, git_origin_url, source, name. Liveness is the only missing piece.

The daemon is not startable on an npm install.

$ codex app-server daemon start
Error: managed standalone Codex install not found at ~/.codex/packages/standalone/current/codex
This command requires the standalone install managed by the Codex installer, [...]

So for npm users the protocol surface above is not reachable at all without switching install methods.

What I could not verify

Because of the above, I could not test whether a TUI session started in a separate terminal registers with a running daemon and shows up in thread/list as active. If it does, the gap is narrower than it appears and is mostly about the npm install path and discoverability. If it does not, then status only ever describes threads the daemon itself launched, and terminal sessions are permanently invisible to it.

I would appreciate a maintainer confirming which of those is the case, since it determines whether this is a docs issue or a feature gap.

Why it matters

Running several agents in parallel terminals, there is no way to check whether two of them are working in the same repository or on the same branch before they collide, and no way to redirect one mid-turn without switching to its terminal. External reconstruction requires matching live PIDs to /proc/<pid>/cwd and then guessing which rollout belongs to which process by cwd and mtime, which is ambiguous as soon as two sessions share a directory.

Proposal

Have the TUI register its thread with the app-server daemon when one is running, so the existing thread/list status, turn/steer, and turn/interrupt apply to terminal sessions unchanged.

Failing that, persisting a liveness record (pid + thread id + status) alongside the existing thread metadata would let any client build the listing without a daemon at all.

Related

Activity

  1. added
    enhancement
    CLI
    app-server
    session
    on Aug 2, 2026
  2. github-actions commented on Aug 2, 2026

    @github-actions
    Contributor

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

    Powered by Codex Action

  3. briancl2 commented on Aug 6, 2026

    @briancl2

    Adding bounded parent/child recovery evidence from a sanitized Desktop investigation: https://github.com/briancl2/build-meta-analysis/issues/1559#issuecomment-5207186363

    Two child tasks entered waitingOnApproval on nonessential advisory calls. The parent could queue corrective prose, but it could not resolve the exact approval request or interrupt the child turn through the high-level task surface; the correction could not cross the pending approval boundary. The owning Desktop UI could Stop/deny it.

    Current app-server docs already expose approval decision/cancel and turn/interrupt; the observed gap is high-level parent exposure plus exact request/turn ownership, not absence of lower-level primitives. A scoped parent API should list affected live children and allow decline/cancel/interrupt by exact request/turn ID, with ownership checks and immutable resolved-state readback.

    Claim ceiling: one macOS Desktop transfer; no claim about terminal/CLI sessions or all app-server clients.

  4. SipengXie2024 commented on Oct 28, 2026

    @SipengXie2024

    Adding a current Linux data point: with a local CLI build based on rust-v0.165.0, the native Unix-socket app-server can provide a common thread set to multiple clients when they all connect to that same server instance.

    The launch shape I used is:

    # Keep this server running in one terminal.
    umask 077
    mkdir -p "${CODEX_HOME:-$HOME/.codex}/shared-cli"
    codex app-server --listen "unix://${CODEX_HOME:-$HOME/.codex}/shared-cli/server.sock"
    
    # In each client terminal:
    codex --remote "unix://${CODEX_HOME:-$HOME/.codex}/shared-cli/server.sock"

    Here codex denotes the local 0.165.0-based build. The shared transport and runtime are the native app-server; no additional broker or inter-process history writer is involved. The CLI /agents picker provides access to conversations hosted by that server.

    I verified the transport with two real initialized Unix WebSocket clients against the built app-server, without model calls:

    • Client A created a thread. Client B created another thread and resumed A's existing thread.
    • B changed the shared thread's name. A received thread/name/updated and read back the same name.
    • thread/loaded/list included both threads.
    • Closing B left A connected and able to read the shared thread.

    This establishes shared thread access, notification delivery, and independent client disconnects in that configuration. It does not validate an active model turn, simultaneous steering, approval handling, or non-Linux clients.

    The ownership boundary is important for the question in this issue: clients connected to one app-server can inspect that server's loaded threads. A separate app-server or an independently running CLI retains its own live runtime; sharing a history directory does not attach or take over that running conversation. I left the existing daemon and its sessions untouched.

    A documented CLI workflow for selecting the shared server, listing its loaded threads, and explicitly targeting a conversation would make this native route easier to use. The documentation should distinguish a loaded thread from an attached interactive frontend, and same-server access from cross-process takeover.

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

    CLIapp-serverenhancementsession

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions