Skip to content

fix(pr-review): honour DRY_RUN in the advisory-gate marker posts - #2096

Merged
don-petry merged 5 commits into
mainfrom
claude/funny-saha-89ddf6
Oct 9, 2026
Merged

don-petry merged 5 commits into
mainfrom
claude/funny-saha-89ddf6

Conversation

@don-petry

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

Copy link
Copy Markdown
Collaborator

Summary

DRY_RUN=true pr-review runs no longer write to GitHub from the advisory-gate marker helpers. maybe_post_rate_limited_marker and maybe_post_partial_evidence_marker now skip their gh pr comment call under DRY_RUN=true and log what they would have posted.

Problem

scripts/review-one-pr.sh calls maybe_post_rate_limited_marker when advisory bots are still reviewing and one of them is rate-limited. That helper ran gh pr comment without checking DRY_RUN, so a DRY_RUN=true pr-review run still posted a <!-- pr-review-agent rate-limited v1 sha=… --> comment on the PR.

Found while reviewing PR #1902 (feat(pr-review): "why isn't this PR approved?" diagnostic built on the real gate chain). That PR protects only its own diagnose mode (PR_REVIEW_DIAGNOSE=true); ordinary DRY_RUN=true runs stayed exposed. No separate issue was filed.

What changed:

  • maybe_post_rate_limited_marker (scripts/lib/advisory-review-gate.sh) skips the post when DRY_RUN=true and logs DRY_RUN: would post rate-limited marker on ….
  • maybe_post_partial_evidence_marker (scripts/lib/partial-evidence-marker.sh) had the same gap and gets the same guard. review-one-pr.sh was not exposed through it — it defers that post to post-pr-review.sh, which exits early on a dry run — but the gate's non-deferred path (no PARTIAL_EVIDENCE_STATE_FILE) was.
  • In both helpers the guard sits after the dedup check, so the "would post" line appears only when a real run would have written.

Those two gh pr comment calls are the only GitHub writes in the two files; every other gh call there is a read.

Risk

Low. The change adds an early return that is taken only when DRY_RUN=true; runs with DRY_RUN unset or false execute the same code as before. No workflow, prompt or gate decision changes.

