Skip to content

Limit agent PR workflow triggers - #2394

Merged
zackees merged 1 commit into
masterfrom
codex/limit-agent-pr-workflows-2393
Apr 23, 2026
Merged

zackees merged 1 commit into
masterfrom
codex/limit-agent-pr-workflows-2393

Conversation

@zackees

@zackees zackees commented Apr 23, 2026 •

Copy link
Copy Markdown
Member

Summary

  • limits automatic PR workflows to the lightweight allowlist from Limit agent PR workflows to the lightweight CI allowlist #2393
  • leaves existing push, path, branch, and manual-dispatch settings alone
  • removes only non-allowlisted pull_request trigger blocks
  • adds ci/tools/gh/limit_agent_pr_workflows.py as a dry-run/apply/check helper for the same narrow policy

PR allowlist after this change

  • .github/workflows/unit_test_linux.yml
  • .github/workflows/example_test_linux.yml
  • .github/workflows/build_uno.yml
  • .github/workflows/build_esp32s3.yml
  • .github/workflows/build_teensy41.yml
  • .github/workflows/build_wasm.yml

Validation

  • python -m py_compile ci/tools/gh/limit_agent_pr_workflows.py
  • python ci/tools/gh/limit_agent_pr_workflows.py --check
  • parsed all 108 workflow YAML files successfully
  • verified remaining pull_request triggers are limited to the six allowlisted workflows above
  • git diff --check -- .github/workflows ci/tools/gh/limit_agent_pr_workflows.py

Closes #2393

Summary by CodeRabbit

Chores

  • Modified GitHub Actions workflows to trigger only on push events to the master branch. Pull request checks will no longer automatically run upon PR creation.
  • Added automation tooling for managing workflow trigger configurations.

@coderabbitai

coderabbitai Bot commented Apr 23, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9d695b90-d436-4242-9cc9-7ddfa3c7bf8e

📥 Commits

Reviewing files that changed from the base of the PR and between d60f093 and 4d7a7ab.

📒 Files selected for processing (75)
  • .github/workflows/avr8js_uno_test.yml
  • .github/workflows/build_adafruit_feather_nrf52840_sense.yml
  • .github/workflows/build_adafruit_xiaoblesense.yml
  • .github/workflows/build_apollo3_red.yml
  • .github/workflows/build_apollo3_thing_explorable.yml
  • .github/workflows/build_atmega8a.yml
  • .github/workflows/build_attiny1604.yml
  • .github/workflows/build_attiny1616.yml
  • .github/workflows/build_attiny4313.yml
  • .github/workflows/build_attiny85.yml
  • .github/workflows/build_attiny88.yml
  • .github/workflows/build_blackpill_stm32f4.yml
  • .github/workflows/build_bluepill.yml
  • .github/workflows/build_digix.yml
  • .github/workflows/build_due.yml
  • .github/workflows/build_esp32_i2s_ws2812.yml
  • .github/workflows/build_esp32c2.yml
  • .github/workflows/build_esp32c3.yml
  • .github/workflows/build_esp32c5.yml
  • .github/workflows/build_esp32c6.yml
  • .github/workflows/build_esp32dev.yml
  • .github/workflows/build_esp32dev_idf3.3.yml
  • .github/workflows/build_esp32dev_idf4.4.yml
  • .github/workflows/build_esp32dev_namespace.yml
  • .github/workflows/build_esp32h2.yml
  • .github/workflows/build_esp32p4.yml
  • .github/workflows/build_esp32s2.yml
  • .github/workflows/build_esp32wroom.yml
  • .github/workflows/build_esp8266.yml
  • .github/workflows/build_giga_r1.yml
  • .github/workflows/build_linux.yml
  • .github/workflows/build_maple_map.yml
  • .github/workflows/build_mgm240s_thingplusmatter.yml
  • .github/workflows/build_nano_every.yml
  • .github/workflows/build_nrf52840_dk.yml
  • .github/workflows/build_nrf52_xiaoblesense.yml
  • .github/workflows/build_nucleo_f429zi.yml
  • .github/workflows/build_nucleo_f439zi.yml
  • .github/workflows/build_rgbw.yml
  • .github/workflows/build_rp2040.yml
  • .github/workflows/build_rp2350.yml
  • .github/workflows/build_rp2350B.yml
  • .github/workflows/build_stm103tb.yml
  • .github/workflows/build_teensy30.yml
  • .github/workflows/build_teensy31.yml
  • .github/workflows/build_teensy32.yml
  • .github/workflows/build_teensy35.yml
  • .github/workflows/build_teensy36.yml
  • .github/workflows/build_teensy40.yml
  • .github/workflows/build_teensy41_ofled.yml
  • .github/workflows/build_teensyLC.yml
  • .github/workflows/build_teensy_octo.yml
  • .github/workflows/build_uno_r4_wifif.yml
  • .github/workflows/build_wasm_compilers.yml
  • .github/workflows/build_yun.yml
  • .github/workflows/check_attiny85.yml
  • .github/workflows/check_bluepill_size.yml
  • .github/workflows/check_esp32_size.yml
  • .github/workflows/check_teensy30_size.yml
  • .github/workflows/check_teensy31_size.yml
  • .github/workflows/check_teensy32_size.yml
  • .github/workflows/check_teensy35_size.yml
  • .github/workflows/check_teensy36_size.yml
  • .github/workflows/check_teensy41_size.yml
  • .github/workflows/check_teensylc_size.yml
  • .github/workflows/check_uno_size.yml
  • .github/workflows/example_test_macos.yml
  • .github/workflows/example_test_windows.yml
  • .github/workflows/header-perf.yml
  • .github/workflows/qemu_esp32c3_test.yml
  • .github/workflows/qemu_esp32dev_test.yml
  • .github/workflows/qemu_esp32s3_test.yml
  • .github/workflows/unit_test_macos.yml
  • .github/workflows/unit_test_windows.yml
  • ci/tools/gh/limit_agent_pr_workflows.py

📝 Walkthrough

Walkthrough

Across 73 GitHub Actions workflows, pull_request event triggers are systematically removed, restricting PR automation to 7 allowlisted workflows. A new Python utility script is added to enforce this policy repeatably.

Changes

Cohort / File(s) Summary
AVR/ATmega/ATtiny Board Builds
build_avr8js_uno_test.yml, build_atmega8a.yml, build_attiny1604.yml, build_attiny1616.yml, build_attiny4313.yml, build_attiny85.yml, build_attiny88.yml, build_nano_every.yml
Removed on.pull_request trigger (scoped to master with paths filters); on.push trigger retained.
ARM/STM32 Board Builds
build_blackpill_stm32f4.yml, build_bluepill.yml, build_due.yml, build_digix.yml, build_giga_r1.yml, build_stm103tb.yml, build_nucleo_f429zi.yml, build_nucleo_f439zi.yml
Removed on.pull_request trigger (scoped to master with paths filters); on.push trigger retained.
ESP32 Board Builds
build_esp32_i2s_ws2812.yml, build_esp32c2.yml, build_esp32c3.yml, build_esp32c5.yml, build_esp32c6.yml, build_esp32dev.yml, build_esp32dev_idf3.3.yml, build_esp32dev_idf4.4.yml, build_esp32dev_namespace.yml, build_esp32h2.yml, build_esp32p4.yml, build_esp32s2.yml, build_esp32wroom.yml, build_esp8266.yml
Removed on.pull_request trigger (scoped to master with paths filters); on.push trigger retained.
nRF/Bluetooth Board Builds
build_adafruit_feather_nrf52840_sense.yml, build_adafruit_xiaoblesense.yml, build_apollo3_red.yml, build_apollo3_thing_explorable.yml, build_mgm240s_thingplusmatter.yml, build_nrf52840_dk.yml, build_nrf52_xiaoblesense.yml
Removed on.pull_request trigger (scoped to master with paths filters); on.push trigger retained.
RISC-V Board Builds
build_rp2040.yml, build_rp2350.yml, build_rp2350B.yml
Removed on.pull_request trigger (scoped to master with paths filters); on.push trigger retained.
Teensy Board Builds
build_teensy30.yml, build_teensy31.yml, build_teensy32.yml, build_teensy35.yml, build_teensy36.yml, build_teensy40.yml, build_teensy41_ofled.yml, build_teensyLC.yml, build_teensy_octo.yml
Removed on.pull_request trigger (scoped to master with paths filters); on.push trigger retained.
Miscellaneous Board Builds
build_linux.yml, build_maple_map.yml, build_rgbw.yml, build_uno_r4_wifif.yml, build_wasm_compilers.yml, build_yun.yml
Removed on.pull_request trigger (scoped to master with paths filters); on.push trigger retained.
Unit & Example Test Workflows
unit_test_macos.yml, unit_test_windows.yml, example_test_macos.yml, example_test_windows.yml
Removed on.pull_request trigger (scoped to master with paths filters); on.push trigger retained.
Binary Size Check Workflows
check_attiny85.yml, check_bluepill_size.yml, check_esp32_size.yml, check_teensy30_size.yml, check_teensy31_size.yml, check_teensy32_size.yml, check_teensy35_size.yml, check_teensy36_size.yml, check_teensy41_size.yml, check_teensylc_size.yml, check_uno_size.yml
Removed on.pull_request trigger (scoped to master with paths filters); on.push trigger retained.
QEMU Test Workflows
qemu_esp32c3_test.yml, qemu_esp32dev_test.yml, qemu_esp32s3_test.yml
Removed on.pull_request trigger (scoped to master with paths filters); on.push and/or workflow_dispatch trigger retained.
Header Performance Check
header-perf.yml
Removed on.pull_request trigger (scoped to src/**/*.{h,hpp} paths); no other triggers remain in workflow.
Policy Enforcement Utility
ci/tools/gh/limit_agent_pr_workflows.py
New Python script that enumerates workflow YAML files, removes pull_request events from non-allowlisted workflows using indentation-based parsing, and supports --check, --apply, and --print-allowlist modes for policy enforcement.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

Poem

