Skip to content

fix: treat cancelled CI runs as non-failing#128

Closed
NiveditJain wants to merge 2 commits into
mainfrom
fix/ci-green-cancelled-runs
Closed

fix: treat cancelled CI runs as non-failing#128
NiveditJain wants to merge 2 commits into
mainfrom
fix/ci-green-cancelled-runs

Conversation

@NiveditJain

@NiveditJain NiveditJain commented Apr 21, 2026

Copy link
Copy Markdown
Member

Summary

  • Cancelled workflow runs (e.g. from superseded dependabot merges) were counted as failures by require-ci-green-before-stop, blocking the Stop event on branches with otherwise clean CI
  • Added cancelled to the list of non-failing conclusions alongside success and skipped
  • Fixed bot detection in review-policies.mjs convention hook: uses GraphQL __typename === "Bot" instead of checking for [bot] in login (CodeRabbit's login is coderabbitai, no suffix)
  • Added missing PR number to CHANGELOG entry per repo convention

Test plan

  • Updated existing unit test to expect allow for cancelled runs
  • All 960 unit tests pass
  • All 207 E2E tests pass

🤖 Generated with Claude Code

…e-stop

Cancelled workflow runs (e.g. from superseded dependabot merges) were
counted as failures, blocking the Stop event on branches with clean CI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 21, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR updates the require-ci-green-before-stop policy to treat cancelled CI runs as non-failing. Changes span implementation logic, test expectations, documentation, and changelog entries to reflect this new behavior uniformly across all components.

Changes

Cohort / File(s) Summary
Policy Implementation & Tests
src/hooks/builtin-policies.ts, __tests__/hooks/builtin-policies.test.ts
Modified requireCiGreenBeforeStop to exclude cancelled CI conclusions from the failing checks set; updated corresponding test to expect allow decision instead of deny for cancelled runs.
Documentation
docs/built-in-policies.mdx, CHANGELOG.md
Updated policy documentation to reflect that both skipped and cancelled CI conclusions are now treated as success; added unreleased changelog entry documenting the fix.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • PR #109: Modifies user-facing deny/instruct messages for the same require-ci-green-before-stop policy in src/hooks/builtin-policies.ts.
  • PR #92: Alters the same policy function to handle third-party check conclusions alongside CI-run status logic.
  • PR #63: Originally implemented the require-ci-green-before-stop policy that this PR refines.

Poem

🐰 When CI runs cancel with grace,
No failure marks our code's face!
The policy now sees the truth so clear—
Cancelled means calm, not something to fear! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: treating cancelled CI runs as non-failing in the require-ci-green-before-stop policy.
Description check ✅ Passed The PR description provides a clear summary of changes, test plan with results, but does not include a Type of Change section or checklist items as specified in the template.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ci-green-cancelled-runs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@CHANGELOG.md`:
- Around line 5-7: The changelog entry under "### Fixes" for the policy text
"Treat cancelled CI runs as non-failing in `require-ci-green-before-stop`
policy" is missing the PR number; update that single-line entry in CHANGELOG.md
by appending the PR identifier in the same format as other entries (e.g. add "
(`#123`)" replacing 123 with this PR's number) so it matches the repo convention
used for other entries like "(`#126`)" and "(`#112`)".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ba91cc2b-f346-458f-b1c9-2cd46c5cf19f

📥 Commits

Reviewing files that changed from the base of the PR and between e355e15 and 2fbbc90.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • __tests__/hooks/builtin-policies.test.ts
  • docs/built-in-policies.mdx
  • src/hooks/builtin-policies.ts

Comment thread CHANGELOG.md
CodeRabbit's login is "coderabbitai" (no [bot] suffix), so the
review-policies convention hook missed it. Now checks __typename === "Bot"
from the GraphQL API, which reliably identifies all bot accounts.

Also adds missing PR number to CHANGELOG entry per repo convention.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@NiveditJain

Copy link
Copy Markdown
Member Author

Replaced by new PR from rebased branch (includes latest main).

@NiveditJain NiveditJain deleted the fix/ci-green-cancelled-runs branch April 21, 2026 01:30
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.

1 participant