Test plan

  • Added to tests/dev-lead/unit/test_advisory_review_gate.bats: runs the same detect-then-post sequence as review-one-pr.sh with a recording gh stub and DRY_RUN=true; asserts no gh call at all and that the would-post line is logged.
  • Added to tests/dev-lead/unit/test_partial_evidence_marker.bats: the same assertion for the non-deferred partial-evidence path.
  • Both new tests fail with the guards removed and pass with them.
  • shellcheck --severity=warning -x scripts/*.sh scripts/lib/*.sh (the CI invocation): clean.
  • The two unit suites above, run locally on macOS: 103 of 105 pass. The two failures also fail on main without this change and look macOS-specific (one is a sed -i call BSD sed rejects): "quiescence fallback fires when head time unavailable and submissions are old" and "a failed check-run fetch degrades to reviews/comments only, never an API error (issue Advisory gate cannot count Graphite's check-run clean pass: every clean PR waits out the 20-minute timeout #2005)".
  • tests/test_advisory_offline_mode.bats, test_qa_lead_advisory_gate.bats, test_delayed_rate_limit_retry.bats, test_reviewer_sources.bats, test_review_one_pr_nonrequired_gate.bats, test_pr_review_miss_rate.bats: 96 of 96 pass.

Rollback

Revert this PR. No non-revertible side effects: nothing is migrated, and no marker format changes.

Monitoring

A DRY_RUN=true pr-review run on a PR with a rate-limited advisory bot should log [advisory-gate] DRY_RUN: would post rate-limited marker on … and leave no new pr-review-agent rate-limited v1 comment on the PR. Regression signal: such a comment appearing after a dry run. Real runs are unaffected, so the sweep's rate-limited retry keeps working as before.

Interaction contract

  • N/A — this PR does not add or change an agentic role.

Checklist

  • shellcheck scripts/*.sh passes for any changed shell scripts.
  • Docs updated where behavior or standards changed. (The header comments of both helpers now state the DRY_RUN behavior; no other doc describes these helpers' write behavior.)

🤖 Generated with Claude Code

donpetry-bot and others added 2 commits October 9, 2026 08:58
maybe_post_rate_limited_marker ran `gh pr comment` without checking
DRY_RUN, so a DRY_RUN=true pr-review run still stamped a
`<!-- pr-review-agent rate-limited v1 sha=… -->` comment on the PR when
an advisory bot was rate-limited. maybe_post_partial_evidence_marker had
the same gap on the gate's non-deferred path.

Both helpers now skip the post under DRY_RUN=true and log what they
would have posted. The dedup check still runs first, so the log line
only appears when a real run would have written.

Tests drive the rate-limited detect-then-post sequence and the
non-deferred partial-evidence path with a recording gh stub and assert
no gh call is made.

Found while reviewing PR #1902, whose diagnose mode guards only itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@don-petry
don-petry requested a review from a team as a code owner October 9, 2026 13:59
@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 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 8c184424-d17e-4df4-98c7-e13371fe3f2a

📥 Commits

Reviewing files that changed from the base of the PR and between 6faef04 and c8cf957.


📒 Files selected for processing (4)
  • scripts/lib/advisory-review-gate.sh
  • scripts/lib/partial-evidence-marker.sh
  • tests/dev-lead/unit/test_advisory_review_gate.bats
  • tests/dev-lead/unit/test_partial_evidence_marker.bats

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



📝 Summary

Summary by CodeRabbit

  • New Features
    • Dry-run mode now reports when advisory rate-limit or partial-evidence markers would be posted, without publishing GitHub comments.
  • Bug Fixes
    • Marker checks still complete successfully in dry-run mode when a marker is not already present.

Walkthrough

Both marker helpers now log the intended post and return without a GitHub write when DRY_RUN=true. Unit tests cover the rate-limited and partial-evidence paths.

Changes

Marker dry-run behavior

Layer / File(s) Summary
Dry-run marker handling and tests
scripts/lib/advisory-review-gate.sh, scripts/lib/partial-evidence-marker.sh, tests/dev-lead/unit/test_advisory_review_gate.bats, tests/dev-lead/unit/test_partial_evidence_marker.bats
Both helpers skip GitHub writes and log the intended marker when DRY_RUN=true. Tests check successful returns, no GitHub calls, and the dry-run log output.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix


Merge Risk: ⚪ Minimal · up to c8cf9

No actionable issue is identified with the dry-run marker changes; they are mergeable after normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 4 files.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely identifies the main change: honoring DRY_RUN for advisory-gate marker posts.
Description check Passed The description includes all required sections: Summary, Problem, Risk, Test plan, Rollback, Monitoring, Interaction contract, and Checklist. It explains the behavior change, testing, known baseline f…


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@don-petry don-petry added the dev-lead:hands-off Exclude from dev-lead agent automation label Oct 9, 2026
@codeant-ai

codeant-ai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

CodeAnt PR Risk: Low Risk

  • The PR appears safe to merge; both marker helpers log the intended post and return before making GitHub writes when DRY_RUN=true.
  • Tests cover both the rate-limited and partial-evidence paths and assert that no GitHub command is called.

Assessed commit: c8cf95759ada

@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 a DRY_RUN mode to the advisory review gate and partial evidence marker scripts, allowing them to log would-be GitHub posts instead of executing writes. Unit tests have been added to verify this behavior. The review feedback suggests improving the robustness of these tests by adding error handling to the mktemp -d commands used for creating temporary directories.

Comment thread tests/dev-lead/unit/test_advisory_review_gate.bats
Comment thread tests/dev-lead/unit/test_partial_evidence_marker.bats

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

No issues found across 4 files

View guided diff | Turn on auto-fix | Re-trigger cubic

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — waiting on PR blockers (intent: review-changes)

PR: #2096
No changes were committed, but the PR still can't be marked done: required checks CodeQL, dependency-audit / Detect ecosystems are still pending. The retry cron will re-attempt automatically. Next attempt after: 2026-10-09T14:41:17Z

@don-petry

Copy link
Copy Markdown
Collaborator Author

Note

@don-petry I reviewed this PR and no code changes were needed, but I can't mark it done yet: required checks CodeQL, dependency-audit / Detect ecosystems are still pending. I'll re-check automatically.
Next attempt after: 2026-10-09T14:41:17Z

@don-petry
don-petry enabled auto-merge (squash) October 9, 2026 14:11
@don-petry

don-petry commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator Author
Resolved — the `dev-lead:hands-off` 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 dev-lead:hands-off (deliberately kept off-limits to dev-lead (e.g. changes to the dev-lead automation itself)), 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 dev-lead:hands-off label.

@donpetry-bot

Copy link
Copy Markdown
Contributor

No description provided.

@donpetry-bot

Copy link
Copy Markdown
Contributor

No description provided.

@don-petry don-petry removed the dev-lead:hands-off Exclude from dev-lead agent automation label Oct 9, 2026
@don-petry
don-petry disabled auto-merge October 9, 2026 14:50
@don-petry
don-petry enabled auto-merge (squash) October 9, 2026 14:51
@don-petry
don-petry disabled auto-merge October 9, 2026 14:52
@don-petry

Copy link
Copy Markdown
Collaborator Author

This is a CodeRabbit OSS review-limit notice indicating the free review quota is temporarily exhausted. The notice reports no code findings—there are no actionable issues to address in the diff. All other reviewers (cubic, gemini) found no issues, and all CI checks pass.

@don-petry
don-petry enabled auto-merge (squash) October 9, 2026 14:53
@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 2026

Copy link
Copy Markdown

@don-petry

Copy link
Copy Markdown
Collaborator Author

No description provided.

@don-petry

Copy link
Copy Markdown
Collaborator Author

No description provided.

@don-petry
don-petry disabled auto-merge October 9, 2026 15:51
@don-petry

Copy link
Copy Markdown
Collaborator Author

Acknowledged: Codex review usage-limit notice. No code finding; nothing to change.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Acknowledged: Qodo trial-ended/billing notice. No code finding; nothing to change.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Acknowledged: CodeAnt reports Low Risk with no findings (DRY_RUN helpers return before GitHub writes; tests cover both paths). Nothing to change.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Acknowledged: SonarCloud Quality Gate passed. No findings; nothing to change.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-reviews (no-changes)

Agent reasoning
  - CodeRabbit approved.
  - Gemini's `COMMENTED` review suggested error handling on the `mktemp -d` calls in the tests. That is neutral, with no open thread, so I didn't act on it.
- **Issue comments:** I posted an `informational` disposition on four bot comments that had none. None of them contained a finding.
  - Codex usage-limit notice
  - Qodo trial-ended notice
  - CodeAnt Low Risk summary
  - SonarCloud Quality Gate passed
  The CodeRabbit comment already had a disposition, so I left it alone.
- **Tests:** I didn't run the suite, since no code changed.
Files changed: none.

@don-petry
don-petry enabled auto-merge (squash) October 9, 2026 15:52
@don-petry

This comment has been minimized.

@donpetry-bot

Copy link
Copy Markdown
Contributor

@don-petry I'm on it — starting a fresh review now. Results will appear in a few minutes.

donpetry-bot
donpetry-bot previously approved these changes Oct 9, 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: LOW
Reviewed commit: c8cf95759adacd75a7effc94f3511918e711983a
Review mode: triage-approved (single reviewer)

Summary

Adds a DRY_RUN=true early return to maybe_post_rate_limited_marker (scripts/lib/advisory-review-gate.sh) and maybe_post_partial_evidence_marker (scripts/lib/partial-evidence-marker.sh). Under a dry run they now log the comment they would post instead of calling gh pr comment. The guard sits after the dedup check, so the would-post line is logged only when a real run would actually write. Runs with DRY_RUN unset or false behave exactly as before. Two bats tests cover the change with a recording gh stub. Each test asserts that gh was never called and that the would-post line was logged.

Linked issue analysis

No linked issue. The PR says the gap was found while reviewing #1902 and that no separate issue was filed. The description explains the problem, the fix, the risk, rollback and monitoring, so it stands on its own. The fix closes the gap it describes: these two gh pr comment calls were the only writes in the two helpers, and both now respect DRY_RUN.

Findings

No blocking findings.

  • Correctness: The check "${DRY_RUN:-false}" == "true" matches the convention review-one-pr.sh already uses (e.g. lines 337, 932). Both helpers return 0 on the dry-run path, as they do on the dedup-skip path, so callers see no new error. log_info is defined in advisory-review-gate.sh, and partial-evidence-marker.sh is sourced from it, so the call works in both helpers.
  • Behaviour impact: In a dry run no rate-limited marker is posted, so the sweep's rate-limited retry will not fire for that PR. That is the intended dry-run behaviour. Live runs are unaffected.
  • Tests: The rate-limited test runs the same detect-then-post sequence as review-one-pr.sh. The partial-evidence test covers the non-deferred path (PARTIAL_EVIDENCE_STATE_FILE empty). Both check that the call log is empty, not just that it lacks pr comment.
  • Review threads: gemini-code-assist left two low-priority suggestions to add error handling to mktemp -d in the tests. The author answered both (bats runs tests under errexit, and the form matches neighbouring tests), and both threads are resolved. I agree; nothing to change.
  • Secret scan: The MCP run_secret_scanning tool is not available in this run. gitleaks CI passed.
  • Triage check: I agree with triage. This is a small, defensive guard plus tests, with no secrets, auth, workflow or gate-decision changes.

CI status

All required checks pass: shellcheck, ShellCheck, bats, unit, unit-tests, CodeQL, Analyze (actions/python), SonarCloud (Quality Gate passed), gitleaks, actionlint, AgentShield, Agent Security Scan and the repo's validation checks. Skipped or cancelled entries are dependency-audit ecosystems that don't apply here and superseded dev-lead dispatch/relay/resume runs. CodeRabbit approved, and cubic and CodeAnt reported no issues.


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/4 required advisory bots reported before the gate's head-age-timeout fallback proceeded. Recorded for the miss-rate metric (#1596).

@donpetry-bot
donpetry-bot dismissed their stale review October 9, 2026 16:08

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

@donpetry-bot

Copy link
Copy Markdown
Contributor

No description provided.

@don-petry
don-petry disabled auto-merge October 9, 2026 16:09
@don-petry
don-petry merged commit f6f2e38 into main Oct 9, 2026
79 of 82 checks passed
@don-petry
don-petry deleted the claude/funny-saha-89ddf6 branch October 9, 2026 16:10
@don-petry

Copy link
Copy Markdown
Collaborator Author

Acknowledged: CodeRabbit review complete with no actionable findings. All pre-merge checks passed, merge risk is minimal, and all required CI checks pass. The DRY_RUN marker helpers are working as intended.

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.

2 participants