Skip to content

feat: implement issue #2018 — Wire PR_LIMITS_ORG_CAP org variable into the PR-limit admission gate - #2020

Merged
don-petry merged 6 commits into
mainfrom
dev-lead/issue-2018-20261002-1303
Oct 2, 2026
Merged

don-petry merged 6 commits into
mainfrom
dev-lead/issue-2018-20261002-1303

Conversation

@don-petry

@don-petry don-petry commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Wire PR_LIMITS_ORG_CAP org variable into the PR-limit admission gate

From the issue: petry-projects/.github#1221 adds a runtime override for the org-wide automation open-PR cap. plg_effective_org_cap in scripts/lib/pr-limit-gate.sh (in petry-projects/.github) now resolves the cap as:

Risk

Medium — changes GitHub Actions workflow behavior, which is exercised only post-merge; verify via the affected workflow runs.

Test plan

Tests added/updated: tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats. Verification: bash scripts/dev-lead-lint.sh (shellcheck --severity=warning) ran pre-commit; the bats suite runs in CI.

Rollback

Revert this PR. No non-revertible side effects (no tags, migrations, or external state).

Monitoring

Watch the affected workflow run(s) in the Actions tab and this PR's Lint check for regressions.

Closes #2018

Review in cubic

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 22 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 643f4c38-4681-4eaa-a06d-45ccd2e91c19

📥 Commits

Reviewing files that changed from the base of the PR and between d5141a0 and 2476110.

📒 Files selected for processing (3)
  • .github/workflows/dev-lead-reusable.yml
  • .github/workflows/gh-aw-cross-org.yml
  • tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats Outdated
Comment thread .github/workflows/gh-aw-cross-org.yml
@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-10-02T14:21:37Z.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (applied)

Changes committed and pushed. Requested items addressed:

  • tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats:271 — applied
  • .github/workflows/gh-aw-cross-org.yml:162 — applied

@don-petry
don-petry enabled auto-merge (squash) October 2, 2026 13:22

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces unit tests in test_fix_issue_pr_limit_gate.bats to verify that the PR_LIMITS_ORG_CAP environment variable is correctly wired and mapped across workflow steps. Feedback on these changes highlights two key improvements: first, replacing the unsafe use of mktemp -u with a secure mktemp call and proper error handling to prevent race conditions; second, optimizing the workflow validation loop to avoid performance issues from spawning yq repeatedly and to handle unnamed workflow steps robustly.

Comment thread tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats
Comment thread tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats Outdated
@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-10-02T14:29:15Z.

@donpetry-bot

donpetry-bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor
Superseded by automated re-review at 39aaa6f0f0fc5d10f5b82016d4ce68d90ebec7c0 — click to expand prior review.

Review — fix requested (cycle 1/3)

The automated review identified the following issues. Please address each one:

Findings to fix

Automated review — NEEDS HUMAN REVIEW

Risk: MEDIUM
Reviewed commit: 70bc598ae95691e76d302a9e328f1aa3036a5d18
Review mode: triage-approved (single reviewer)

Summary

Adds PR_LIMITS_ORG_CAP: ${{ vars.PR_LIMITS_ORG_CAP }} to the env of the two workflow steps that run dev-lead-fix-issue.sh, which is the only caller of plg_admission_gate (dev-lead-reusable.yml "Run issue" and gh-aw-cross-org.yml). It also adds bats coverage: env passthrough tests for set, unset and empty values, plus a yq-based check that every workflow step running the script maps the variable. The change itself is correct and small, and it doesn't touch secrets (vars.* only, no new run: interpolation). The triage tier cleared this as low-risk, but I'm escalating because two bot review threads are still unresolved and the unit job in Test Dev-Lead Agent hasn't finished.

Linked issue analysis

Closes #2018. The main acceptance criterion is met:

  • Every workflow step that invokes the gate passes the variable. I confirmed dev-lead-fix-issue.sh is the only script in this repo that sources pr-limit-gate.sh. initiative-driver.sh doesn't use the gate. Both workflow steps that run the script now map the variable.
  • Unset or empty leaves behavior unchanged. An undefined org var renders as "", and per feat(pr-limits): org variable PR_LIMITS_ORG_CAP to change the cap without code changes .github#1221 an empty value falls back silently.
  • Tests cover the env mapping. Satisfied.

