Repository navigation
feat: implement issue #1786 — [#1620 slice 1] dev-lead refuses to open/update/claim a PR with an empty net diff - #1801
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
🤖 CodeAnt AI — Review Status
|
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
Warning Review limit reachedNext included review available in 50 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces an empty net-diff guard to prevent opening pull requests, claiming completion, or pushing updates when the net difference against the base branch is empty. The guard is integrated into the issue-fixing and review-fixing scripts and is thoroughly covered by new unit tests. The review feedback is highly constructive, highlighting opportunities to prevent script termination under 'set -e' and 'set -u', optimize shell pipelines into a single 'awk' call, use 'FETCH_HEAD' for robust commit resolution, and assert specific non-zero exit codes in BATS tests.
Dev-Lead — rate-limited (intent: review-changes)PR: #1801 |
|
Note @don-petry I received your request but all AI engines are currently rate-limited. I'll retry automatically once the rate limit clears. |
|
pr-review approved on PARTIAL advisory evidence: 4/6 required advisory bots reported before the gate's head-age-timeout fallback proceeded. Recorded for the miss-rate metric (#1596). |
|
Automated review paused — review engines are unavailable. Every configured review engine (Claude → Copilot → Gemini) reported a usage/rate limit or was otherwise unavailable, so no review could be generated for this run. This is a single, deduplicated notice: the agent will re-review automatically on its next scheduled run once capacity recovers, and will not post repeat notices in the meantime. |
|
Auto-rebase failed — merge conflict — this branch has conflicts with dev-lead will attempt to resolve this automatically. If it cannot, a follow-up comment will explain what needs manual attention. To resolve manually instead: |
…n/update/claim a PR with an empty net diff
34a42ae to
9962767
Compare
Dev-Lead — rebase (applied)Rebase completed and pushed. |
|
pr-review approved on PARTIAL advisory evidence: 4/6 required advisory bots reported before the gate's head-age-timeout fallback proceeded. Recorded for the miss-rate metric (#1596). |
Dev-Lead — fix-bot-comment (applied)Changes committed and pushed. |
Superseded by automated re-review at
|
Superseded by automated re-review at
|
Dismissing approval due to a PR issue comment lacking a verified disposition (#1813)
Automated activity budget exhausted — human attention neededThis PR has reached 10 automated actions (agent commits + review cycles + acks) since the last human interaction, without converging. To prevent a runaway loop (see #926 / the #860 post-mortem), all automated commits, reviews, and acknowledgements on this PR are now paused, auto-merge is disabled, and Re-engaging is human-gated. A human reviewing, commenting, or pushing to this PR resets the budget; a machine action will not. Removing |
|
Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-09-21T01:00:04Z. |
|
pr-review approved on PARTIAL advisory evidence: 4/6 required advisory bots reported before the gate's quiescence-timeout fallback proceeded. Recorded for the miss-rate metric (#1596). |
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: MEDIUM
Reviewed commit: 6b6f2dfd9425c2986cd49113e817f98d097c5233
Cascade: triage → deep (triage: haiku 4.5 [sonnet 5] → deep: opus 4.8 [sonnet 5] + duck: o4-mini → audit: fable 5)
Summary
Adds a fail-open net-diff guard so dev-lead never opens/claims/pushes a self-cancelling (net-zero) PR; guard extended from fix-reviews to review-changes and rebase intents, with unit + integration coverage. The two advisory 'Major' findings (net-diff-guard.sh stale-reference; lint.yml missing test file) were posted against the first commit 7fa887f and are refuted at head 6b6f2df — the resolver now fetches origin/base unconditionally and reads FETCH_HEAD, and the new bats file exists at the referenced path with CI bats/unit/Lint green. I re-verified the three guard states (empty, non-empty, unresolvable fail-open) on a real repo and shellchecked the new lib clean. No downstream consumers impacted (DOWNSTREAM_IMPACT=none); no safety hard-stops.
Findings
- major: Advisory (codeant-ai) claimed the base resolver never fetches when origin/ already exists, comparing against a stale base. REFUTED at head 6b6f2df: _ndg_resolve_base_sha now runs 'git fetch --quiet origin ' unconditionally and resolves via FETCH_HEAD^{commit}, falling back to the tracking ref only if FETCH_HEAD is absent. Verified functionally: added+reverted branch -> net_diff_is_empty rc=0, real change -> rc=1, unresolvable base -> rc=1 (fail-open).
- major: Advisory (codeant-ai) claimed lint.yml lists a nonexistent test file so the net-diff tests never run. REFUTED: tests/dev-lead/unit/test_net_diff_guard.bats is created in this PR at exactly the path added to the bats list, and CI's bats/unit/Lint checks pass at the current head SHA. Coverage is real (7 unit cases + fix-issue/fix-reviews integration cases).
- info: Advisory (gemini) medium suggestions to use FETCH_HEAD (line 51) and avoid a standalone '[ ... -eq 0 ]' under set -e (line 83) are addressed at head: the resolver uses FETCH_HEAD, and net_diff_is_empty's terminal '[ -z "$changed" ]' is the function's return value consumed via 'if net_diff_is_empty', not a set -e abort point. shellcheck -x on the new lib reports no findings.
- info: Advisory (gemini) low nit: a couple of bats assertions use a generic non-zero check ('[ "$status" -ne 0 ]') rather than an exact exit code. Non-blocking style preference; does not affect correctness.
Reviewed by the PR-review cascade (triage: haiku 4.5 [sonnet 5] → deep: opus 4.8 [sonnet 5] + duck: o4-mini → audit: fable 5). Reply if you need a human review.
|
pr-review approved on PARTIAL advisory evidence: 4/6 required advisory bots reported before the gate's quiescence-timeout fallback proceeded. Recorded for the miss-rate metric (#1596). |
Dismissing approval due to a PR issue comment lacking a verified disposition (#1813)
Dev-Lead — fix-bot-comment (no-changes)Agent reasoning |
|
|
Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-09-21T03:06:58Z. |
|
pr-review approved on PARTIAL advisory evidence: 4/6 required advisory bots reported before the gate's quiescence-timeout fallback proceeded. Recorded for the miss-rate metric (#1596). |
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: MEDIUM
Reviewed commit: 24354eb33084bd528bed077702f798870cfa14eb
Review mode: triage-approved (single reviewer)
Summary
Implements the #1786 empty-net-diff guard for dev-lead: a new shared lib (scripts/lib/net-diff-guard.sh) computes the three-dot net diff against base with an explicit fail-open contract; fix-issue refuses to push/open/claim on an empty net diff (labels needs-human instead); the #1340 no-op guard in fix-reviews is broadened to every pushing intent (review-changes, rebase, on-mention, human) with a post-rebase re-check; completion claims now state the net file/line change. 348 lines of new bats coverage across three suites, registered in the lint workflow. Triage's low-risk clearance is confirmed with a MEDIUM (not LOW) rating due to non-trivial orchestration-script logic — still within auto-approve range.
Linked issue analysis
Issue #1786 ([#1620 slice 1]) is substantively addressed, AC by AC: AC1 — net_diff_is_empty runs after commit and BEFORE git push/pr create in fix-issue (abort_empty_net_diff labels dev-lead:needs-human, comments, exits 1; nothing pushed); AC2 — post_completion_claim belt-and-suspenders skips the claim on an empty net diff and includes net_diff_summary (file count + line delta) making the claim falsifiable; AC3 — uses the three-dot origin/...HEAD compare, never the PR file list; AC4 — tests cover empty→abort/label/no-PR, rebase that nets to zero after merge-from-main → flagged and never reported applied, and the normal non-empty path; AC5 — shellcheck CI green, new suite registered in the lint.yml bats job. The Dev Notes requirement that the guard also run after merge-from-main is met by the post-rebase pr_nets_to_zero re-check.
Findings
No blocking findings.
Non-blocking observations:
- (LOW) scripts/lib/net-diff-guard.sh:_ndg_resolve_base_sha — if 'git fetch origin ' fails silently ('|| true'), FETCH_HEAD may be stale from a prior fetch of a different ref and resolve to the wrong base SHA. Blast radius is limited by the fail-open contract and the origin/ fallback, but preferring the remote-tracking ref when the fetch failed would be tighter. Fine to address in a follow-up.
- (INFO) The rc=3 no-op-guard paths in fix-reviews deliberately 'exit $rc' (rc=0): the escalation already happened via flag_noop_pr (needs-human label + auto-merge disabled), and a green exit avoids retry loops. This is intentional and covered by tests asserting status 0.
- (INFO) Secret scan: the run_secret_scanning MCP tool is not available in this environment; the gitleaks CI check is green and no secret-like content appears in the diff.
- (INFO) Review threads: all 8 threads (including the two gemini-code-assist nits on net-diff-guard.sh and test_fix_issue.bats) are resolved; no unanswered human-reviewer questions (don-petry's 2026-09-13 threads are resolved).
- (INFO) REVIEW_CYCLE=5 exceeds MAX_REVIEW_CYCLES=3, largely consumed by advisory-bot rate-limit re-arms rather than substantive rejections; cycle-cap enforcement remains with the orchestrator.
CI status
All 5 ruleset-required checks green: SonarCloud, CodeQL, agent-shield / AgentShield, dependency-audit / Detect ecosystems, duplicate-decl-gate. Also green: Lint (incl. new bats suite), shellcheck, unit-tests, gitleaks, actionlint, CodeRabbit, and all stub/permission guards. template-drift is FAILURE but is NOT in the branch ruleset's required set — per the #1795 policy (scripts/lib/ci-status.sh) a red non-required check does not gate review; it is a pre-existing repo-template baseline failure unrelated to this PR.
Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: MEDIUM
Reviewed commit: 24354eb33084bd528bed077702f798870cfa14eb
Review mode: triage-approved (single reviewer)
Summary
Confirmation review (triage-approved) of the #1786 empty-net-diff guard: a new shared lib scripts/lib/net-diff-guard.sh (three-dot origin/...HEAD compare, documented fail-open contract), wired into dev-lead-fix-issue.sh (abort before push/PR-open, needs-human label, no completion claim) and dev-lead-fix-reviews.sh (no-op guard broadened from fix-reviews/fix-bot-comment to every pushing intent, incl. post-rebase re-check). Triage's low-risk read is confirmed: pure shell automation hardening with thorough real-repo bats coverage, no security surface added.
Linked issue analysis
Linked issue #1786 ([#1620 slice 1]) is substantively addressed on every AC: (1) guard runs before PR-open and after every dev-lead push intent, aborts with needs-human label + explanatory comment, never opens an empty PR; (2) completion claim is suppressed on an empty net diff and now states file count + net line delta (falsifiable); (3) uses the three-dot net diff, not the PR file list; (4) tests cover empty-diff abort, post-rebase net-zero, and normal non-empty paths against a real git repo (PATH-stubbed git cannot fake the abort path); (5) shellcheck green and tests registered in the lint.yml bats job.
Findings
No blocking findings.
- Security: no secrets, auth, or new Actions surface; the only workflow change registers tests/dev-lead/unit/test_net_diff_guard.bats in the bats list. Gitleaks, CodeQL, SonarCloud, AgentShield all green. (Secret-scanning MCP tool unavailable in this environment — gitleaks CI covers the scan.)
- Correctness: fail-open contract is deliberate and tested (unresolvable base -> proceed with warning, never a false abort); merge-base is verified before diffing; binary-file numstat handled in the summary.
- Note (non-blocking): _ndg_resolve_base_sha prefers FETCH_HEAD after 'git fetch origin || true' — if that fetch silently fails, FETCH_HEAD could reflect an earlier fetch of a different ref. The three-dot merge-base semantics and the fail-open posture bound the impact; fine to leave as-is.
- Note: REVIEW_CYCLE (5) exceeds MAX_REVIEW_CYCLES (3), but the cycle history is convergent — prior dismissed reviews were superseded by pushes and the cascade already approved this exact SHA; not a grounds to escalate a green confirmation review.
CI status
All 5 ruleset-required checks green: SonarCloud, CodeQL, agent-shield / AgentShield, dependency-audit / Detect ecosystems, duplicate-decl-gate. Everything else green/skipped except the NON-required template-drift, which fails on drifted blobs in petry-projects/repo-template (sonarcloud.yml, dependabot.yml DRIFTED; agent-ingress.yml MISSING) — files this PR does not touch. Per #1549/#1795 policy (scripts/lib/ci-status.sh, AGENTS.md), a red non-required template-drift from an external baseline move does not block review.
Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.



User description
Closes #1786
Implemented by dev-lead agent. Please review.
CodeAnt-AI Description
Prevent Dev-Lead from treating reverted work as a completed fix
What Changed
Impact
✅ Fewer empty pull requests✅ No false completion claims for reverted work✅ Clearer human-review escalation💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.