Skip to content

Stop policy execution on rejection#35

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

Stop policy execution on rejection#35
Copilot wants to merge 3 commits intoallow-multiple-policiesfrom
copilot/sub-pr-32-another-one

Conversation

Copy link

Copilot AI commented Nov 17, 2025

Policies in an array continue executing after reject() is called. Given policies ['correctPolicy', 'rejectingPolicy', 'secondPolicy'], all three execute even though rejectingPolicy rejects the request.

Changes

  • Added rejection check before invoking each policy in the loop
  • Break immediately when this.rejected is true
for (let i = 0; i < this.policyList.length; i++) {
  if (this.rejected) {
    break;
  }
  // ... invoke policy
}

This ensures rejected requests skip subsequent policies without executing their logic or 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:19
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 address feedback on allowing multiple policies Stop policy execution on 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