Upstream dependency (not blocking): the script fetches the gate library from petry-projects/.github@main. petry-projects/.github#1221, which adds plg_effective_org_cap, is still OPEN, and main's pr-limit-gate.sh doesn't read PR_LIMITS_ORG_CAP yet. The wiring here is harmless and takes effect automatically once #1221 merges, because nothing is vendored. Until then the "variable set → gate uses it" criterion can't be observed live. #2018 will auto-close on merge, so consider tracking the end-to-end check against #1221.

Findings

Blocking (gate 4: unresolved review threads):

  1. tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats:236 (gemini-code-assist, low, unresolved): CAP_SEEN_FILE="$(mktemp -u)" only generates a name and doesn't create the file. Use mktemp, or a path under $BATS_TEST_TMPDIR, and drop the per-test rm -f (that cleanup is also skipped whenever an earlier assertion fails). Either fix this or reply and resolve the thread.
  2. tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats:285 (gemini-code-assist, medium, unresolved): the yq loop looks steps up again by .name. If a matching step has no name, it is looked up as "null" and the test fails with a misleading message. If two steps share a name, the multi-line val fails the check. Both cases fail closed, so this is a robustness nit, not a correctness hole. Collapsing to one yq pass that emits each matching step's .env.PR_LIMITS_ORG_CAP directly avoids both problems and the extra yq processes. Either fix this or reply and resolve the thread.

Non-blocking:

  • Two earlier cubic threads (yq skip in CI; unset vs. empty semantics) were addressed in 70bc598 and are resolved.
  • The workflow edits only add a vars.* env mapping inside existing env: blocks, with no new expression interpolation in run:. No Actions security smells.
  • Secret scan: the run_secret_scanning MCP tool isn't available in this session, so it was skipped. The gitleaks check passed.

CI status

Almost everything is green on 70bc598, including Lint, shellcheck, bats, actionlint, CodeQL, SonarCloud (quality gate passed), gitleaks and AgentShield. Pending: the unit job in Test Dev-Lead Agent (run 37012538994) is still in progress, so gate 2 isn't satisfied yet. The failed or cancelled dev-lead/*, review and Dismiss entries are superseded runs, and each has a successful run on the same head.


Reviewed automatically by the PR-review agent (single-reviewer mode: opus 5.5 [opus 4.8, opus 4.7]). Reply if you need a human review.

Additional tasks

  1. Resolve all unresolved review thread comments from other reviewers
  2. Ensure all CI checks pass after your changes
  3. Rebase on the target branch if behind
  4. Do NOT modify files unrelated to the findings above

The review cascade will automatically re-review after new commits are pushed.

@don-petry
don-petry disabled auto-merge October 2, 2026 13:37
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-reviews (partial)

A commit was pushed, but not every requested change was applied. Per requested item:

  • tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats:285 — not applied
  • tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats:236 — applied

The unaddressed items above still need work.

@don-petry
don-petry enabled auto-merge (squash) October 2, 2026 13:38

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 1 file (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats
@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-10-02T14:41:51Z.

@donpetry-bot

donpetry-bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor
Superseded by automated re-review at 39aaa6f0f0fc5d10f5b82016d4ce68d90ebec7c0 — click to expand prior review.

Review — fix requested (cycle 2/3)

The automated review identified the following issues. Please address each one:

Findings to fix

Automated review — NEEDS HUMAN REVIEW

Risk: MEDIUM
Reviewed commit: 39aaa6f0f0fc5d10f5b82016d4ce68d90ebec7c0
Cascade: triage → deep+duck (triage: haiku 4.5 [sonnet 5.5, sonnet 5] → deep: opus 5.5 [opus 4.8, sonnet 5.5] + duck: gemini-3.8-flash [sonnet 5.5] → audit: opus 5.5 [opus 4.8, opus 4.7])

Summary

Both reviewers rated the PR MEDIUM risk and chose escalate, so they agree fully. They also agree the code change is small and backwards-compatible. The escalation rests on the gates: the bats/unit CI jobs have no conclusion, one review thread on the bats file is unresolved, and upstream petry-projects/.github#1221 is still open. Both flagged the same temp-file leak in the test's cap-recording guard, but under different categories, so they were not merged. The rubber duck alone raised the yq regression test's brittleness and the lack of validation for non-numeric, zero or negative cap values.

Cross-engine agreement

full

Downstream impact

This change is consumed by 8 downstream repo(s) that pin the affected reusable workflow / lib / prompt. Impacted consumers:

Impacted shared surfaces:
  - .github/workflows/dev-lead-reusable.yml

Impacted consumers (8, fetching up to 10):
  - petry-projects/.github (pins .github/workflows/dev-lead-reusable.yml)
      .github/workflows/dev-lead.yml
  - petry-projects/.github-private (pins .github/workflows/dev-lead-reusable.yml)
      .github/workflows/dev-lead.yml
  - petry-projects/ContentTwin (pins .github/workflows/dev-lead-reusable.yml)
      .github/workflows/dev-lead.yml
  - petry-projects/TalkTerm (pins .github/workflows/dev-lead-reusable.yml)
      .github/workflows/dev-lead.yml
  - petry-projects/bmad-bgreat-suite (pins .github/workflows/dev-lead-reusable.yml)
      .github/workflows/dev-lead.yml
  - petry-projects/broodly (pins .github/workflows/dev-lead-reusable.yml)
      .github/workflows/dev-lead.yml
  - petry-projects/google-app-scripts (pins .github/workflows/dev-lead-reusable.yml)
      .github/workflows/dev-lead.yml
  - petry-projects/markets (pins .github/workflows/dev-lead-reusable.yml)
      .github/workflows/dev-lead.yml

Findings

  • minor: {"severity":"minor","category":"dependency-ordering","message":"The guard is fetched at runtime from petry-projects/.github@main, but test(dev-lead): guard the #443 concurrency fix (cancel-in-progress: false) #1221, which adds plg_effective_org_cap, is still open. Until it merges, the mapped PR_LIMITS_ORG_CAP is ignored. The change is harmless, but issue Wire PR_LIMITS_ORG_CAP org variable into the PR-limit admission gate #2018's acceptance criterion is not yet met and the PR body describes the upstream behavior as already live.","file":".github/workflows/dev-lead-reusable.yml","line":554,"sources":["deep"]}
  • minor: {"severity":"minor","category":"test-hygiene","message":"Unresolved cubic thread: _install_cap_recording_guard creates CAP_SEEN_FILE with mktemp, but only the passing path removes it. teardown() does not, so a failed assertion leaks the temp file. Add rm -f "${CAP_SEEN_FILE:-}" to teardown.","file":"tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats","line":236,"sources":["deep"]}
  • minor: {"severity":"minor","category":"test-robustness","message":"The mktemp file is removed only on the success path. The recording guard writes to CAP_SEEN_FILE only if the gate is reached, so a missing file gives a confusing cat error instead of a clear failure. Move cleanup to teardown().","file":"tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats","line":236,"sources":["rubber-duck"]}
  • minor: {"severity":"minor","category":"ci","message":"The 'bats' check, the only one that runs the new tests, and other checks have no conclusion on the head SHA. Some dev-lead jobs were cancelled. Required CI cannot be confirmed green.","file":null,"line":null,"sources":["rubber-duck"]}
  • minor: {"severity":"minor","category":"review-threads","message":"One review thread on test_fix_issue_pr_limit_gate.bats is unresolved and not outdated.","file":"tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats","line":null,"sources":["rubber-duck"]}
  • info: {"severity":"info","category":"ci-status","message":"The 'bats' and 'unit' checks are still queued or in progress at the head SHA. bats is not installed in the review sandbox, so the four new tests could not be run. The yq wiring-regression logic was replayed against the PR head and found 2 matching steps and none non-compliant.","file":"tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats","line":286,"sources":["deep"]}
  • info: {"severity":"info","category":"test-coverage","message":"The yq regression test only covers .github/workflows/*.yml and matches steps by run-string substring, so a wrapper or composite action would be missed. It compares env.PR_LIMITS_ORG_CAP to a literal expression string, so a differently spaced but equivalent expression would be flagged as a false failure.","file":"tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats","line":295,"sources":["rubber-duck"]}
  • info: {"severity":"info","category":"integration","message":"A non-numeric, zero or negative org variable value passes into the gate with no validation in this repo. Behavior depends on plg_effective_org_cap upstream, so confirm it validates the value and fails open or closed as intended. The reusable workflow is pinned by 8 downstream consumers.","file":".github/workflows/dev-lead-reusable.yml","line":554,"sources":["rubber-duck"]}
  • info: {"severity":"info","category":"advisory-bot-followup","message":"Earlier bot findings are addressed. The Gemini unnamed-step issue is fixed, and the cubic empty-vs-unset concern is covered by a new test. Both threads are resolved.","file":".github/workflows/gh-aw-cross-org.yml","line":162,"sources":["deep"]}

Reviewed by the PR-review cascade (triage: haiku 4.5 [sonnet 5.5, sonnet 5] → deep: opus 5.5 [opus 4.8, sonnet 5.5] + duck: gemini-3.8-flash [sonnet 5.5] → audit: opus 5.5 [opus 4.8, opus 4.7]). Reply if you need a human review.

Additional tasks

  1. Resolve all unresolved review thread comments from other reviewers
  2. Ensure all CI checks pass after your changes
  3. Rebase on the target branch if behind
  4. Do NOT modify files unrelated to the findings above

The review cascade will automatically re-review after new commits are pushed.

@donpetry-bot

donpetry-bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor
Superseded by automated re-review at 2f399298d1000009b5b15be335a2f8f423eb5ead — click to expand prior review.

Review — fix requested (cycle 3/3)

The automated review identified the following issues. Please address each one:

Findings to fix

Automated review — NEEDS HUMAN REVIEW

Risk: MEDIUM
Reviewed commit: 39aaa6f0f0fc5d10f5b82016d4ce68d90ebec7c0
Cascade: triage → deep+duck (triage: haiku 4.5 [sonnet 5.5, sonnet 5] → deep: opus 5.5 [opus 4.8, sonnet 5.5] + duck: gemini-3.8-flash [sonnet 5.5] → audit: opus 5.5 [opus 4.8, opus 4.7])

Summary

Both reviewers rate the risk MEDIUM, but they split on the decision: the deep reviewer escalates because a cubic review thread is still unresolved, and the rubber duck approves. Both engines converged on the test-hygiene finding that CAP_SEEN_FILE leaks when an assertion fails before the inline rm, so it is raised to major. Both also flagged that the guard must treat an empty PR_LIMITS_ORG_CAP as unset. The rubber duck alone noted that the yq check would miss a script invoked indirectly, for example through a composite action. The deep reviewer alone noted that upstream .github#1221 is still open, so the variable has no effect yet.

Cross-engine agreement

partial

Downstream impact

This change is consumed by 8 downstream repo(s) that pin the affected reusable workflow / lib / prompt. Impacted consumers:

Impacted shared surfaces:
  - .github/workflows/dev-lead-reusable.yml

Impacted consumers (8, fetching up to 10):
  - petry-projects/.github (pins .github/workflows/dev-lead-reusable.yml)
      .github/workflows/dev-lead.yml
  - petry-projects/.github-private (pins .github/workflows/dev-lead-reusable.yml)
      .github/workflows/dev-lead.yml
  - petry-projects/ContentTwin (pins .github/workflows/dev-lead-reusable.yml)
      .github/workflows/dev-lead.yml
  - petry-projects/TalkTerm (pins .github/workflows/dev-lead-reusable.yml)
      .github/workflows/dev-lead.yml
  - petry-projects/bmad-bgreat-suite (pins .github/workflows/dev-lead-reusable.yml)
      .github/workflows/dev-lead.yml
  - petry-projects/broodly (pins .github/workflows/dev-lead-reusable.yml)
      .github/workflows/dev-lead.yml
  - petry-projects/google-app-scripts (pins .github/workflows/dev-lead-reusable.yml)
      .github/workflows/dev-lead.yml
  - petry-projects/markets (pins .github/workflows/dev-lead-reusable.yml)
      .github/workflows/dev-lead.yml

Findings

  • major: {"severity":"major","category":"test-hygiene","message":"CAP_SEEN_FILE, created by mktemp in _install_cap_recording_guard, is removed only inline at the end of the test body. If an assertion fails first, the file leaks. Add rm -f "${CAP_SEEN_FILE:-}" to teardown() (or use BATS_TEST_TMPDIR), or resolve the cubic thread with a reason.","file":"tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats","line":236,"sources":["deep","rubber-duck"]}
  • info: {"severity":"info","category":"dependency","message":"Upstream feat(pr-limits): org variable PR_LIMITS_ORG_CAP to change the cap without code changes .github#1221 (plg_effective_org_cap) is still open and the guard on .github@main does not reference PR_LIMITS_ORG_CAP yet, so the new env var has no effect until it merges. The guard is fetched from main, so it will pick up the change automatically.","file":"scripts/dev-lead-fix-issue.sh","line":52,"sources":["deep"]}
  • info: {"severity":"info","category":"contract","message":"An undefined org variable renders as an empty string. The upstream resolver in test(dev-lead): guard the #443 concurrency fix (cancel-in-progress: false) #1221 must treat set-but-empty as unset (${PR_LIMITS_ORG_CAP:-} semantics), or every run with no override will log a warning.","file":".github/workflows/gh-aw-cross-org.yml","line":162,"sources":["deep"]}
  • info: {"severity":"info","category":"downstream-behavior","message":"The set-but-empty value now reaches plg_effective_org_cap in the shared guard. Confirm the guard treats an empty string as unset, because the production path always passes it set-but-empty.","file":".github/workflows/dev-lead-reusable.yml","line":554,"sources":["rubber-duck"]}
  • info: {"severity":"info","category":"test-coverage","message":"The earlier concern about unnamed steps is addressed: the yq check uses (.name // "unnamed step") and asserts found >= 2. Verified at head, including a negative case where removing the mapping is flagged.","file":"tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats","line":286,"sources":["deep"]}
  • info: {"severity":"info","category":"test-robustness","message":"The yq check selects steps by a regex on the run text. A script invoked indirectly, for example through a composite action, would not be detected.","file":"tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats","line":286,"sources":["rubber-duck"]}

Reviewed by the PR-review cascade (triage: haiku 4.5 [sonnet 5.5, sonnet 5] → deep: opus 5.5 [opus 4.8, sonnet 5.5] + duck: gemini-3.8-flash [sonnet 5.5] → audit: opus 5.5 [opus 4.8, opus 4.7]). Reply if you need a human review.

Additional tasks

  1. Resolve all unresolved review thread comments from other reviewers
  2. Ensure all CI checks pass after your changes
  3. Rebase on the target branch if behind
  4. Do NOT modify files unrelated to the findings above

The review cascade will automatically re-review after new commits are pushed.

@donpetry-bot donpetry-bot added the needs-human-review Flagged by automated PR review agent label Oct 2, 2026
@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-10-02T15:06:29Z.

@don-petry

don-petry commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator Author
Resolved — the `needs-human-review` hold was lifted; dev-lead has picked this item up. Click to expand the prior hold notice.

dev-lead is withholding action on this item.

It is labeled needs-human-review (flagged for human review — this label is applied by automation as well as by people, so an item can become held without anyone noticing), so dev-lead will not pick it up while that label is present. This notice is posted once so the withhold is visible rather than looking like a stalled run.

To re-enable automated pickup: remove the needs-human-review label.

@don-petry don-petry removed the needs-human-review Flagged by automated PR review agent label Oct 2, 2026
@don-petry
don-petry disabled auto-merge October 2, 2026 17:32
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-reviews (not-applied)

A commit was pushed, but it did not touch any region the review named — the requested changes were not applied. Per requested item:

  • tests/dev-lead/unit/test_fix_issue_pr_limit_gate.bats:236 — not applied

@don-petry
don-petry enabled auto-merge (squash) October 2, 2026 17:33
@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-10-02T18:40:51Z.

donpetry-bot
donpetry-bot previously approved these changes Oct 2, 2026

@donpetry-bot donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated review — APPROVED ✓

Risk: MEDIUM
Reviewed commit: 2f399298d1000009b5b15be335a2f8f423eb5ead
Review mode: triage-approved (single reviewer)

Summary

Adds PR_LIMITS_ORG_CAP: ${{ vars.PR_LIMITS_ORG_CAP }} to the env of both workflow steps that run dev-lead-fix-issue.sh, which calls plg_admission_gate. The steps are in dev-lead-reusable.yml and gh-aw-cross-org.yml. The PR also adds bats coverage for three cases: a set value, an unset value and an empty value. A yq check confirms that every step running the script maps the variable. The variable comes from vars, not secrets, and no run: logic changed. Risk is MEDIUM because the change is to a reusable workflow that 8 downstream repos consume. The one blocking finding from the prior cycle-3 review, the leaked CAP_SEEN_FILE, is fixed at 2f39929.

Linked issue analysis

Closes #2018. Its acceptance criteria are met:

  • Every step that invokes the gate passes vars.PR_LIMITS_ORG_CAP. The only gate caller is scripts/dev-lead-fix-issue.sh, which runs in two workflow steps, and both are covered. initiative-driver.yml does not run the gate.
  • When the variable is unset or empty, the script adds no cap of its own, so behavior is unchanged. Tests cover both cases.
  • No cap value is hardcoded, and pr-limits.json is unchanged.
  • A test covers the env mapping. The yq regression check fails in CI if yq is missing, rather than skipping.
  • The guard is fetched at runtime from petry-projects/.github@main, so nothing vendored needs syncing. It will use plg_effective_org_cap automatically once upstream .github#1221 merges.

Findings

Incremental check against prior review (39aaa6f → 2f39929):

  • ✅ Resolved (major, test-hygiene): CAP_SEEN_FILE leaked when an assertion failed. teardown() now runs [ -z "${CAP_SEEN_FILE:-}" ] || rm -f "$CAP_SEEN_FILE". The cubic thread is resolved.
  • ℹ️ Carried forward (info, non-blocking): Upstream petry-projects/.github#1221 (plg_effective_org_cap) is still OPEN. Until it merges, the new env var has no effect, which is harmless because the gate ignores it. When it lands, the resolver must treat set-but-empty as unset, because ${{ vars.X }} renders "" when the variable is undefined. #2018 states that "an unset or empty variable falls back silently", so the upstream contract already covers this.
  • ℹ️ Info: The yq check matches steps by a regex on the run: text, so an indirect invocation through a composite action would not be detected. This is acceptable for now because both current callers invoke the script directly.

New issues: None. The other changes since the prior review come from merging main (#2021) and are not part of this PR's diff.

All 5 review threads (cubic ×3, gemini ×2) are resolved. No human reviewer has asked a question.

CI status

All checks are green at 2f39929, including bats, unit (Test Dev-Lead Agent), shellcheck, actionlint, CodeQL, SonarCloud (Quality Gate passed), gitleaks, AgentShield and Agent Security Scan. Some checks were skipped, which is expected: dependency-audit sub-jobs for ecosystems this repo doesn't use, and the dev-lead ci-relay/resume jobs.


Reviewed automatically by the PR-review agent (single-reviewer mode: opus 5.5 [opus 4.8, opus 4.7]). Reply if you need a human review.

@donpetry-bot
donpetry-bot dismissed their stale review October 2, 2026 17:46

Dismissing approval due to a PR issue comment lacking a verified disposition (#1813)

@donpetry-bot

Copy link
Copy Markdown
Contributor

CI checks on this PR are still running. The PR-review sweep re-reviews this PR automatically once the checks complete — no action is needed.

Posted by the donpetry-bot PR-review cascade.

@sonarqubecloud

sonarqubecloud Bot commented Oct 2, 2026

Copy link
Copy Markdown

@donpetry-bot donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated review — APPROVED ✓

Risk: MEDIUM
Reviewed commit: 2476110364de882aac91101cc419bd5bff785349
Review mode: triage-approved (single reviewer)

Summary

Maps PR_LIMITS_ORG_CAP: ${{ vars.PR_LIMITS_ORG_CAP }} into the env of both workflow steps that run scripts/dev-lead-fix-issue.sh (the only caller of plg_admission_gate): dev-lead-reusable.yml and gh-aw-cross-org.yml. Adds bats coverage for the set, unset, and set-but-empty cases, plus a yq check that every workflow step running the script maps the variable. The only change since the prior approved review (2f39929) is a merge from main (#1888). That merge touches no file in this PR's diff.

Linked issue analysis

Closes #2018, and the issue is substantively addressed.

  • Every gate-invoking step is wired. git grep at the head SHA shows plg_admission_gate is called only from scripts/dev-lead-fix-issue.sh. That script is run only by the two workflow steps this PR updates. The yq test enforces this and requires at least 2 matching steps, so a new unmapped caller would fail the test.
  • No hardcoded cap. The cap comes only from the org variable, with pr-limits.json as the fallback.
  • Unset or empty leaves behavior unchanged. The script passes the value through untouched, and the tests cover both unset and "".
  • Library version. The guard is fetched at runtime from petry-projects/.github@main (PLG_SOURCE_REF defaults to main), not vendored, so nothing needs syncing here.
  • Heads-up. Upstream petry-projects/.github#1221 is still open. The main copy of scripts/lib/pr-limit-gate.sh does not yet read PR_LIMITS_ORG_CAP, so setting the org variable has no effect until #1221 merges. After that, it takes effect automatically with no further change in this repo. This wiring is forward-compatible and safe now: the variable is ignored, and admission is unchanged.

Findings

No blocking findings.

  • Security. vars.* is passed only through step env: and is never interpolated into a run: script, so there is no expression-injection surface. No secrets are added or changed.
  • Correctness. The yq selector handles unnamed steps and steps without run. In CI the regression test fails instead of being skipped when yq is missing. teardown cleans up CAP_SEEN_FILE.
  • Prior bot threads. All 5 review threads (cubic and gemini) are resolved.
  • Informational, non-blocking. The org-cap override stays inert until petry-projects/.github#1221 merges (see the issue analysis above).

CI status

All required checks passed: Lint, shellcheck/ShellCheck, bats, unit-tests, actionlint, CodeQL (actions and python), SonarCloud Quality Gate, gitleaks, AgentShield, and the stub and standards guards. Skipped jobs (dependency-audit ecosystems, dependabot, ci-relay, resume) are not applicable to this PR.


Reviewed automatically by the PR-review agent (single-reviewer mode: opus 5.5 [opus 4.8, opus 4.7]). Reply if you need a human review.

@donpetry-bot

Copy link
Copy Markdown
Contributor

pr-review approved on PARTIAL advisory evidence: 3/5 required advisory bots reported before the gate's head-age-timeout fallback proceeded. Recorded for the miss-rate metric (#1596).

@don-petry
don-petry merged commit 5fda8f6 into main Oct 2, 2026
69 of 72 checks passed
@don-petry
don-petry deleted the dev-lead/issue-2018-20261002-1303 branch October 2, 2026 18:31

@donpetry-bot donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated review — APPROVED ✓

Risk: MEDIUM
Reviewed commit: 2476110364de882aac91101cc419bd5bff785349
Review mode: triage-approved (single reviewer)

Summary

Adds PR_LIMITS_ORG_CAP: ${{ vars.PR_LIMITS_ORG_CAP }} to the step env of the two workflow steps that run scripts/dev-lead-fix-issue.sh, the only caller of plg_admission_gate. The steps are in dev-lead-reusable.yml and gh-aw-cross-org.yml. The PR also adds bats tests for the set, unset, and set-but-empty cases, plus a yq check that every workflow step running the script maps the variable. This head SHA (2476110) was already approved in the prior cycle. This pass confirms that the diff, CI, and review threads have not changed. Risk is MEDIUM because the change is to a reusable workflow that downstream repos consume.

Linked issue analysis

Closes #2018, and the issue is substantively addressed.

  • Every gate-invoking step is wired. Both workflow steps that run dev-lead-fix-issue.sh map the variable. The yq test enforces this and requires at least 2 matching steps.
  • No hardcoded cap, and pr-limits.json is unchanged.
  • Unset or empty leaves behavior unchanged. The value is passed through untouched, and tests cover both unset and "".
  • The guard is fetched at runtime from petry-projects/.github@main, so nothing vendored needs syncing.
  • Info: #2018 already shows as CLOSED even though this PR is unmerged. It does not block this PR, but the issue may need reopening if this PR does not land.

Findings

No blocking findings.

  • Security. vars.PR_LIMITS_ORG_CAP is used only in step env: and is never interpolated into a run: script, so there is no expression-injection surface. No secrets are added or changed.
  • Correctness and tests. The yq selector handles unnamed steps and steps without run. In CI the regression check fails instead of being skipped when yq is missing. teardown cleans up CAP_SEEN_FILE, which resolves the leak raised in an earlier cycle.
  • Threads. All 5 review threads (cubic ×3, gemini ×2) are resolved. No human reviewer has asked a question.
  • Info, non-blocking. The override stays inert until upstream petry-projects/.github#1221 merges, and that is forward-compatible. The yq check would not detect an indirect invocation, for example through a composite action. That is acceptable because both current callers invoke the script directly.

CI status

All completed checks pass: Lint, ShellCheck/shellcheck, bats, unit, unit-tests, actionlint, CodeQL (actions and python), SonarCloud Quality Gate, gitleaks, AgentShield, and the stub, standards, and persona guards. Skipped or cancelled jobs (dependency-audit ecosystems, dependabot, superseded dev-lead dispatch/ci-relay/resume runs) do not apply to this PR. The only queued entries are the PR-review jobs for this run.


Reviewed automatically by the PR-review agent (single-reviewer mode: opus 5.5 [opus 4.8, opus 4.7]). Reply if you need a human review.

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.

Wire PR_LIMITS_ORG_CAP org variable into the PR-limit admission gate

2 participants