Skip to content

Add shared App Server live-peer mode - #348

Draft
moshthepitt wants to merge 6 commits into
agentclientprotocol:mainfrom
moshthepitt:trunkline/live-peer
Draft

Add shared App Server live-peer mode#348
moshthepitt wants to merge 6 commits into
agentclientprotocol:mainfrom
moshthepitt:trunkline/live-peer

Conversation

@moshthepitt

@moshthepitt moshthepitt commented Jul 31, 2026

Copy link
Copy Markdown

Why

ACP client should join Codex thread already open in stock TUI.

stock Codex TUI
        |
same App Server + same thread
        |
ACP client

No shadow session. No TUI scraping. Codex owns transcript.

What

  • CODEX_APP_SERVER_URL attaches to Unix socket or WebSocket.
  • Opt-in _meta.codex.livePeer.version = 1.
  • Keep event, approval, elicitation handlers alive outside ACP-owned prompts.
  • Emit terminal user messages and exact turn start/finish events.
  • Pass clientUserMessageId through prompt and steering; echo it back.
  • Frame authoritative history replay by turn.
  • Report active turn on load/resume.
  • Closing ACP closes its socket. Never shared App Server.

Capability advertisement:

{
  "codex": {
    "livePeer": {
      "version": 1,
      "ambientEvents": true,
      "interactions": true,
      "userMessages": true,
      "clientUserMessageIds": true,
      "turnLifecycle": true,
      "historyReplay": true
    }
  }
}

No live-peer request: old behavior.

Why replay framing

Transport reconnect alone lies. Client can miss completed turn.

Now load emits:

history started
  turn started
  items
  turn finished
history finished

Client can baseline old history, reconcile missed turns, dedupe by native IDs.

Proof

  • Full suite: 340 passed, 28 skipped.
  • Typecheck: pass.
  • Build: pass.
  • Stock Codex CLI 0.146.0:
    • bare TUI and ACP share one thread;
    • both directions render;
    • steering works;
    • approvals still work;
    • history load and runtime capabilities pass.

No Codex version pin. Client gates on negotiated capability.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant