🤖 feat: add ACP (Agent-Client Protocol) support for editor integration#2456
🤖 feat: add ACP (Agent-Client Protocol) support for editor integration#2456
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e12edb2352
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
70f72cd to
37ec5ee
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 264a9f2a5f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 711af1d3c2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a66b8a0a9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48e01e8be7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eaf8ccf2ce
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e9bbd50d9b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a1b52ff1b5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 08c3967bef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2d67d1e598
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3116ddf2b0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2efc6d3417
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e22c7d323a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f0c8567714
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- revert the dist-main alias and switch ACP integration build step back to make build-main - add a defensive stream-start fallback in ACP turn correlation for live events missing acpPromptId - keep correlation-first behavior and replay safeguards; fallback only applies to first non-replay start - add regression coverage for prompt completion when live stream-start/end omit acpPromptId --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$122.14`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=122.14 -->
- persist ACP prompt correlation id on user message metadata and in message schema parsing - tighten stream-start fallback by requiring live uncorrelated starts to be newer than turn start - add diagnostic warning when uncorrelated fallback is used - add regression coverage for stale uncorrelated stream-start events - add schema test for preserving acpPromptId metadata --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$122.14`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=122.14 -->
Tightens ACP robustness around session/subscription cleanup, prompt turn correlation, and delegated tool behavior. - Adds idle/LRU ACP session eviction and per-session cleanup across agent/session/tool/translator state - Fixes onChat mode mismatch handling by reconnecting subscriptions when mode changes - Adds turn correlation timeout to prevent indefinite prompt hangs - Adds bounded chat buffering under output backpressure - Promotes ACP correlation/delegation fields in SendMessageOptions and preserves metadata compatibility - Adds file-tool delegation timeouts and router session cleanup API - Expands ACP regression coverage for timeout, eviction, and cleanup paths --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$125.94`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=125.94 -->
Add ACP CLI support for --log-file to redirect ACP logs from stderr into a file, including async stream setup/cleanup and fallback-to-stderr behavior on sink failure. Also adds CLI help/test coverage and documents the new mux acp option in docs/reference/cli.mdx. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$126.40`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=126.40 -->
Add an ACP integration test that starts the built ACP CLI with --log-file, verifies initialize/newSession still work over stdio, checks ACP logs are written to the file, and ensures ACP-prefixed logs are not emitted to stderr in that mode. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$126.40`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=126.40 -->
Replace the fixed MAX_BUFFERED_CHAT_EVENTS overflow error with bounded upstream backpressure in runChatSubscription. The onChat drain loop now waits for queue capacity, and teardown explicitly releases waiters to avoid deadlocks. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$126.40`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=126.40 -->
Raise the per-test timeout for the new --log-file ACP CLI test to 15s so slower CI runners do not hit bun's default 5s test timeout while still validating log redirection behavior. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$126.40`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=126.40 -->
When stdout backpressure saturates the forwarding queue, keep draining onChat events so stream-end/abort/error can still resolve turns promptly. Non-terminal events are dropped once saturated to preserve liveness, and a regression test now covers high-volume saturation before terminal events. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$126.40`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=126.40 -->
Refine saturated-queue drop policy so only high-volume chunk/replay events are dropped. Lifecycle and control events (including caught-up and tool-call-end) continue to flow, preventing translator state corruption while still avoiding prompt hangs under heavy stdout backpressure. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$126.40`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=126.40 -->
Refine the backpressure drop set so message events are only droppable for replay traffic (replay=true). Live message events are now preserved to avoid losing real-time transcript updates while still allowing saturated replay streams to shed load. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$126.40`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=126.40 -->
Replace the fixed wall-clock turn timeout with an inactivity timeout that refreshes on correlated stream activity. This avoids false failures for long-running but active prompts while still preventing deadlocks when streams go silent. Added regression coverage proving active streams can run past the timeout window without being rejected. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$126.40`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=126.40 -->
Treat message events as droppable under saturation during replay catch-up (before caught-up) in addition to explicit replay=true events. This prevents full-history replays without replay flags from bypassing the saturation drop policy and growing the queue unboundedly under stdout backpressure. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$126.40`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=126.40 -->
Run disconnect-time stream interrupts before tracked-session eviction so session mappings remain available for every active turn. Also treat interruptStream success=false as an explicit disconnect cleanup failure signal (logged), and add regression tests covering multi-turn disconnect interruption ordering and backend interrupt failure handling. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$126.40`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=126.40 -->
In ToolRouter, only treat file_edit_insert read failures as create-file candidates when the error is explicit file-not-found; propagate other read failures instead. Added regression tests for not-found create behavior, guarded missing-file behavior, and non-not-found error propagation. In AIService delegated tool wrappers, remove abort listeners after each delegated call settles to avoid listener accumulation in long-running sessions. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$126.40`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=126.40 -->
Remove uncorrelated stream-start fallback matching to avoid binding active prompts to unrelated streams in shared workspaces. Prompt turns now bind stream-start only when acpPromptId matches, and tests were updated to require correlated terminal/start events where needed. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$126.40`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=126.40 -->
Source ACP agent-mode config options from agents.list instead of a hardcoded list so Auto and other UI-selectable agents are surfaced. Also add a fallback to built-in definitions when partial test harness clients do not expose agents.list, and extend ACP config option tests to verify Auto visibility and ordering. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$127.46`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=127.46 -->
Guard runChatSubscription event handling by subscription token so stale onChat loops cannot process stream events after mode-switch/reconnect replacement. Also add a regression that simulates timed-out teardown with lingering stale events and verifies the active prompt is resolved only by the replacement stream. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$127.46`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=127.46 -->
When a timed-out subscription teardown leaves an old onChat loop running, stop forwarding any buffered backlog once the subscription token is no longer current. This prevents stale replay/tool updates from being emitted after mode-switch/reconnect replacements and keeps live updates from the new stream from being delayed behind obsolete events. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$127.46`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=127.46 -->
c3d04cb to
a078cae
Compare
Document how to configure Zed's `agent_servers` to launch `mux acp`, including portable examples for globally installed `mux` and `npx` usage. Also document remote mux connection options for ACP via `--server-url` / `--auth-token` and their environment variable equivalents (`MUX_SERVER_URL`, `MUX_SERVER_AUTH_TOKEN`). --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$133.49`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=133.49 -->
|
@codex review Added ACP docs updates for Zed setup and remote server flags/env vars in |
|
Codex Review: Didn't find any major issues. Nice work! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Add first-class ACP (Agent Client Protocol) support to Mux so external editors can create/manage sessions, send prompts, and receive structured live updates over ACP.
Background
This PR wires Mux into ACP as an editor-facing protocol surface (for clients like Zed/VS Code integrations), then hardens the integration for real-world streaming races and reconnect behavior.
Implementation
ACP surface area
mux acp) for local stdio ACP serving.Stability and correctness hardening
acpPromptIdmatching when available,Automode.Test coverage
Validation
bun test ./tests/ipc/acp.promptCorrelation.test.ts ./tests/ipc/acp.configOptions.test.ts ./tests/ipc/acp.sessionMethods.test.tsmake static-checkRisks
Primary risk area is ACP stream/event ordering under rare transport/reconnect races. This PR mitigates that with token-based subscription ownership checks and targeted regressions, but the area remains concurrency-sensitive and should be monitored in editor-integration rollouts.
Generated with
mux• Model:openai:gpt-5.3-codex• Thinking:xhigh• Cost:$127.46