Skip to content

Codex Desktop message delivery: wake-on-unread mechanism #263

Description

@fujibee

Context

agmsg's existing Codex monitor targets the Codex CLI: it intercepts the codex
command (shell function / opt-in PATH shim) and routes inbound messages as turns via
the bridge + app-server. We'd like the same delivery for Codex Desktop (the GUI
app): inject into the Desktop session when unread mail arrives. The CLI approach
(intercept the launch command) doesn't transfer directly — the Desktop app launches
itself, so there is no command to intercept.

Prior art — PoC in #260

#260 demonstrates a working delivery path (reported working on Windows): it owns a
codex app-server and drives it over WebSocket JSON-RPC — initialize, load a thread,
then start a turn with the message body as the prompt. So messages do reach a Codex
thread. It also adds a supervisor scaffold (project-scoped singleton, heartbeat
liveness, mailbox cursor, single-writer). The committed tests use a mock adapter, so the
in-repo evidence is feasibility-level; the live end-to-end is reported by the contributor.

What's open for a production path

  1. Stable/supported transport. The PoC drives codex app-server --listen ws://....
    Recent Codex (0.142+) reworked the app-server surface (managed daemon + control
    socket in place of --listen ws://), so this route needs to move onto the current
    supported control surface — the same migration the CLI monitor faces.
  2. Thread/target selection. --thread loaded assumes a single thread; we need a
    rule for choosing the right Desktop conversation when several exist.
  3. Cross-platform. The PoC has Windows-specific pieces (powershell, taskkill,
    AppData paths) to generalize.
  4. Productionization. Promote the mock-adapter path to a verified live-Desktop
    end-to-end; decide the collector's body-handling boundary (it currently reads the
    body to build the turn).

Question

For anyone running Codex Desktop: what is the most robust way to drive/inject into a
running Desktop session on current Codex versions? Input very welcome.

Out of scope

The one-line codex-bridge.js Windows fix (prepend the bash binary when arming the
watch) is a CLI-monitor improvement, tracked separately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions