Skip to content

Implement deterministic MCP replay for approved macros - #2881

Merged
Hillary Mutisya (hillary-mutisya) merged 7 commits into
microsoft:mainfrom
hillary-mutisya:copilotMacros_part2
Aug 15, 2026
Merged

Implement deterministic MCP replay for approved macros#2881
Hillary Mutisya (hillary-mutisya) merged 7 commits into
microsoft:mainfrom
hillary-mutisya:copilotMacros_part2

Conversation

@hillary-mutisya

Copy link
Copy Markdown
Collaborator

This pull request adds comprehensive support for Copilot macro management to the agent server and protocol. It introduces new API methods for listing, searching, inspecting, creating, validating, approving, disabling, deleting, and running macros, as well as retrieving macro run information. The implementation is integrated across the protocol, client, server, and test layers, and updates the macro manager to use a replay host.

Macro Management API Additions:

  • Added new types and API methods for macro management to the protocol, including listMacros, searchMacros, inspectMacro, getMacroRequirements, createMacroFromTrace, validateMacro, approveMacro, disableMacro, deleteMacro, runMacro, cancelMacroRun, and getMacroRun in both the client and server implementations. [1] [2] [3]

  • Updated the protocol exports to include all new macro-related types, ensuring they are available for use throughout the codebase. [1] [2]

Server and Macro Manager Integration:

  • Modified server startup and in-process server logic to instantiate MacroManager with a McpReplayHost, enabling macro replay and inspection features. [1] [2]

Testing Enhancements:

  • Updated macro recording RPC tests to cover the new macro management API, including end-to-end flows for creating, validating, approving, listing, searching, inspecting, and running macros. [1] [2]

Stub and Adapter Updates:

  • Extended stub and adapter implementations to support the new macro management methods, returning default values or not-implemented errors as appropriate. [1] [2]

Dependency Updates:

  • Added imports for McpReplayHost and related types in server and test files to support replay functionality. [1] [2] [3]

Implements deterministic execution for approved, trace-derived macros without introducing an additional permission model.

- Replays captured MCP calls in order with input and prior-step bindings.
- Adds schema drift validation, dry-run, cancellation, timeouts, audit logging, and bounded sanitized run records.
- Adds source-aware MCP configuration discovery and connection reuse.
- Exposes execution and run inspection through agent-server RPC and the macro MCP server.
- Routes non-replayable calls to agent-guided execution.
Validated with focused macro, replay-host, RPC, and plugin tests, plus the full workspace build.
@hillary-mutisya
Hillary Mutisya (hillary-mutisya) merged commit a0c1614 into microsoft:main Aug 15, 2026
27 checks passed
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