fix(workflows): match gate reject option case-insensitively#3335
Open
Noor-ul-ain001 wants to merge 1 commit into
Open
fix(workflows): match gate reject option case-insensitively#3335Noor-ul-ain001 wants to merge 1 commit into
Noor-ul-ain001 wants to merge 1 commit into
Conversation
`validate` accepts a reject option case-insensitively
(`o.lower() in {"reject", "abort"}`), so a gate authored as
`options: [Approve, Reject]` passes validation. But `execute`
compared the echoed choice case-sensitively, so picking `Reject`
fell through to the approval path and silently ran downstream
steps instead of aborting.
Lower-case `choice` before the reject comparison so the runtime
agrees with the validation that let the option through.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A gate step authored with capitalised options — e.g.
options: [Approve, Reject]— passesvalidate()but never aborts on rejection. Picking Reject silently falls through to the approval path and runs downstream steps.Root cause
validate()accepts a reject option case-insensitively:So
Rejectis a valid reject option and the workflow validates fine. But_promptechoes the option's original casing, andexecute()compared it case-sensitively:The two checks disagree: validation lets
Rejectthrough as a reject option, then the runtime treats the sameRejectpick as approval.on_reject: abortis silently skipped and downstream steps run.Fix
Lower-case
choicebefore the reject comparison so the runtime agrees with the validation that admitted the option:Test
test_gate_reject_matches_case_insensitivelydrives a gate withoptions: [Approve, Reject], forces a TTY, stubs_promptto return the capitalised"Reject", and asserts the run reachesRunStatus.ABORTEDand the downstream step never executes. Fails before the fix, passes after.All 26
test_workflows.pygate tests pass.🤖 Generated with Claude Code