chore: cancel workflow on lint/compile failures to save CI spend#1428
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdded per-job GitHub Actions permissions (contents: read, actions: write) and inserted "Cancel workflow on failure" steps across multiple jobs in Changes
Sequence Diagram(s)sequenceDiagram
participant Job as Job Step (runner)
participant GHCLI as gh CLI
participant GHAPI as GitHub Actions API
participant OtherJobs as Other Running Jobs
Job->>GHCLI: detect step failure -> run `gh run cancel ${GITHUB_RUN_ID}` (uses GH_TOKEN)
GHCLI->>GHAPI: Cancel workflow request (actions.write)
GHAPI-->>OtherJobs: send cancellation signal
OtherJobs-->>GHAPI: acknowledge cancellation / stop
GHAPI-->>Job: confirm cancellation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/ci.yml (1)
688-745:⚠️ Potential issue | 🟠 MajorAdd the cancellation step to
build_circuits.The
build_circuitsjob is missing the "Cancel workflow on failure" step that exists inrust_testsandtest_contracts, removing a stated fast-feedback cancellation point.Suggested addition in
build_circuits- name: Test Noir circuits run: ./scripts/test-circuits.sh + - name: Cancel workflow on failure + if: failure() + run: gh run cancel ${{ github.run_id }} + env: + GH_TOKEN: ${{ github.token }} + - name: pnpm-setup uses: pnpm/action-setup@v4🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/ci.yml around lines 688 - 745, The build_circuits job is missing the "Cancel workflow on failure" step; add the same cancellation step used in rust_tests and test_contracts into the build_circuits job's steps (immediately after checkout) so the workflow cancels fast on failures. Locate the build_circuits job and insert the step with the exact step name "Cancel workflow on failure" and the same action and conditional used in the other jobs to ensure consistent behavior. Ensure the step order matches other jobs (right after the actions/checkout step) so cancellation is available before long-running tasks like Install Nargo and Build circuits.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 27-31: The workflow-wide permissions block currently grants
actions: write which should be scoped to only the jobs that need to cancel
workflows and must not remove packages: write from Docker-pushing jobs; update
permissions so the top-level permissions keep contents: read (or replicate
contents: read into each job), remove actions: write from the global block, add
job-level permissions with actions: write for rust_tests and test_contracts
(these are the only jobs that cancel runs), add job-level permissions with
packages: write for build_e3_support_risc0 and build_ciphernode_image (they push
to ghcr.io), and ensure build_circuits does not receive actions: write because
it does not cancel workflows.
---
Outside diff comments:
In @.github/workflows/ci.yml:
- Around line 688-745: The build_circuits job is missing the "Cancel workflow on
failure" step; add the same cancellation step used in rust_tests and
test_contracts into the build_circuits job's steps (immediately after checkout)
so the workflow cancels fast on failures. Locate the build_circuits job and
insert the step with the exact step name "Cancel workflow on failure" and the
same action and conditional used in the other jobs to ensure consistent
behavior. Ensure the step order matches other jobs (right after the
actions/checkout step) so cancellation is available before long-running tasks
like Install Nargo and Build circuits.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 125a9c8c-c3b1-4771-aa83-513e121dcc79
📒 Files selected for processing (1)
.github/workflows/ci.yml
Summary
Adds early workflow cancellation when fast-feedback jobs detect lint, compile, or build errors, avoiding unnecessary CI spend on e2e tests that are guaranteed to fail.
What changed
permissions: { contents: read, actions: write }(required forgh run cancel) to each affected jobCancel workflow on failurestep (usinggh run cancel) to four fast-feedback jobs:rust_tests— catches Rust lint and compile errorstest_contracts— catches Solidity lint errorsbuild_circuits— catches Noir formatting and test errorsbuild_enclave_cli— catches Rust compile errors; this job always runs and is a dependency for 4 downstream jobsWhy only these four jobs?
Cancelling the entire run on any job failure would be too aggressive — it hides parallel failures, amplifies flaky tests, and can interrupt artifact uploads mid-flight. Instead, we only cancel on failures that represent "nothing else will pass either" signals: lint, compile, and core build errors.
Other build and e2e jobs are left untouched so that:
What's NOT changed
ciphernode_integration_test,crisp_e2e,template_integration, etc.) already stop automatically vianeeds:when their upstream dependency failsdetect_changesandcontrib-readme-jobare unaffectedSummary by CodeRabbit