🐰 Workflows trimmed with careful paws,
PR triggers fall away,
Seven paths remain—no pause,
CI costs cut today!
A script enforces, none can fray. 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Limit agent PR workflow triggers' clearly summarizes the main change of restricting PR workflow triggers to a lightweight allowlist.
Linked Issues check ✅ Passed The PR fully implements all coding requirements from issue #2393: removes pull_request triggers from non-allowlisted workflows, keeps push.branches: [master], adds workflow_dispatch for manual runs, and includes the ci/tools/gh/limit_agent_pr_workflows.py script.
Out of Scope Changes check ✅ Passed All changes are in-scope: workflow trigger modifications align with the stated policy, the new Python script implements policy enforcement, and minor whitespace changes are incidental to trigger edits.

✏️ 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 codex/limit-agent-pr-workflows-2393

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: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
.github/workflows/check_teensy36_size.yml (1)

25-33: ⚠️ Potential issue | 🟡 Minor

Watch the binary-size template this job actually uses.

Line 33 invokes build_template_binary_size.yml, but Line 26 only watches build_template.yml. With the PR trigger removed, edits to the binary-size reusable workflow can land on master without automatically rerunning this size check.

Proposed fix
-      - '.github/workflows/build_template.yml'
+      - '.github/workflows/build_template_binary_size.yml'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/check_teensy36_size.yml around lines 25 - 33, The workflow
watches the wrong reusable-workflow file: the job uses
./.github/workflows/build_template_binary_size.yml (the line with uses:
./.github/workflows/build_template_binary_size.yml) but the watched-files list
only includes .github/workflows/build_template.yml; update the watched files
array at the top of the YAML to include
'.github/workflows/build_template_binary_size.yml' (and remove or keep
'.github/workflows/build_template.yml' as appropriate) so edits to the
binary-size reusable workflow will retrigger this job.
.github/workflows/check_teensy35_size.yml (1)

25-33: ⚠️ Potential issue | 🟡 Minor

Watch the binary-size template this job actually uses.

Line 33 invokes build_template_binary_size.yml, but Line 26 only watches build_template.yml. With the PR trigger removed, edits to the binary-size reusable workflow can land on master without automatically rerunning this size check.

Proposed fix
-      - '.github/workflows/build_template.yml'
+      - '.github/workflows/build_template_binary_size.yml'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/check_teensy35_size.yml around lines 25 - 33, In the
check_teensy35_size.yml workflow the paths watched list references
'.github/workflows/build_template.yml' but the job uses the reusable workflow
'build_template_binary_size.yml', so add
'.github/workflows/build_template_binary_size.yml' to the watched paths
(alongside or instead of the existing build_template.yml entry) so changes to
the binary-size reusable workflow will retrigger this job; update the paths
array in check_teensy35_size.yml to include the exact filename
'build_template_binary_size.yml' referenced by the job.
🧹 Nitpick comments (9)
.github/workflows/build_nano_every.yml (1)

3-5: Stale pull_request reference in concurrency config.

With the pull_request trigger removed, cancel-in-progress will always be false. Consider simplifying to a constant (or dropping the conditional) to avoid confusion for future readers. Not blocking.

