Skip to content

Comments

🤖 feat: add ACP (Agent-Client Protocol) support for editor integration#2456

Open
ThomasK33 wants to merge 105 commits intomainfrom
mux-acp-2bgm-fork-2
Open

🤖 feat: add ACP (Agent-Client Protocol) support for editor integration#2456
ThomasK33 wants to merge 105 commits intomainfrom
mux-acp-2bgm-fork-2

Conversation

@ThomasK33
Copy link
Member

@ThomasK33 ThomasK33 commented Feb 17, 2026

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

  • Added ACP CLI entrypoint and wiring (mux acp) for local stdio ACP serving.
  • Added ACP session lifecycle support (new/list/resume/fork/cancel/config updates).
  • Added ACP stream translation from Mux chat/tool events into ACP session updates.
  • Added ACP tool routing/delegation plumbing and slash-command handling.

Stability and correctness hardening

  • Decoupled turn resolution from stdout backpressure by queueing outbound session updates while processing stream events immediately.
  • Hardened prompt correlation so turns resolve correctly across replay/live timing differences:
    • strict acpPromptId matching when available,
    • guarded fallback for missing IDs using dispatch timestamps.
  • Scoped inactivity timeout behavior to avoid false failures after turns are already correlated.
  • Fixed stale onChat teardown races using subscription tokens, including:
    • rejecting only from the active subscription,
    • ignoring stale stream events,
    • dropping stale buffered backlog after replacement.
  • Updated ACP config options to source selectable modes dynamically and expose Auto mode.

Test coverage

  • Added/expanded ACP regression coverage for:
    • prompt correlation and timeout semantics,
    • stale subscription teardown/replacement races,
    • stale buffered event filtering,
    • config options/mode exposure (including Auto),
    • ACP session method behavior.

Validation

  • bun test ./tests/ipc/acp.promptCorrelation.test.ts ./tests/ipc/acp.configOptions.test.ts ./tests/ipc/acp.sessionMethods.test.ts
  • make static-check

Risks

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

@ThomasK33 ThomasK33 marked this pull request as draft February 17, 2026 11:31
@ThomasK33 ThomasK33 changed the title 🤖 feat: add ACP (Agent-Client Protocol) support for editor integration 🤖 feat: add ACP (Agent-Client Protocol) support for editor integration (Opus 4.6 plan) Feb 17, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@ThomasK33
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@ThomasK33
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@ThomasK33
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@ThomasK33
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@ThomasK33
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@ThomasK33
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@ThomasK33
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@ThomasK33
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@ThomasK33
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@ThomasK33
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@ThomasK33
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@ThomasK33
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@ThomasK33
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

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 -->
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2ec8e37550

ℹ️ 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".

@ThomasK33
Copy link
Member Author

@codex review

@ThomasK33
Copy link
Member Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. 🎉

ℹ️ 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".

@ThomasK33 ThomasK33 marked this pull request as ready for review February 20, 2026 18:06
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e825544017

ℹ️ 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".

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 -->
@ThomasK33
Copy link
Member Author

@codex review

Addressed the stale onChat subscription race by guarding per-event handling with the active subscription token, and added regression coverage for lingering stale stream events after timed-out teardown.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7505ef02e6

ℹ️ 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".

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 -->
@ThomasK33
Copy link
Member Author

@codex review

Applied the queued-event filtering change so stale buffered onChat backlog is dropped once the subscription token is replaced.

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. 🚀

ℹ️ 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".

@ThomasK33 ThomasK33 changed the title 🤖 fix: decouple ACP turn resolution from stdout backpressure 🤖 feat: add ACP (Agent-Client Protocol) support for editor integration Feb 21, 2026
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