Skip to content

Stop policy execution after rejection#36

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

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

Conversation

Copy link

Copilot AI commented Nov 17, 2025

Policies in an array were all invoked sequentially even after one called reject(). The rejected flag prevented controller execution but didn't stop subsequent policies from running their logic.

Changes

  • Added early-exit check in policy loop when this.rejected is true
  • Prevents unnecessary policy invocations after rejection occurs
for (let i = 0; i < this.policyList.length; i++) {
  if (this.rejected) {
    break;
  }
  // ... rest of policy execution
}

Impact

Given ['correctPolicy', 'rejectingPolicy', 'secondPolicy']:

  • Before: All three policies execute, controller blocked
  • After: Only first two execute, loop breaks on rejection

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 17, 2025 22:17
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 in response to PR #32 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