♻️ Suggested simplification
 concurrency:
   group: ${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+  cancel-in-progress: false
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build_nano_every.yml around lines 3 - 5, The concurrency
block uses a conditional for cancel-in-progress referencing github.event_name ==
'pull_request' which is stale now that the pull_request trigger is removed;
update the concurrency config by replacing cancel-in-progress: ${{
github.event_name == 'pull_request' }} with a constant (e.g.,
cancel-in-progress: false) or remove the cancel-in-progress line entirely so the
concurrency block (group, cancel-in-progress) no longer contains a misleading
conditional; ensure you reference the same keys (concurrency, group,
cancel-in-progress) when making the change.
.github/workflows/build_esp32dev_idf4.4.yml (1)

5-5: Stale pull_request reference in concurrency config.

Since the pull_request trigger was removed, github.event_name == 'pull_request' will never be true here, so cancel-in-progress is effectively always false. Consider simplifying to an explicit boolean (or dropping the expression) to avoid confusion for future readers.

Proposed tweak
 concurrency:
   group: ${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+  cancel-in-progress: false
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build_esp32dev_idf4.4.yml at line 5, The concurrency
setting uses a stale expression "github.event_name == 'pull_request'" so
cancel-in-progress is always false; update the cancel-in-progress key to an
explicit boolean (e.g., set cancel-in-progress: true) or remove the expression
entirely to avoid confusion—edit the line containing cancel-in-progress and
replace the expression with the chosen literal true/false (or delete the key) so
the concurrency config is explicit and accurate.
.github/workflows/build_teensy32.yml (1)

3-5: Stale pull_request reference in concurrency.

With the pull_request trigger removed, cancel-in-progress will now always evaluate to false. Consider simplifying (e.g., drop the condition or set it to false explicitly) to avoid confusion for future readers.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build_teensy32.yml around lines 3 - 5, The concurrency
block's cancel-in-progress condition uses the removed pull_request trigger so it
always evaluates to false; update the concurrency configuration (the concurrency
group and cancel-in-progress fields) by either removing the conditional and
setting cancel-in-progress: false explicitly or simplifying to just omit
cancel-in-progress, so the concurrency block (specifically the concurrency group
and cancel-in-progress setting) no longer contains the stale ${{
github.event_name == 'pull_request' }} expression.
.github/workflows/build_esp8266.yml (1)

3-5: Stale pull_request reference in concurrency.cancel-in-progress.

With the pull_request trigger removed, github.event_name == 'pull_request' will never be true, so cancel-in-progress is effectively always false. Consider simplifying or switching to a more meaningful condition (e.g., cancel on non-master refs) for clarity.

♻️ Suggested simplification
 concurrency:
   group: ${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+  cancel-in-progress: false
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build_esp8266.yml around lines 3 - 5, The
cancel-in-progress expression under the concurrency block is a stale check
(github.event_name == 'pull_request') that will always be false now; update the
concurrency.cancel-in-progress setting in the workflow to a meaningful condition
or a simple boolean so it actually cancels redundant runs — modify the
concurrency.group/cancel-in-progress entries (symbols: concurrency, group,
cancel-in-progress) to either set cancel-in-progress: true for general
cancellation or replace the expression with a relevant check (for example
evaluating github.ref to skip main/master) so behavior is clear and effective.
.github/workflows/build_stm103tb.yml (1)

3-8: Optional: simplify now-dead cancel-in-progress expression.

With pull_request removed, github.event_name == 'pull_request' will always evaluate to false, so in-progress runs (e.g., from workflow_dispatch or push) will never be cancelled. If that's intended, consider hard-coding cancel-in-progress: false for clarity; otherwise pick the behavior you want for manual/master runs.

♻️ Proposed tidy-up
 concurrency:
   group: ${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+  cancel-in-progress: false
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build_stm103tb.yml around lines 3 - 8, The current
concurrency block uses a tautological expression for cancel-in-progress ("${{
github.event_name == 'pull_request' }}") which is now always false since
pull_request is removed; update the concurrency configuration by replacing the
dynamic expression with an explicit value: either set cancel-in-progress: false
to make the intent clear, or replace the condition with the desired static
behavior (e.g., true) for non-PR runs; modify the concurrency keys (group and
cancel-in-progress) in the concurrency block so the workflow_dispatch/push
behavior is explicit and unambiguous.
.github/workflows/build_blackpill_stm32f4.yml (1)

5-5: Stale pull_request reference in concurrency config.

With the pull_request trigger removed, cancel-in-progress will always evaluate to false (since this workflow now only runs on push to master and manual workflow_dispatch). Consider simplifying to a constant, or set it to true for workflow_dispatch runs if that's desirable.

♻️ Suggested simplification
 concurrency:
   group: ${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+  cancel-in-progress: false
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build_blackpill_stm32f4.yml at line 5, The concurrency
config's cancel-in-progress uses a stale expression referencing pull_request
which is no longer a trigger; update the cancel-in-progress value to a constant
(e.g., true or false) or an expression that matches current triggers
(push/workflow_dispatch). Locate the concurrency block in
.github/workflows/build_blackpill_stm32f4.yml and replace cancel-in-progress:
${{ github.event_name == 'pull_request' }} with a fixed boolean (for example
cancel-in-progress: true to allow cancelling in-progress runs) or another
appropriate condition that reflects workflow_dispatch if desired.
.github/workflows/build_teensyLC.yml (1)

5-8: Nit: stale cancel-in-progress expression.

Since pull_request is no longer a trigger, github.event_name == 'pull_request' will always evaluate to false, effectively disabling cancel-in-progress. If that's intended, consider simplifying to cancel-in-progress: false for clarity; otherwise set it to true for push/manual dispatch. Same observation applies to the other workflows in this PR that dropped pull_request (build_rp2350B.yml, build_nucleo_f429zi.yml, build_digix.yml, build_esp32dev_idf3.3.yml, build_clone_and_compile.yml).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build_teensyLC.yml around lines 5 - 8, The
cancel-in-progress expression uses a stale condition (github.event_name ==
'pull_request') which now always evaluates false because pull_request is not a
trigger; update the cancel-in-progress setting in this workflow (and the other
affected workflows: build_rp2350B.yml, build_nucleo_f429zi.yml, build_digix.yml,
build_esp32dev_idf3.3.yml, build_clone_and_compile.yml) to be explicit—either
set cancel-in-progress: false if you intend to disable it, or set
cancel-in-progress: true (or a condition matching the current triggers such as
push or workflow_dispatch) so it actually cancels in-progress runs. Ensure you
change the value for the cancel-in-progress key rather than leaving the outdated
github.event_name == 'pull_request' expression.
.github/workflows/build_linux.yml (1)

31-72: Dead PR-merge logic left behind after removing pull_request trigger.

With pull_request removed, this workflow only runs on push to master (or manual dispatch). The two-checkout "trusted base + PR code" scheme becomes degenerate:

  • Line 34: github.event.repository.default_branch || 'master' → checks out master.
  • Line 40: github.event.pull_request.head.sha || github.sha → on a push event, pull_request.head.sha is empty so this falls back to github.sha, i.e. the same master commit. Both checkouts yield the same tree; the cp -r pr-code/... trusted/... merging is a no-op.
  • Line 64: github.event.pull_request.head.repo.full_name is empty on push, so the build_config.py copy branch is always skipped.

Since the untrusted-PR-isolation rationale no longer applies, consider simplifying to a single actions/checkout and dropping the trusted/pr-code split and merge step, or re-add this workflow to the PR allowlist if its purpose was actually to gate untrusted PR code. Leaving the current structure in place works but is misleading and fragile for future edits.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build_linux.yml around lines 31 - 72, The workflow
contains dead PR-merge logic: the two checkout steps named "Checkout trusted
base branch code" and "Checkout PR code" plus the "Merge safe source files from
PR" block rely on github.event.pull_request values that are empty on push
events, so they become no-ops and misleading; fix by either (A) simplifying to a
single actions/checkout@v4 (remove the second checkout step and the whole
merge/copy block that references pr-code and github.event.pull_request.*) so the
job runs against the single checked-out tree, or (B) restore the pull_request
trigger to the workflow if its intent is to test untrusted PR code (keep the
existing two-checkout + merge logic intact); update or remove references to
github.event.pull_request.head.* and the conditional that checks
github.event.pull_request.head.repo.full_name accordingly (see step names
"Checkout trusted base branch code", "Checkout PR code", and "Merge safe source
files from PR").
ci/tools/gh/limit_agent_pr_workflows.py (1)

242-244: Use explicit loops for collected workflow results.

The new code uses generator/list comprehension style where the repository standard asks for explicit loops for debuggability.

As per coding guidelines, “Use explicit loops instead of list comprehensions for code clarity and debuggability.”

♻️ Proposed loop-based rewrite
 def workflow_files(workflows_dir: Path) -> list[Path]:
-    files = [*workflows_dir.glob("*.yml"), *workflows_dir.glob("*.yaml")]
-    return sorted(path for path in files if path.is_file())
+    files: list[Path] = []
+    for path in workflows_dir.glob("*.yml"):
+        if path.is_file():
+            files.append(path)
+    for path in workflows_dir.glob("*.yaml"):
+        if path.is_file():
+            files.append(path)
+    return sorted(files)
@@
-    results = [
-        transform_workflow(path, allow_pr=path.name in allowlist)
-        for path in workflow_files(workflows_dir)
-    ]
-    changed = [result for result in results if result.changed]
+    results: list[WorkflowResult] = []
+    for path in workflow_files(workflows_dir):
+        results.append(transform_workflow(path, allow_pr=path.name in allowlist))
+
+    changed: list[WorkflowResult] = []
+    for result in results:
+        if result.changed:
+            changed.append(result)

Also applies to: 296-300

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ci/tools/gh/limit_agent_pr_workflows.py` around lines 242 - 244, The
workflow_files function currently builds and filters workflow Paths using a
combined list/generator comprehension; refactor it to use explicit loops:
iterate over workflows_dir.glob("*.yml") and workflows_dir.glob("*.yaml"),
append each Path to a list only if path.is_file(), then sort that list and
return it. Update the same pattern in the other similar workflow-collection
block later in the file (the second aggregation of workflow Paths) so both
places follow the explicit-loop style for debuggability.
🤖 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/build_esp_extra_libs.yml:
- Line 5: The current cancel-in-progress expression (cancel-in-progress: ${{
github.event_name == 'pull_request' }}) is always false because the pull_request
trigger was removed; change it to a static true (cancel-in-progress: true) or
replace the condition with an appropriate event check that matches your triggers
(e.g., include github.event_name == 'workflow_run' if you want to cancel runs
triggered by workflow_run) so that the workflow actually cancels superseded
runs; update the cancel-in-progress line accordingly where the
cancel-in-progress key is defined.

In @.github/workflows/header-perf.yml:
- Around line 8-10: The push trigger currently lists both branches in the
workflow definition (the push: branches: [master, main] block); remove "main" so
pushes only target "master" by updating the push branches array to include only
"master" (keep workflow_dispatch unchanged) to ensure the workflow no longer
runs on main pushes.

In `@ci/tools/gh/limit_agent_pr_workflows.py`:
- Around line 141-153: The current ensure_event_branches_master bail-out returns
whenever a branches or branches-ignore key exists without validating its
contents; update ensure_event_branches_master to read the actual branch list
under the event (use the found event object from find_on_block and helpers like
has_nested_key/get_nested_value or parse the YAML subsection) and validate that
branches are strictly scoped to "master" (and that branches-ignore does not
permit non-master pushes), and if the list contains other branches replace or
rewrite the underlying lines to enforce branches: [master] (apply the same
validation and replacement logic for branches-ignore), referencing the
ensure_event_branches_master function, the event variable returned by
find_on_block, and the has_nested_key check to locate where to add the content
validation and replacement.
- Around line 247-283: parse_args currently requires a list[str] and main uses a
default None parameter, violating the repo convention; change parse_args to
accept an optional argv parameter (e.g., argv: list[str] | None = None) and
inside it use sys.argv[1:] when argv is None, and change main to require an
explicit argv parameter with no default (e.g., main(argv: list[str]) -> int) and
pass that argv into parse_args; update any internal calls accordingly so
parse_args and main match the repository's required signatures and
type-annotation rules.
- Around line 36-54: Import the typechecked decorator from typeguard and apply
it to the three dataclasses by adding `@typechecked` immediately before the
existing `@dataclass` for EventBlock, OnBlock, and WorkflowResult; ensure you add
the import (e.g., from typeguard import typechecked) near the other imports and
place `@typechecked` above each class declaration (i.e., before `@dataclass`) so
EventBlock, OnBlock, and WorkflowResult are all type-checked at runtime.

---

Outside diff comments:
In @.github/workflows/check_teensy35_size.yml:
- Around line 25-33: In the check_teensy35_size.yml workflow the paths watched
list references '.github/workflows/build_template.yml' but the job uses the
reusable workflow 'build_template_binary_size.yml', so add
'.github/workflows/build_template_binary_size.yml' to the watched paths
(alongside or instead of the existing build_template.yml entry) so changes to
the binary-size reusable workflow will retrigger this job; update the paths
array in check_teensy35_size.yml to include the exact filename
'build_template_binary_size.yml' referenced by the job.

In @.github/workflows/check_teensy36_size.yml:
- Around line 25-33: The workflow watches the wrong reusable-workflow file: the
job uses ./.github/workflows/build_template_binary_size.yml (the line with uses:
./.github/workflows/build_template_binary_size.yml) but the watched-files list
only includes .github/workflows/build_template.yml; update the watched files
array at the top of the YAML to include
'.github/workflows/build_template_binary_size.yml' (and remove or keep
'.github/workflows/build_template.yml' as appropriate) so edits to the
binary-size reusable workflow will retrigger this job.

---

Nitpick comments:
In @.github/workflows/build_blackpill_stm32f4.yml:
- Line 5: The concurrency config's cancel-in-progress uses a stale expression
referencing pull_request which is no longer a trigger; update the
cancel-in-progress value to a constant (e.g., true or false) or an expression
that matches current triggers (push/workflow_dispatch). Locate the concurrency
block in .github/workflows/build_blackpill_stm32f4.yml and replace
cancel-in-progress: ${{ github.event_name == 'pull_request' }} with a fixed
boolean (for example cancel-in-progress: true to allow cancelling in-progress
runs) or another appropriate condition that reflects workflow_dispatch if
desired.

In @.github/workflows/build_esp32dev_idf4.4.yml:
- Line 5: The concurrency setting uses a stale expression "github.event_name ==
'pull_request'" so cancel-in-progress is always false; update the
cancel-in-progress key to an explicit boolean (e.g., set cancel-in-progress:
true) or remove the expression entirely to avoid confusion—edit the line
containing cancel-in-progress and replace the expression with the chosen literal
true/false (or delete the key) so the concurrency config is explicit and
accurate.

In @.github/workflows/build_esp8266.yml:
- Around line 3-5: The cancel-in-progress expression under the concurrency block
is a stale check (github.event_name == 'pull_request') that will always be false
now; update the concurrency.cancel-in-progress setting in the workflow to a
meaningful condition or a simple boolean so it actually cancels redundant runs —
modify the concurrency.group/cancel-in-progress entries (symbols: concurrency,
group, cancel-in-progress) to either set cancel-in-progress: true for general
cancellation or replace the expression with a relevant check (for example
evaluating github.ref to skip main/master) so behavior is clear and effective.

In @.github/workflows/build_linux.yml:
- Around line 31-72: The workflow contains dead PR-merge logic: the two checkout
steps named "Checkout trusted base branch code" and "Checkout PR code" plus the
"Merge safe source files from PR" block rely on github.event.pull_request values
that are empty on push events, so they become no-ops and misleading; fix by
either (A) simplifying to a single actions/checkout@v4 (remove the second
checkout step and the whole merge/copy block that references pr-code and
github.event.pull_request.*) so the job runs against the single checked-out
tree, or (B) restore the pull_request trigger to the workflow if its intent is
to test untrusted PR code (keep the existing two-checkout + merge logic intact);
update or remove references to github.event.pull_request.head.* and the
conditional that checks github.event.pull_request.head.repo.full_name
accordingly (see step names "Checkout trusted base branch code", "Checkout PR
code", and "Merge safe source files from PR").

In @.github/workflows/build_nano_every.yml:
- Around line 3-5: The concurrency block uses a conditional for
cancel-in-progress referencing github.event_name == 'pull_request' which is
stale now that the pull_request trigger is removed; update the concurrency
config by replacing cancel-in-progress: ${{ github.event_name == 'pull_request'
}} with a constant (e.g., cancel-in-progress: false) or remove the
cancel-in-progress line entirely so the concurrency block (group,
cancel-in-progress) no longer contains a misleading conditional; ensure you
reference the same keys (concurrency, group, cancel-in-progress) when making the
change.

In @.github/workflows/build_stm103tb.yml:
- Around line 3-8: The current concurrency block uses a tautological expression
for cancel-in-progress ("${{ github.event_name == 'pull_request' }}") which is
now always false since pull_request is removed; update the concurrency
configuration by replacing the dynamic expression with an explicit value: either
set cancel-in-progress: false to make the intent clear, or replace the condition
with the desired static behavior (e.g., true) for non-PR runs; modify the
concurrency keys (group and cancel-in-progress) in the concurrency block so the
workflow_dispatch/push behavior is explicit and unambiguous.

In @.github/workflows/build_teensy32.yml:
- Around line 3-5: The concurrency block's cancel-in-progress condition uses the
removed pull_request trigger so it always evaluates to false; update the
concurrency configuration (the concurrency group and cancel-in-progress fields)
by either removing the conditional and setting cancel-in-progress: false
explicitly or simplifying to just omit cancel-in-progress, so the concurrency
block (specifically the concurrency group and cancel-in-progress setting) no
longer contains the stale ${{ github.event_name == 'pull_request' }} expression.

In @.github/workflows/build_teensyLC.yml:
- Around line 5-8: The cancel-in-progress expression uses a stale condition
(github.event_name == 'pull_request') which now always evaluates false because
pull_request is not a trigger; update the cancel-in-progress setting in this
workflow (and the other affected workflows: build_rp2350B.yml,
build_nucleo_f429zi.yml, build_digix.yml, build_esp32dev_idf3.3.yml,
build_clone_and_compile.yml) to be explicit—either set cancel-in-progress: false
if you intend to disable it, or set cancel-in-progress: true (or a condition
matching the current triggers such as push or workflow_dispatch) so it actually
cancels in-progress runs. Ensure you change the value for the cancel-in-progress
key rather than leaving the outdated github.event_name == 'pull_request'
expression.

In `@ci/tools/gh/limit_agent_pr_workflows.py`:
- Around line 242-244: The workflow_files function currently builds and filters
workflow Paths using a combined list/generator comprehension; refactor it to use
explicit loops: iterate over workflows_dir.glob("*.yml") and
workflows_dir.glob("*.yaml"), append each Path to a list only if path.is_file(),
then sort that list and return it. Update the same pattern in the other similar
workflow-collection block later in the file (the second aggregation of workflow
Paths) so both places follow the explicit-loop style for debuggability.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2fb268e8-3d3c-45be-899f-b7e8ec0c2574

📥 Commits

Reviewing files that changed from the base of the PR and between 0174701 and 904f1ac.

📒 Files selected for processing (87)
  • .github/workflows/arduino_library_lint.yml
  • .github/workflows/avr8js_uno_test.yml
  • .github/workflows/build.yml
  • .github/workflows/build_adafruit_feather_nrf52840_sense.yml
  • .github/workflows/build_adafruit_xiaoblesense.yml
  • .github/workflows/build_apollo3_red.yml
  • .github/workflows/build_apollo3_thing_explorable.yml
  • .github/workflows/build_atmega8a.yml
  • .github/workflows/build_attiny1604.yml
  • .github/workflows/build_attiny1616.yml
  • .github/workflows/build_attiny4313.yml
  • .github/workflows/build_attiny85.yml
  • .github/workflows/build_attiny88.yml
  • .github/workflows/build_blackpill_stm32f4.yml
  • .github/workflows/build_bluepill.yml
  • .github/workflows/build_clone_and_compile.yml
  • .github/workflows/build_digix.yml
  • .github/workflows/build_due.yml
  • .github/workflows/build_esp32_i2s_ws2812.yml
  • .github/workflows/build_esp32c2.yml
  • .github/workflows/build_esp32c3.yml
  • .github/workflows/build_esp32c5.yml
  • .github/workflows/build_esp32c6.yml
  • .github/workflows/build_esp32dev.yml
  • .github/workflows/build_esp32dev_idf3.3.yml
  • .github/workflows/build_esp32dev_idf4.4.yml
  • .github/workflows/build_esp32dev_namespace.yml
  • .github/workflows/build_esp32h2.yml
  • .github/workflows/build_esp32p4.yml
  • .github/workflows/build_esp32s2.yml
  • .github/workflows/build_esp32s3.yml
  • .github/workflows/build_esp32wroom.yml
  • .github/workflows/build_esp8266.yml
  • .github/workflows/build_esp_extra_libs.yml
  • .github/workflows/build_giga_r1.yml
  • .github/workflows/build_linux.yml
  • .github/workflows/build_maple_map.yml
  • .github/workflows/build_mgm240s_thingplusmatter.yml
  • .github/workflows/build_nano_every.yml
  • .github/workflows/build_nrf52840_dk.yml
  • .github/workflows/build_nrf52_xiaoblesense.yml
  • .github/workflows/build_nucleo_f429zi.yml
  • .github/workflows/build_nucleo_f439zi.yml
  • .github/workflows/build_rgbw.yml
  • .github/workflows/build_rp2040.yml
  • .github/workflows/build_rp2350.yml
  • .github/workflows/build_rp2350B.yml
  • .github/workflows/build_stm103tb.yml
  • .github/workflows/build_teensy30.yml
  • .github/workflows/build_teensy31.yml
  • .github/workflows/build_teensy32.yml
  • .github/workflows/build_teensy35.yml
  • .github/workflows/build_teensy36.yml
  • .github/workflows/build_teensy40.yml
  • .github/workflows/build_teensy41.yml
  • .github/workflows/build_teensy41_ofled.yml
  • .github/workflows/build_teensyLC.yml
  • .github/workflows/build_teensy_octo.yml
  • .github/workflows/build_uno_r4_wifif.yml
  • .github/workflows/build_wasm.yml
  • .github/workflows/build_wasm_compilers.yml
  • .github/workflows/build_yun.yml
  • .github/workflows/check_attiny85.yml
  • .github/workflows/check_bluepill_size.yml
  • .github/workflows/check_esp32_size.yml
  • .github/workflows/check_teensy30_size.yml
  • .github/workflows/check_teensy31_size.yml
  • .github/workflows/check_teensy32_size.yml
  • .github/workflows/check_teensy35_size.yml
  • .github/workflows/check_teensy36_size.yml
  • .github/workflows/check_teensy41_size.yml
  • .github/workflows/check_teensylc_size.yml
  • .github/workflows/check_uno_size.yml
  • .github/workflows/docker_build_compiler.yml
  • .github/workflows/docker_compiler_template.yml
  • .github/workflows/example_test_linux.yml
  • .github/workflows/example_test_macos.yml
  • .github/workflows/example_test_windows.yml
  • .github/workflows/header-perf.yml
  • .github/workflows/iwyu.yml
  • .github/workflows/qemu_esp32c3_test.yml
  • .github/workflows/qemu_esp32dev_test.yml
  • .github/workflows/qemu_esp32s3_test.yml
  • .github/workflows/unit_test_linux.yml
  • .github/workflows/unit_test_macos.yml
  • .github/workflows/unit_test_windows.yml
  • ci/tools/gh/limit_agent_pr_workflows.py
💤 Files with no reviewable changes (4)
  • .github/workflows/avr8js_uno_test.yml
  • .github/workflows/qemu_esp32dev_test.yml
  • .github/workflows/qemu_esp32c3_test.yml
  • .github/workflows/qemu_esp32s3_test.yml


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

cancel-in-progress condition is now dead after PR trigger removal.

With no pull_request trigger, this expression is always false, so superseded runs won’t be canceled.

Suggested fix
-  cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+  cancel-in-progress: true
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build_esp_extra_libs.yml at line 5, The current
cancel-in-progress expression (cancel-in-progress: ${{ github.event_name ==
'pull_request' }}) is always false because the pull_request trigger was removed;
change it to a static true (cancel-in-progress: true) or replace the condition
with an appropriate event check that matches your triggers (e.g., include
github.event_name == 'workflow_run' if you want to cancel runs triggered by
workflow_run) so that the workflow actually cancels superseded runs; update the
cancel-in-progress line accordingly where the cancel-in-progress key is defined.

Comment thread .github/workflows/header-perf.yml Outdated
Comment on lines 8 to 10
workflow_dispatch:
push:
branches: [master, main]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Scope push triggers to master only.

Line 10 still includes main, so this workflow can run automatically on main pushes despite the PR objective to keep push workflows scoped to master.

Suggested fix
 on:
   workflow_dispatch:
   push:
-    branches: [master, main]
+    branches: [master]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
workflow_dispatch:
push:
branches: [master, main]
workflow_dispatch:
push:
branches: [master]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/header-perf.yml around lines 8 - 10, The push trigger
currently lists both branches in the workflow definition (the push: branches:
[master, main] block); remove "main" so pushes only target "master" by updating
the push branches array to include only "master" (keep workflow_dispatch
unchanged) to ensure the workflow no longer runs on main pushes.

Comment on lines +36 to +54
@dataclass(frozen=True)
class EventBlock:
name: str
start: int
end: int
indent: int


@dataclass(frozen=True)
class OnBlock:
start: int
end: int
indent: int
child_indent: int
events: dict[str, EventBlock]


@dataclass
class WorkflowResult:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check whether a typechecked provider such as typeguard is already declared.
# Expected: dependency/config reference for typeguard, or confirm which project-approved decorator to use.

rg -n -C2 '\btypeguard\b|\btypechecked\b' pyproject.toml requirements*.txt setup.py setup.cfg tox.ini . || true

Repository: FastLED/FastLED

Length of output: 6761


🏁 Script executed:

cat -n ci/tools/gh/limit_agent_pr_workflows.py

Repository: FastLED/FastLED

Length of output: 11986


Add @typechecked decorator to all three dataclasses.

typeguard>=4.4.4 is already declared in pyproject.toml. Import it and apply the decorator to EventBlock, OnBlock, and WorkflowResult following the established pattern: @typechecked before @dataclass.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ci/tools/gh/limit_agent_pr_workflows.py` around lines 36 - 54, Import the
typechecked decorator from typeguard and apply it to the three dataclasses by
adding `@typechecked` immediately before the existing `@dataclass` for EventBlock,
OnBlock, and WorkflowResult; ensure you add the import (e.g., from typeguard
import typechecked) near the other imports and place `@typechecked` above each
class declaration (i.e., before `@dataclass`) so EventBlock, OnBlock, and
WorkflowResult are all type-checked at runtime.

Comment thread ci/tools/gh/limit_agent_pr_workflows.py Outdated
Comment on lines +76 to +127
def find_on_block(lines: list[str]) -> OnBlock | None:
on_start = None
on_indent = 0
for index, line in enumerate(lines):
if line.strip() == "on:":
on_start = index
on_indent = line_indent(line)
break

if on_start is None:
return None

on_end = len(lines)
for index in range(on_start + 1, len(lines)):
stripped = lines[index].strip()
if not stripped or stripped.startswith("#"):
continue
if line_indent(lines[index]) <= on_indent:
on_end = index
break

child_indent = 2
for index in range(on_start + 1, on_end):
stripped = lines[index].strip()
if not stripped or stripped.startswith("#"):
continue
indent = line_indent(lines[index])
if indent > on_indent:
child_indent = indent
break

events: dict[str, EventBlock] = {}
event_starts: list[tuple[str, int]] = []
for index in range(on_start + 1, on_end):
line = lines[index]
if line_indent(line) != child_indent:
continue
match = EVENT_RE.match(line.strip())
if match:
event_starts.append((match.group(1), index))

for position, (name, start) in enumerate(event_starts):
end = event_starts[position + 1][1] if position + 1 < len(event_starts) else on_end
events[name] = EventBlock(name=name, start=start, end=end, indent=child_indent)

return OnBlock(
start=on_start,
end=on_end,
indent=on_indent,
child_indent=child_indent,
events=events,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Identify workflow trigger shapes this text parser is likely to miss.
# Expected: no output. Any output should be reviewed before relying on --check.

python - <<'PY'
from pathlib import Path
import re

workflow_dir = Path(".github/workflows")
if not workflow_dir.is_dir():
    raise SystemExit("missing .github/workflows")

for path in sorted([*workflow_dir.glob("*.yml"), *workflow_dir.glob("*.yaml")]):
    text = path.read_text(encoding="utf-8")
    for lineno, line in enumerate(text.splitlines(), start=1):
        if re.match(r"^\s*['\"]?on['\"]?\s*:\s*\S", line):
            print(f"{path}:{lineno}: inline or quoted on key: {line}")
        if re.match(r"^\s*pull_request\s*:\s*\S", line):
            print(f"{path}:{lineno}: inline pull_request config: {line}")
PY

Repository: FastLED/FastLED

Length of output: 41


Implement fail-fast error handling for unsupported YAML on: block shapes.

The find_on_block() function returns None when it cannot find a literal block-style on: key, silently treating the workflow as having no trigger configuration. This violates the guideline: "Never use silent fallbacks for missing critical resources—always fail fast with descriptive errors."

While the current repository workflows do not use inline on: keys or quoted variants that would be missed by this parser, the code structure itself violates the fail-fast principle. Replace the silent fallback with an explicit error when the on: block cannot be parsed, or implement a proper YAML round-trip parser that handles all valid trigger formats.

Applies to: 218-224

Comment thread ci/tools/gh/limit_agent_pr_workflows.py Outdated
Comment on lines +141 to +153
def ensure_event_branches_master(
lines: list[str], event_name: str, changes: list[str]
) -> list[str]:
on_block = find_on_block(lines)
if on_block is None:
return lines
event = on_block.events.get(event_name)
if event is None:
return lines
if has_nested_key(lines, event, "branches") or has_nested_key(
lines, event, "branches-ignore"
):
return lines

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Validate existing branch filters instead of only checking that one exists.

Line 150 returns unchanged for any existing branches or branches-ignore, so push.branches: [develop] or branches-ignore would pass even though the policy says pushes should remain scoped to master. The same helper is also used for allowlisted pull_request triggers.

🔧 Suggested direction
-    if has_nested_key(lines, event, "branches") or has_nested_key(
-        lines, event, "branches-ignore"
-    ):
-        return lines
+    if has_nested_key(lines, event, "branches-ignore"):
+        raise ValueError(
+            f"{event_name} uses branches-ignore; expected branches limited to master"
+        )
+    if has_nested_key(lines, event, "branches"):
+        # Parse/validate the existing branch list and rewrite or fail unless it is exactly master.
+        return lines
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ci/tools/gh/limit_agent_pr_workflows.py` around lines 141 - 153, The current
ensure_event_branches_master bail-out returns whenever a branches or
branches-ignore key exists without validating its contents; update
ensure_event_branches_master to read the actual branch list under the event (use
the found event object from find_on_block and helpers like
has_nested_key/get_nested_value or parse the YAML subsection) and validate that
branches are strictly scoped to "master" (and that branches-ignore does not
permit non-master pushes), and if the list contains other branches replace or
rewrite the underlying lines to enforce branches: [master] (apply the same
validation and replacement logic for branches-ignore), referencing the
ensure_event_branches_master function, the event variable returned by
find_on_block, and the has_nested_key check to locate where to add the content
validation and replacement.

Comment on lines +247 to +283
def parse_args(argv: list[str]) -> argparse.Namespace:
parser = argparse.ArgumentParser(
description="Limit GitHub Actions pull_request triggers to the agent PR allowlist."
)
parser.add_argument(
"--workflows-dir",
type=Path,
default=Path(".github/workflows"),
help="Directory containing workflow .yml/.yaml files.",
)
parser.add_argument(
"--allow-pr",
action="append",
default=[],
metavar="FILENAME",
help="Additional workflow filename allowed to keep pull_request.",
)
parser.add_argument(
"--apply",
action="store_true",
help="Rewrite workflow files. Without this flag, only print the planned changes.",
)
parser.add_argument(
"--check",
action="store_true",
help="Return a non-zero exit code if any workflow would change.",
)
parser.add_argument(
"--print-allowlist",
action="store_true",
help="Print the effective PR allowlist and exit.",
)
return parser.parse_args(argv)


def main(argv: list[str] | None = None) -> int:
args = parse_args(sys.argv[1:] if argv is None else argv)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Align CLI signatures with the repository parser convention.

parse_args should accept an optional argument list, and main currently violates the no-default-parameter rule with argv = None.

As per coding guidelines, “parse_args functions MUST accept an optional list[str] parameter for testing flexibility” and “All function parameters MUST have explicit type annotations and MUST NOT have default values.”

♻️ Proposed signature cleanup
-def parse_args(argv: list[str]) -> argparse.Namespace:
+def parse_args(argv: list[str] | None) -> argparse.Namespace:
@@
-def main(argv: list[str] | None = None) -> int:
-    args = parse_args(sys.argv[1:] if argv is None else argv)
+def main(argv: list[str] | None) -> int:
+    args = parse_args(argv)
@@
 if __name__ == "__main__":
-    raise SystemExit(main())
+    raise SystemExit(main(None))
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ci/tools/gh/limit_agent_pr_workflows.py` around lines 247 - 283, parse_args
currently requires a list[str] and main uses a default None parameter, violating
the repo convention; change parse_args to accept an optional argv parameter
(e.g., argv: list[str] | None = None) and inside it use sys.argv[1:] when argv
is None, and change main to require an explicit argv parameter with no default
(e.g., main(argv: list[str]) -> int) and pass that argv into parse_args; update
any internal calls accordingly so parse_args and main match the repository's
required signatures and type-annotation rules.

@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: 2

♻️ Duplicate comments (4)
ci/tools/gh/limit_agent_pr_workflows.py (4)

140-152: ⚠️ Potential issue | 🟠 Major

Validate existing branch filters before accepting them.

This currently treats any existing branches or branches-ignore key as compliant. A workflow with push.branches: [develop] or branches-ignore would pass even though the policy requires master scoping.

🔧 Suggested direction
-    if has_nested_key(lines, event, "branches") or has_nested_key(
-        lines, event, "branches-ignore"
-    ):
-        return lines
+    if has_nested_key(lines, event, "branches-ignore"):
+        raise ValueError(
+            f"{event_name} uses branches-ignore; expected branches limited to master"
+        )
+    if has_nested_key(lines, event, "branches"):
+        # Parse/validate the existing branch values and rewrite or fail unless
+        # they are exactly ["master"].
+        return lines
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ci/tools/gh/limit_agent_pr_workflows.py` around lines 140 - 152, The current
ensure_event_branches_master function incorrectly treats any existing branches
or branches-ignore key as compliant; change it to validate their values: for an
event with a "branches" key (use event and has_nested_key), parse the branch
list and ensure "master" is present—if not, add "master" to that list; for a
"branches-ignore" key, parse its list and ensure it does NOT contain "master"—if
it does, remove "master" from that ignore list or replace the key with a
compliant "branches: ['master']" entry; update the lines buffer accordingly
instead of early-returning when has_nested_key is true so the function enforces
the required master scoping.

75-85: ⚠️ Potential issue | 🟠 Major

Fail fast when the workflow trigger block cannot be parsed.

Returning None silently skips files with missing or unsupported on: shapes, so --check can pass without enforcing policy on those workflows.

Run this read-only check to find workflow trigger shapes this parser may skip:

#!/bin/bash
# Description: Find workflow files with inline/quoted/non-block trigger shapes.
# Expected: no output, or explicit parser support/fail-fast handling for every match.

python - <<'PY'
from pathlib import Path
import re

workflow_dir = Path(".github/workflows")
if not workflow_dir.is_dir():
    raise SystemExit("missing .github/workflows")

for path in sorted([*workflow_dir.glob("*.yml"), *workflow_dir.glob("*.yaml")]):
    text = path.read_text(encoding="utf-8")
    for lineno, line in enumerate(text.splitlines(), start=1):
        if re.match(r"^\s*['\"]?on['\"]?\s*:\s*\S", line):
            print(f"{path}:{lineno}: inline or quoted on key: {line}")
        if re.match(r"^\s*pull_request\s*:\s*\S", line):
            print(f"{path}:{lineno}: inline pull_request config: {line}")
PY

Based on learnings, “Never use silent fallbacks for missing critical resources - always fail fast with descriptive errors”.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ci/tools/gh/limit_agent_pr_workflows.py` around lines 75 - 85, The parser
currently returns None from find_on_block when it can't find or parse an on:
trigger, allowing --check to silently skip workflows; change find_on_block to
fail fast by raising a descriptive exception (e.g., ValueError or a custom
ParseError) instead of returning None, and modify the function signature to
accept contextual info (like the workflow path or raw text) so the error message
can include which file/lines failed; update any callers of find_on_block to let
the exception propagate (or catch and surface it as a non-zero check failure) so
missing/unsupported on: shapes cause the CI check to fail rather than be
ignored.

246-282: 🛠️ Refactor suggestion | 🟠 Major

Align CLI signatures with the repository parser convention.

parse_args should accept optional argv for tests, while main should not use a default parameter value.

♻️ Proposed signature cleanup
-def parse_args(argv: list[str]) -> argparse.Namespace:
+def parse_args(argv: list[str] | None) -> argparse.Namespace:
@@
-    return parser.parse_args(argv)
+    return parser.parse_args(sys.argv[1:] if argv is None else argv)
@@
-def main(argv: list[str] | None = None) -> int:
-    args = parse_args(sys.argv[1:] if argv is None else argv)
+def main(argv: list[str] | None) -> int:
+    args = parse_args(argv)
@@
 if __name__ == "__main__":
-    raise SystemExit(main())
+    raise SystemExit(main(None))

As per coding guidelines, “parse_args functions MUST accept an optional list[str] parameter for testing flexibility” and “All function parameters MUST have explicit type annotations and MUST NOT have default values.”

Also applies to: 319-320

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ci/tools/gh/limit_agent_pr_workflows.py` around lines 246 - 282, Change
parse_args to accept an optional argv by updating its signature to
parse_args(argv: list[str] | None = None) and inside it call
parser.parse_args(argv if argv is not None else sys.argv[1:]); then remove the
default on main by changing main to def main(argv: list[str]) -> int and call
args = parse_args(argv) so main no longer has a default parameter and parse_args
supports tests via an optional argv.

17-17: 🛠️ Refactor suggestion | 🟠 Major

Add @typechecked to the dataclasses.

EventBlock, OnBlock, and WorkflowResult are missing runtime type validation decorators.

Run this read-only check to confirm the project-approved provider before applying the decorator:

#!/bin/bash
# Description: Verify whether typeguard/typechecked is already declared or used.
# Expected: dependency/config references for typeguard or existing project usage of `@typechecked`.

fd -a '^(pyproject\.toml|requirements.*\.txt|setup\.(py|cfg)|tox\.ini)$' . \
  -x rg -n -C2 '\b(typeguard|typechecked)\b' {} || true

rg -n -C2 '@typechecked|from typeguard import typechecked|import typeguard' . || true
♻️ Proposed fix
 from dataclasses import dataclass
 from pathlib import Path
 
+from typeguard import typechecked
+
 
 DEFAULT_PR_ALLOWLIST = frozenset(
@@
-@dataclass(frozen=True)
+@typechecked
+@dataclass(frozen=True)
 class EventBlock:
@@
-@dataclass(frozen=True)
+@typechecked
+@dataclass(frozen=True)
 class OnBlock:
@@
-@dataclass
+@typechecked
+@dataclass
 class WorkflowResult:

Based on learnings, “Use typechecked decorator with dataclass for runtime type validation”.

Also applies to: 35-54

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ci/tools/gh/limit_agent_pr_workflows.py` at line 17, Add runtime type
validation by importing and applying the `@typechecked` decorator from typeguard
to each dataclass: put "from typeguard import typechecked" at the top (if not
already present) and add `@typechecked` immediately above the `@dataclass` for
EventBlock, OnBlock, and WorkflowResult (the dataclass declarations in this
file). Before committing, run the provided read-only check script to confirm the
project uses typeguard/typechecked so you don’t introduce an unapproved
dependency.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ci/tools/gh/limit_agent_pr_workflows.py`:
- Around line 21-30: DEFAULT_PR_ALLOWLIST is missing "arduino_library_lint.yml"
so the PR workflow checker will treat that workflow as disallowed; update the
frozenset DEFAULT_PR_ALLOWLIST in limit_agent_pr_workflows.py to include
"arduino_library_lint.yml" alongside the existing entries (unit_test_linux.yml,
example_test_linux.yml, build_uno.yml, build_esp32s3.yml, build_teensy41.yml,
build_wasm.yml) so the list matches the policy and the pull_request trigger for
arduino_library_lint.yml is preserved.
- Around line 241-243: The function workflow_files uses list and generator
comprehensions which violate the style rule; replace them with explicit loops:
build the files list by iterating over workflows_dir.glob("*.yml") and
workflows_dir.glob("*.yaml") and append each Path to a list, then iterate that
list and append only path.is_file() entries to the result before returning;
apply the same explicit-loop replacement for the other comprehension occurrences
in this module that create filtered workflow lists (look for similar uses
building and filtering Path lists).

---

Duplicate comments:
In `@ci/tools/gh/limit_agent_pr_workflows.py`:
- Around line 140-152: The current ensure_event_branches_master function
incorrectly treats any existing branches or branches-ignore key as compliant;
change it to validate their values: for an event with a "branches" key (use
event and has_nested_key), parse the branch list and ensure "master" is
present—if not, add "master" to that list; for a "branches-ignore" key, parse
its list and ensure it does NOT contain "master"—if it does, remove "master"
from that ignore list or replace the key with a compliant "branches: ['master']"
entry; update the lines buffer accordingly instead of early-returning when
has_nested_key is true so the function enforces the required master scoping.
- Around line 75-85: The parser currently returns None from find_on_block when
it can't find or parse an on: trigger, allowing --check to silently skip
workflows; change find_on_block to fail fast by raising a descriptive exception
(e.g., ValueError or a custom ParseError) instead of returning None, and modify
the function signature to accept contextual info (like the workflow path or raw
text) so the error message can include which file/lines failed; update any
callers of find_on_block to let the exception propagate (or catch and surface it
as a non-zero check failure) so missing/unsupported on: shapes cause the CI
check to fail rather than be ignored.
- Around line 246-282: Change parse_args to accept an optional argv by updating
its signature to parse_args(argv: list[str] | None = None) and inside it call
parser.parse_args(argv if argv is not None else sys.argv[1:]); then remove the
default on main by changing main to def main(argv: list[str]) -> int and call
args = parse_args(argv) so main no longer has a default parameter and parse_args
supports tests via an optional argv.
- Line 17: Add runtime type validation by importing and applying the
`@typechecked` decorator from typeguard to each dataclass: put "from typeguard
import typechecked" at the top (if not already present) and add `@typechecked`
immediately above the `@dataclass` for EventBlock, OnBlock, and WorkflowResult
(the dataclass declarations in this file). Before committing, run the provided
read-only check script to confirm the project uses typeguard/typechecked so you
don’t introduce an unapproved dependency.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b7ec5353-5366-4391-834c-a1b6900d28a8

📥 Commits

Reviewing files that changed from the base of the PR and between 904f1ac and 82c7d75.

📒 Files selected for processing (2)
  • .github/workflows/arduino_library_lint.yml
  • ci/tools/gh/limit_agent_pr_workflows.py
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/arduino_library_lint.yml

Comment on lines +21 to +30
DEFAULT_PR_ALLOWLIST = frozenset(
{
"unit_test_linux.yml",
"example_test_linux.yml",
"build_uno.yml",
"build_esp32s3.yml",
"build_teensy41.yml",
"build_wasm.yml",
}
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Add arduino_library_lint.yml to the default PR allowlist.

The linked policy lists seven allowed PR workflows, but this constant only has six. As written, the checker will treat arduino_library_lint.yml as disallowed and remove/fail its pull_request trigger.

🐛 Proposed fix
 DEFAULT_PR_ALLOWLIST = frozenset(
     {
         "unit_test_linux.yml",
         "example_test_linux.yml",
+        "arduino_library_lint.yml",
         "build_uno.yml",
         "build_esp32s3.yml",
         "build_teensy41.yml",
         "build_wasm.yml",
     }
 )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ci/tools/gh/limit_agent_pr_workflows.py` around lines 21 - 30,
DEFAULT_PR_ALLOWLIST is missing "arduino_library_lint.yml" so the PR workflow
checker will treat that workflow as disallowed; update the frozenset
DEFAULT_PR_ALLOWLIST in limit_agent_pr_workflows.py to include
"arduino_library_lint.yml" alongside the existing entries (unit_test_linux.yml,
example_test_linux.yml, build_uno.yml, build_esp32s3.yml, build_teensy41.yml,
build_wasm.yml) so the list matches the policy and the pull_request trigger for
arduino_library_lint.yml is preserved.

Comment on lines +241 to +243
def workflow_files(workflows_dir: Path) -> list[Path]:
files = [*workflows_dir.glob("*.yml"), *workflows_dir.glob("*.yaml")]
return sorted(path for path in files if path.is_file())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Replace comprehensions with explicit loops.

These list/generator comprehensions violate the repository Python style rule.

♻️ Proposed refactor
 def workflow_files(workflows_dir: Path) -> list[Path]:
-    files = [*workflows_dir.glob("*.yml"), *workflows_dir.glob("*.yaml")]
-    return sorted(path for path in files if path.is_file())
+    files: list[Path] = []
+    for path in workflows_dir.glob("*.yml"):
+        if path.is_file():
+            files.append(path)
+    for path in workflows_dir.glob("*.yaml"):
+        if path.is_file():
+            files.append(path)
+    return sorted(files)
@@
-    results = [
-        transform_workflow(path, allow_pr=path.name in allowlist)
-        for path in workflow_files(workflows_dir)
-    ]
-    changed = [result for result in results if result.changed]
+    results: list[WorkflowResult] = []
+    for path in workflow_files(workflows_dir):
+        results.append(transform_workflow(path, allow_pr=path.name in allowlist))
+
+    changed: list[WorkflowResult] = []
+    for result in results:
+        if result.changed:
+            changed.append(result)

As per coding guidelines, “Use explicit loops instead of list comprehensions for code clarity and debuggability”.

Also applies to: 295-299

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ci/tools/gh/limit_agent_pr_workflows.py` around lines 241 - 243, The function
workflow_files uses list and generator comprehensions which violate the style
rule; replace them with explicit loops: build the files list by iterating over
workflows_dir.glob("*.yml") and workflows_dir.glob("*.yaml") and append each
Path to a list, then iterate that list and append only path.is_file() entries to
the result before returning; apply the same explicit-loop replacement for the
other comprehension occurrences in this module that create filtered workflow
lists (look for similar uses building and filtering Path lists).

@zackees
zackees force-pushed the codex/limit-agent-pr-workflows-2393 branch from 82c7d75 to d60f093 Compare April 23, 2026 06:43
@zackees
zackees force-pushed the codex/limit-agent-pr-workflows-2393 branch from d60f093 to 4d7a7ab Compare April 23, 2026 06:46

@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.

♻️ Duplicate comments (6)
ci/tools/gh/limit_agent_pr_workflows.py (6)

246-282: 🛠️ Refactor suggestion | 🟠 Major

CLI signatures violate repo conventions.

  • parse_args must accept an optional list[str] | None for testing flexibility.
  • main uses a default value (argv: list[str] | None = None), which violates "All function parameters MUST have explicit type annotations and MUST NOT have default values." Move the sys.argv[1:] fallback into parse_args and have main take argv with no default; update the __main__ guard to call main(None) or main(sys.argv[1:]) accordingly.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ci/tools/gh/limit_agent_pr_workflows.py` around lines 246 - 282, The CLI
signatures violate repo conventions: change parse_args to accept argv: list[str]
| None and move the sys.argv fallback into parse_args (i.e., inside parse_args,
if argv is None set argv = sys.argv[1:]), and remove the default value from main
so its signature is main(argv: list[str] | None) with no default; update the
__main__ guard to call main(None) (or pass sys.argv[1:] explicitly) accordingly;
update references to parse_args(main's argv) so parse_args is called with the
argv passed into main.

241-243: 🛠️ Refactor suggestion | 🟠 Major

Replace list/generator comprehensions with explicit loops.

As per coding guidelines ("Use explicit loops instead of list comprehensions for code clarity and debuggability"), rewrite the comprehensions in workflow_files (line 242–243) and in main (lines 295–299) as explicit for loops.

Also applies to: 295-299

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ci/tools/gh/limit_agent_pr_workflows.py` around lines 241 - 243, Rewrite the
list/generator comprehensions in workflow_files and in main to use explicit
for-loops: in workflow_files (function workflow_files) replace the combined glob
comprehension that builds files and the sorted generator expression that filters
path.is_file() with two explicit loops that first extend a files list with
results of workflows_dir.glob("*.yml") and workflows_dir.glob("*.yaml"), then
build a new list by iterating over files and appending only those where
path.is_file(), and finally return sorted(...) of that filtered list; similarly
in main (the block around where files/workflows are collected at lines ~295–299)
replace any list or generator comprehensions with equivalent for-loops that
append items to a list, preserving the same order and semantics.

75-94: ⚠️ Potential issue | 🟠 Major

Silent fallback when on: block is unparseable.

find_on_block returns None for any workflow whose top-level on: key isn't a literal block scalar (e.g., inline on: push, quoted "on":, or unusual indentation). Callers then silently skip the file, which violates the "fail fast with descriptive errors" rule. Current repo workflows happen to all use block form, but a raised error (or at minimum a stderr warning and non-zero exit via --check) would prevent future drift from silently bypassing the policy.


35-57: 🛠️ Refactor suggestion | 🟠 Major

Missing @typechecked on dataclasses.

As per coding guidelines ("Use @typechecked decorator with @dataclass for runtime type validation"), EventBlock, OnBlock, and WorkflowResult should be decorated with @typechecked (from typeguard, already a project dep) above @dataclass.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ci/tools/gh/limit_agent_pr_workflows.py` around lines 35 - 57, The
dataclasses EventBlock, OnBlock, and WorkflowResult lack runtime type
validation; add the `@typechecked` decorator from typeguard above each `@dataclass`
declaration (decorate EventBlock, OnBlock, and WorkflowResult) and ensure you
import typechecked (from typeguard import typechecked) at the top of the file so
the runtime type checks are enabled for their fields.

21-30: ⚠️ Potential issue | 🟡 Minor

Allowlist diverges from the linked issue (7 vs. 6 workflows).

The linked issue #2393 lists arduino_library_lint.yml as one of seven allowed PR workflows, but this DEFAULT_PR_ALLOWLIST contains only six. The PR description states Arduino library lint is intentionally kept as push/manual only, so please confirm the issue's policy is the one being superseded — otherwise running --apply will silently strip a pull_request trigger that was supposed to remain. Consider adding a short comment here recording that the divergence is deliberate.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ci/tools/gh/limit_agent_pr_workflows.py` around lines 21 - 30, The
DEFAULT_PR_ALLOWLIST currently lists six workflows but the linked issue `#2393`
lists seven (including arduino_library_lint.yml), so either update the frozenset
DEFAULT_PR_ALLOWLIST to include "arduino_library_lint.yml" to match the issue,
or explicitly document the intentional divergence by adding a short inline
comment next to DEFAULT_PR_ALLOWLIST referencing issue `#2393` and stating that
arduino_library_lint.yml is intentionally excluded (push/manual only) so the
apply step won't remove a pull_request trigger unexpectedly; modify
DEFAULT_PR_ALLOWLIST or add the comment accordingly.

140-152: ⚠️ Potential issue | 🟠 Major

ensure_event_branches_master doesn't validate existing branch filters.

If a workflow already has push.branches: [develop] or branches-ignore: [master], this function returns unchanged and the policy ("push scoped to master") is silently bypassed. Validate the contents of any existing branches/branches-ignore key and rewrite or fail when they don't match master.

🧹 Nitpick comments (3)
.github/workflows/build_nrf52_xiaoblesense.yml (1)

3-5: Stale pull_request reference in concurrency.

With the pull_request trigger removed, cancel-in-progress will always evaluate to false. Consider simplifying to a constant (e.g., false, or true if you want to cancel superseded master runs) to avoid confusion for future readers.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build_nrf52_xiaoblesense.yml around lines 3 - 5, The
concurrency section uses cancel-in-progress: ${{ github.event_name ==
'pull_request' }} which is now always false because the pull_request trigger was
removed; change the cancel-in-progress value to an explicit boolean (e.g., set
cancel-in-progress to false or true) in the concurrency block so the intent is
clear and no longer depends on github.event_name or the pull_request string;
update the concurrency keys (group, cancel-in-progress) accordingly to remove
the stale expression.
.github/workflows/build_atmega8a.yml (1)

3-11: Stale cancel-in-progress condition after removing pull_request trigger.

With the pull_request trigger removed, github.event_name can only be push or workflow_dispatch, so cancel-in-progress will always evaluate to false. Not a functional bug, but consider simplifying for clarity.

♻️ Suggested simplification
 concurrency:
   group: ${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+  cancel-in-progress: false
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build_atmega8a.yml around lines 3 - 11, The concurrency
block's cancel-in-progress condition is now redundant because the `pull_request`
trigger was removed; update the `concurrency` configuration (the group and
cancel-in-progress keys) to a simpler form by removing the conditional
expression using `github.event_name` and set `cancel-in-progress` to a boolean
(likely true if you want to cancel prior runs on the same ref) or remove the key
entirely if not needed; edit the `concurrency` stanza that contains `group: ${{
github.workflow }}-${{ github.ref }}` and `cancel-in-progress: ${{
github.event_name == 'pull_request' }}` to the simplified form.
.github/workflows/build_wasm_compilers.yml (1)

5-5: Stale pull_request reference in concurrency config.

With the pull_request trigger removed, cancel-in-progress will always evaluate to false (only push/workflow_dispatch remain). Consider simplifying to a literal, or enabling cancellation for dispatch/push as intended. Likewise, step names such as "Checkout PR code" (Line 39) and the github.event.pull_request.head.sha fallback (Line 42) are now dead paths — the fallback github.sha is always used — and could be cleaned up for clarity.

Proposed simplification
 concurrency:
   group: ${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+  cancel-in-progress: false
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build_wasm_compilers.yml at line 5, The concurrency block
uses cancel-in-progress: ${{ github.event_name == 'pull_request' }} which is
stale now that pull_request trigger is removed; replace that expression with a
literal (true or false) depending on desired behavior (e.g., cancel-in-progress:
true to enable cancellation for push/workflow_dispatch), and remove or update
dead PR-specific items: rename the step "Checkout PR code" to a generic
"Checkout code" and remove the unused fallback reference to
github.event.pull_request.head.sha (replace usages with github.sha) so that the
workflow and steps (concurrency cancel-in-progress, step name, and SHA
reference) are consistent and no longer rely on pull_request data.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@ci/tools/gh/limit_agent_pr_workflows.py`:
- Around line 246-282: The CLI signatures violate repo conventions: change
parse_args to accept argv: list[str] | None and move the sys.argv fallback into
parse_args (i.e., inside parse_args, if argv is None set argv = sys.argv[1:]),
and remove the default value from main so its signature is main(argv: list[str]
| None) with no default; update the __main__ guard to call main(None) (or pass
sys.argv[1:] explicitly) accordingly; update references to parse_args(main's
argv) so parse_args is called with the argv passed into main.
- Around line 241-243: Rewrite the list/generator comprehensions in
workflow_files and in main to use explicit for-loops: in workflow_files
(function workflow_files) replace the combined glob comprehension that builds
files and the sorted generator expression that filters path.is_file() with two
explicit loops that first extend a files list with results of
workflows_dir.glob("*.yml") and workflows_dir.glob("*.yaml"), then build a new
list by iterating over files and appending only those where path.is_file(), and
finally return sorted(...) of that filtered list; similarly in main (the block
around where files/workflows are collected at lines ~295–299) replace any list
or generator comprehensions with equivalent for-loops that append items to a
list, preserving the same order and semantics.
- Around line 35-57: The dataclasses EventBlock, OnBlock, and WorkflowResult
lack runtime type validation; add the `@typechecked` decorator from typeguard
above each `@dataclass` declaration (decorate EventBlock, OnBlock, and
WorkflowResult) and ensure you import typechecked (from typeguard import
typechecked) at the top of the file so the runtime type checks are enabled for
their fields.
- Around line 21-30: The DEFAULT_PR_ALLOWLIST currently lists six workflows but
the linked issue `#2393` lists seven (including arduino_library_lint.yml), so
either update the frozenset DEFAULT_PR_ALLOWLIST to include
"arduino_library_lint.yml" to match the issue, or explicitly document the
intentional divergence by adding a short inline comment next to
DEFAULT_PR_ALLOWLIST referencing issue `#2393` and stating that
arduino_library_lint.yml is intentionally excluded (push/manual only) so the
apply step won't remove a pull_request trigger unexpectedly; modify
DEFAULT_PR_ALLOWLIST or add the comment accordingly.

---

Nitpick comments:
In @.github/workflows/build_atmega8a.yml:
- Around line 3-11: The concurrency block's cancel-in-progress condition is now
redundant because the `pull_request` trigger was removed; update the
`concurrency` configuration (the group and cancel-in-progress keys) to a simpler
form by removing the conditional expression using `github.event_name` and set
`cancel-in-progress` to a boolean (likely true if you want to cancel prior runs
on the same ref) or remove the key entirely if not needed; edit the
`concurrency` stanza that contains `group: ${{ github.workflow }}-${{ github.ref
}}` and `cancel-in-progress: ${{ github.event_name == 'pull_request' }}` to the
simplified form.

In @.github/workflows/build_nrf52_xiaoblesense.yml:
- Around line 3-5: The concurrency section uses cancel-in-progress: ${{
github.event_name == 'pull_request' }} which is now always false because the
pull_request trigger was removed; change the cancel-in-progress value to an
explicit boolean (e.g., set cancel-in-progress to false or true) in the
concurrency block so the intent is clear and no longer depends on
github.event_name or the pull_request string; update the concurrency keys
(group, cancel-in-progress) accordingly to remove the stale expression.

In @.github/workflows/build_wasm_compilers.yml:
- Line 5: The concurrency block uses cancel-in-progress: ${{ github.event_name
== 'pull_request' }} which is stale now that pull_request trigger is removed;
replace that expression with a literal (true or false) depending on desired
behavior (e.g., cancel-in-progress: true to enable cancellation for
push/workflow_dispatch), and remove or update dead PR-specific items: rename the
step "Checkout PR code" to a generic "Checkout code" and remove the unused
fallback reference to github.event.pull_request.head.sha (replace usages with
github.sha) so that the workflow and steps (concurrency cancel-in-progress, step
name, and SHA reference) are consistent and no longer rely on pull_request data.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d374ab5a-2fbe-4e4a-9308-d01b9ca52aec

📥 Commits

Reviewing files that changed from the base of the PR and between 82c7d75 and d60f093.

📒 Files selected for processing (87)
  • .github/workflows/arduino_library_lint.yml
  • .github/workflows/avr8js_uno_test.yml
  • .github/workflows/build.yml
  • .github/workflows/build_adafruit_feather_nrf52840_sense.yml
  • .github/workflows/build_adafruit_xiaoblesense.yml
  • .github/workflows/build_apollo3_red.yml
  • .github/workflows/build_apollo3_thing_explorable.yml
  • .github/workflows/build_atmega8a.yml
  • .github/workflows/build_attiny1604.yml
  • .github/workflows/build_attiny1616.yml
  • .github/workflows/build_attiny4313.yml
  • .github/workflows/build_attiny85.yml
  • .github/workflows/build_attiny88.yml
  • .github/workflows/build_blackpill_stm32f4.yml
  • .github/workflows/build_bluepill.yml
  • .github/workflows/build_clone_and_compile.yml
  • .github/workflows/build_digix.yml
  • .github/workflows/build_due.yml
  • .github/workflows/build_esp32_i2s_ws2812.yml
  • .github/workflows/build_esp32c2.yml
  • .github/workflows/build_esp32c3.yml
  • .github/workflows/build_esp32c5.yml
  • .github/workflows/build_esp32c6.yml
  • .github/workflows/build_esp32dev.yml
  • .github/workflows/build_esp32dev_idf3.3.yml
  • .github/workflows/build_esp32dev_idf4.4.yml
  • .github/workflows/build_esp32dev_namespace.yml
  • .github/workflows/build_esp32h2.yml
  • .github/workflows/build_esp32p4.yml
  • .github/workflows/build_esp32s2.yml
  • .github/workflows/build_esp32s3.yml
  • .github/workflows/build_esp32wroom.yml
  • .github/workflows/build_esp8266.yml
  • .github/workflows/build_esp_extra_libs.yml
  • .github/workflows/build_giga_r1.yml
  • .github/workflows/build_linux.yml
  • .github/workflows/build_maple_map.yml
  • .github/workflows/build_mgm240s_thingplusmatter.yml
  • .github/workflows/build_nano_every.yml
  • .github/workflows/build_nrf52840_dk.yml
  • .github/workflows/build_nrf52_xiaoblesense.yml
  • .github/workflows/build_nucleo_f429zi.yml
  • .github/workflows/build_nucleo_f439zi.yml
  • .github/workflows/build_rgbw.yml
  • .github/workflows/build_rp2040.yml
  • .github/workflows/build_rp2350.yml
  • .github/workflows/build_rp2350B.yml
  • .github/workflows/build_stm103tb.yml
  • .github/workflows/build_teensy30.yml
  • .github/workflows/build_teensy31.yml
  • .github/workflows/build_teensy32.yml
  • .github/workflows/build_teensy35.yml
  • .github/workflows/build_teensy36.yml
  • .github/workflows/build_teensy40.yml
  • .github/workflows/build_teensy41.yml
  • .github/workflows/build_teensy41_ofled.yml
  • .github/workflows/build_teensyLC.yml
  • .github/workflows/build_teensy_octo.yml
  • .github/workflows/build_uno_r4_wifif.yml
  • .github/workflows/build_wasm.yml
  • .github/workflows/build_wasm_compilers.yml
  • .github/workflows/build_yun.yml
  • .github/workflows/check_attiny85.yml
  • .github/workflows/check_bluepill_size.yml
  • .github/workflows/check_esp32_size.yml
  • .github/workflows/check_teensy30_size.yml
  • .github/workflows/check_teensy31_size.yml
  • .github/workflows/check_teensy32_size.yml
  • .github/workflows/check_teensy35_size.yml
  • .github/workflows/check_teensy36_size.yml
  • .github/workflows/check_teensy41_size.yml
  • .github/workflows/check_teensylc_size.yml
  • .github/workflows/check_uno_size.yml
  • .github/workflows/docker_build_compiler.yml
  • .github/workflows/docker_compiler_template.yml
  • .github/workflows/example_test_linux.yml
  • .github/workflows/example_test_macos.yml
  • .github/workflows/example_test_windows.yml
  • .github/workflows/header-perf.yml
  • .github/workflows/iwyu.yml
  • .github/workflows/qemu_esp32c3_test.yml
  • .github/workflows/qemu_esp32dev_test.yml
  • .github/workflows/qemu_esp32s3_test.yml
  • .github/workflows/unit_test_linux.yml
  • .github/workflows/unit_test_macos.yml
  • .github/workflows/unit_test_windows.yml
  • ci/tools/gh/limit_agent_pr_workflows.py
💤 Files with no reviewable changes (4)
  • .github/workflows/avr8js_uno_test.yml
  • .github/workflows/qemu_esp32dev_test.yml
  • .github/workflows/qemu_esp32s3_test.yml
  • .github/workflows/qemu_esp32c3_test.yml
✅ Files skipped from review due to trivial changes (25)
  • .github/workflows/build_esp_extra_libs.yml
  • .github/workflows/build.yml
  • .github/workflows/build_rp2350B.yml
  • .github/workflows/arduino_library_lint.yml
  • .github/workflows/build_clone_and_compile.yml
  • .github/workflows/unit_test_linux.yml
  • .github/workflows/build_wasm.yml
  • .github/workflows/build_attiny85.yml
  • .github/workflows/example_test_linux.yml
  • .github/workflows/build_esp32s3.yml
  • .github/workflows/build_teensy41.yml
  • .github/workflows/build_teensy41_ofled.yml
  • .github/workflows/docker_build_compiler.yml
  • .github/workflows/build_nucleo_f429zi.yml
  • .github/workflows/build_esp32wroom.yml
  • .github/workflows/docker_compiler_template.yml
  • .github/workflows/build_stm103tb.yml
  • .github/workflows/build_blackpill_stm32f4.yml
  • .github/workflows/check_teensy30_size.yml
  • .github/workflows/build_esp8266.yml
  • .github/workflows/build_esp32dev_namespace.yml
  • .github/workflows/build_maple_map.yml
  • .github/workflows/check_teensy32_size.yml
  • .github/workflows/build_adafruit_feather_nrf52840_sense.yml
  • .github/workflows/iwyu.yml
🚧 Files skipped from review as they are similar to previous changes (52)
  • .github/workflows/build_nrf52840_dk.yml
  • .github/workflows/build_digix.yml
  • .github/workflows/build_nucleo_f439zi.yml
  • .github/workflows/build_esp32dev_idf3.3.yml
  • .github/workflows/build_attiny1604.yml
  • .github/workflows/check_esp32_size.yml
  • .github/workflows/build_esp32_i2s_ws2812.yml
  • .github/workflows/example_test_macos.yml
  • .github/workflows/build_teensy30.yml
  • .github/workflows/build_bluepill.yml
  • .github/workflows/build_teensy32.yml
  • .github/workflows/build_apollo3_red.yml
  • .github/workflows/build_esp32c3.yml
  • .github/workflows/build_esp32c5.yml
  • .github/workflows/build_attiny88.yml
  • .github/workflows/check_teensylc_size.yml
  • .github/workflows/build_rp2040.yml
  • .github/workflows/example_test_windows.yml
  • .github/workflows/check_teensy36_size.yml
  • .github/workflows/build_teensy36.yml
  • .github/workflows/build_adafruit_xiaoblesense.yml
  • .github/workflows/build_rgbw.yml
  • .github/workflows/build_giga_r1.yml
  • .github/workflows/build_nano_every.yml
  • .github/workflows/build_attiny4313.yml
  • .github/workflows/check_attiny85.yml
  • .github/workflows/build_due.yml
  • .github/workflows/build_esp32dev_idf4.4.yml
  • .github/workflows/build_teensy_octo.yml
  • .github/workflows/unit_test_macos.yml
  • .github/workflows/build_teensy35.yml
  • .github/workflows/build_rp2350.yml
  • .github/workflows/build_yun.yml
  • .github/workflows/build_apollo3_thing_explorable.yml
  • .github/workflows/build_esp32dev.yml
  • .github/workflows/build_esp32c2.yml
  • .github/workflows/build_mgm240s_thingplusmatter.yml
  • .github/workflows/build_uno_r4_wifif.yml
  • .github/workflows/build_teensy31.yml
  • .github/workflows/build_attiny1616.yml
  • .github/workflows/build_teensyLC.yml
  • .github/workflows/unit_test_windows.yml
  • .github/workflows/build_esp32s2.yml
  • .github/workflows/build_esp32h2.yml
  • .github/workflows/header-perf.yml
  • .github/workflows/check_uno_size.yml
  • .github/workflows/check_bluepill_size.yml
  • .github/workflows/build_teensy40.yml
  • .github/workflows/build_esp32c6.yml
  • .github/workflows/build_esp32p4.yml
  • .github/workflows/check_teensy31_size.yml
  • .github/workflows/check_teensy35_size.yml

@zackees
zackees merged commit 34342ba into master Apr 23, 2026
5 of 6 checks passed
@zackees
zackees deleted the codex/limit-agent-pr-workflows-2393 branch August 21, 2026 19:15
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.

Limit agent PR workflows to the lightweight CI allowlist

1 participant