Skip to content

Stop policy execution after rejection#33

Draft
Copilot wants to merge 3 commits intoallow-multiple-policiesfrom
copilot/sub-pr-32
Draft

Stop policy execution after rejection#33
Copilot wants to merge 3 commits intoallow-multiple-policiesfrom
copilot/sub-pr-32

Conversation

Copy link

Copilot AI commented Nov 17, 2025

When multiple policies are configured as an array, all policies were being invoked synchronously even after one called reject(). The rejected flag prevented controller execution but didn't stop subsequent policies from running.

Changes

Added early termination check in policy execution loop:

for (let i = 0; i < this.policyList.length; i++) {
  if (this.rejected) {
    break;
  }
  // ... invoke policy
}

This prevents subsequent policies from executing once any policy rejects, avoiding unnecessary evaluations and potential side effects.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits November 17, 2025 22:18
Co-authored-by: charliemitchell <8126582+charliemitchell@users.noreply.github.com>
Co-authored-by: charliemitchell <8126582+charliemitchell@users.noreply.github.com>
Copilot AI changed the title [WIP] Update to allow multiple policies based on PR feedback Stop policy execution after rejection Nov 17, 2025
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