Sitelet https://github.com/microsoft/TypeAgent/pull/3128
Skip to content

[Macro] Fix macro cancellation, learning, and approval bugs - #3128

Open
George Ng (GeorgeNgMsft) wants to merge 3 commits into
mainfrom
georgengmsft-macro-review-fixes
Open

George Ng (GeorgeNgMsft) wants to merge 3 commits into
mainfrom
georgengmsft-macro-review-fixes

Conversation

@GeorgeNgMsft

@GeorgeNgMsft George Ng (GeorgeNgMsft) commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

This PR follows up on #3118 and fixes five problems with recording, learning, and approving reusable macros. It makes cancellation stop unfinished learning, fixes cases where valid recordings or inputs were rejected, and prevents approval or disable operations from leaving conflicting or inconsistent macros behind.

  • Make Cancel stop background learning. Previously, Cancel could report success while learning continued and approved a macro. Recording status now includes the current learning job, so cancellation reaches that job and status commands can show its progress or errors.
  • Learn from the result the runner actually sees. Some MCP tools return a wrapper around their useful result. Learning previously built checks against the wrapper, then rejected them when checking the result shown to the model. It now consistently uses that captured result while preserving ordinary replay behavior.
  • Check for conflicting request patterns when approving. Two macros prepared before either was approved could both claim the same request. Approval and recovery now check against the latest approved macros, without regenerating rules or running tools, so an older draft cannot introduce a conflict that would have been rejected during preparation.
  • Allow object-valued inputs. Valid inputs such as a repository selection containing both an owner and a name were rejected by the generated action schema. The schema now accepts those object contents while retaining input validation, including coverage for nested objects and arrays containing objects.
  • Allow disabling a macro while an updated draft awaits review. Disabling could fail because it tried to reuse a version number already occupied by the pending draft. Version allocation now preserves existing versions, and an old draft cannot later replace a newer approval or undo a disable.

Regression tests cover these scenarios, and the related documentation is updated. The build, all 210 targeted tests, formatting, and repository quality checks passed locally. Hosted CI and live model/tool execution were not part of those local checks.

NFA grammar refresh is intentionally not included. Approving a macro still does not grant permission to execute its tools.

Revalidate staged grammar at approval, preserve open object inputs, and allocate lifecycle versions above pending immutable drafts. Follow up on #3118 without changing NFA refresh.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@GeorgeNgMsft George Ng (GeorgeNgMsft) changed the title Fix macro learning cancellation, grounding, and publication Fix macro cancellation, learning, and approval bugs Oct 2, 2026
@GeorgeNgMsft
George Ng (GeorgeNgMsft) marked this pull request as draft October 2, 2026 21:24
Require a current approved source when publishing learning adaptations. Keep identical saved drafts idempotent without changing the catalog, and recheck source provenance during approval and recovery.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@GeorgeNgMsft George Ng (GeorgeNgMsft) changed the title Fix macro cancellation, learning, and approval bugs [Macro] Fix macro cancellation, learning, and approval bugs Oct 2, 2026
@GeorgeNgMsft
George Ng (GeorgeNgMsft) marked this pull request as ready for review October 3, 2026 00:21

This branch has not been deployed

No deployments
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.

2 participants