Keep ACP configuration notifications atomic - #4479
Merged
Merged
Conversation
ACP SDK extension dispatch can finish after a later response, letting vendor config notifications escape commit or rollback depending on pipe chunking. Consume synchronous vendor transforms at the stream boundary before forwarding later responses, and reproduce coalesced single and burst notifications through a real subprocess.
Contributor
|
| Filename | Overview |
|---|---|
| packages/plugin/src/server/acp-internal/connection.ts | Intercepts vendor notifications in wire order to preserve transaction atomicity, but broadly suppresses unexpected transformer failures. |
| packages/plugin/src/server/acp.test.ts | Strengthens caller-facing subprocess coverage for failed, successful, and rolled-back configuration changes with coalesced notification bursts. |
Sequence Diagram
sequenceDiagram
participant Agent
participant Router as Vendor notification router
participant SDK
participant Transaction as Configuration transaction
participant Events
Agent->>Router: vendor/config notification
Router->>Transaction: Run transformer synchronously
Transaction->>Transaction: Stage derived configuration
Agent->>Router: configuration response
Router->>SDK: Forward response
SDK-->>Transaction: Resolve configuration request
alt Configuration succeeds
Transaction->>Events: Publish one final session.config
else Configuration or rollback fails
Transaction->>Transaction: Discard staged notifications
end
Reviews (1): Last reviewed commit: "fix(acp): keep vendor configuration noti..." | Re-trigger Greptile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Keep plugin ACP configuration changes atomic when an agent sends vendor notifications alongside its configuration response. Successful changes publish one final snapshot; failed changes publish none.
Linked issue
Fixes the SDK test failure on main. No matching open issue or superseded PR found.
Type of change
Reasoning
ACP SDK 1.4 dispatches extension notifications through an asynchronous handler chain while resolving responses independently. If a notification and response arrive together, the response can close our configuration transaction before the SDK invokes the notification callback. The resulting
session.configevent escapes rollback or duplicates a successful commit. Separate subprocess writes made this depend on pipe chunking.The adapter now consumes synchronous vendor transforms at its input stream boundary. Built-in ACP methods and all requests/responses still go through the SDK. This removes the deferred extension callback path; no sleeps, retries, or notification-count suppression are needed. Waiting for the existing notification queue would miss callbacks the SDK has not invoked yet.
Goals
Non-goals
QA
Linux, Node 22.20.0, installed ACP SDK 1.4.0. Reproduction uses a real Node subprocess and SDK connection through
runAcpProvider, without mocks.47171b4, the initial rollback assertion failed 10/10 runs:expected ... length of 1 but got 2.npx vitest run src/server/acp.test.ts --bail=1inpackages/plugin: 21 passed.npx vitest run src/boundaries.test.ts --bail=1inpackages/plugin: 44 passed.npx vitest run src/server/agent/plugin-provider.test.ts --bail=1inpackages/server: 3 passed.npm run build:server,npm run typecheck,npm run lint, andnpm run format: passed.Risk surface: delivery timing of vendor notifications in the plugin ACP adapter, shared by subprocess and connector transports. Existing ACP tests also cover SDK connectors, permission requests, configuration serialization, disconnects, and process shutdown. No live vendor session or macOS/Windows runtime was exercised locally.
Checklist
npm run typecheckpassesnpm run lintpassesnpm run formatpasses