Skip to content

feat(sdv-ship): ci_wait.py runs the self-review before Copilot (0.25.4) - #73

Merged
saiemgilani merged 3 commits into
mainfrom
feat/ci-wait-self-review-first
Nov 26, 2026
Merged

saiemgilani merged 3 commits into
mainfrom
feat/ci-wait-self-review-first

Conversation

@saiemgilani

@saiemgilani saiemgilani commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

What

Owner rule, 2026-11-26: the self-review comes before Copilot. Run the self-review rounds and push their fixes, then request Copilot on the self-reviewed head as the last gate.

ci_wait.py's Copilot fallback (CodeRabbit and Sourcery both rate-limited for more than 5 minutes on a package PR) now depends on a new flag:

  • --self-reviewed <SHA>: the head that was self-reviewed. It accepts 4–40 hex characters and matches the head by prefix. Copilot may be requested only while that SHA is still the head. After that, the existing credit-floor, allowed-actor and ask-or-request logic runs unchanged.
  • New verdict self-review-first, exit 9: returned while the flag is missing or names another head. In that case the script doesn't request Copilot, ask the user, or read Copilot's credits. A push after the self-review, including Copilot's own fix commits, therefore needs a new self-review before Copilot is requested again.
  • Exit 8 (self-review) keeps one meaning: no bot can review. Its note now says how to wait for CI: rerun with --copilot never. Without that, the first draft could loop between self-reviewing and rerunning and never reach a CI verdict.
  • A quota refusal already on the head is still reported as the refusal, so the verdict never suggests requesting a Copilot that can't review.
  • Unchanged: -raw/-data repos, --copilot never, a head Copilot has already reviewed, and PRs whose bots aren't both rate-limited.

sdv-ship/SKILL.md gets the rule, the reworded fallback section, the flag in the Phase 6 usage line, and verdict rows for 8 and 9. Version 0.25.3 → 0.25.4.

Why

On #72, Copilot ran after two self-review rounds and CodeRabbit, and it still found 3 issues none of them had. Copilot credits are finite, so spending them on an already-cleaned diff gets the most from each review.

Review

Round 1 was my own review before pushing:

  • Gate order: the gate first sat before the quota-refusal check. Fixed.
  • Formatter churn: a formatter hook rewrapped untouched code. Reverted.

Round 2 was an independent adversarial review:

  • Major: exit 8 was ambiguous, and following the docs led to a self-review/rerun loop that never waited on CI. Fixed with exit 9 and the --copilot never hint.
  • Minor: the flag wasn't tied to a commit. Fixed by taking a SHA.
  • Minor: misplacing the gate (M3, M4) went undetected by the tests. New tests now catch it.
  • Minor: the docs disagreed with the code. Aligned.

Reports are in ClaudeCowork notes/2026-11-26-pr-self-review/github-73_r{1,2}.md.

Tests

There are 71 unit tests (60 before). The mutation matrix runs each mutation on a scratch copy, and every one fails at least one test:

Mutation Tests failed
gate removed 5
flag not tied to the head 2
exit 9 collapsed to 8 5
--copilot never hint dropped 1

The existing tests of post-self-review behaviour run with --self-reviewed <head> through go_sr(). One assertion changed on purpose: a push mid-wait now expects exit 9 rather than a second Copilot request.

release.py check passes: catalog, render, tools tests and hooks tests.

Not in this PR

On main, --sha mode raises a KeyError on bots["Copilot"] at its first poll (exit 6). That's a separate fix.

The dotfiles mirror follows after this merges.

Owner rule, 2026-11-26: the self-review rounds run and their fixes are pushed before a Copilot review is requested. Without --self-reviewed, the Copilot fallback (both bots rate-limited on a package PR) now stops with verdict self-review (exit 8) instead of requesting Copilot or asking; rerun with the flag once the rounds ran. A quota refusal already on the head still reports the refusal, not a pointer to Copilot. Data repos, --copilot never and PRs whose bots are not rate-limited are unchanged. 7 new tests; the post-self-review tests pass --self-reviewed via go_sr().
@coderabbitai

coderabbitai Bot commented Nov 26, 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 5 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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7e0300cc-57b7-4d67-b280-e80cc3168959
Commits

Reviewing files that changed from the base of the PR and between fa8f4bd and 50ee02a.

Files selected for processing: 4

  • sdv-toolkit/.claude-plugin/plugin.json
  • sdv-toolkit/skills/sdv-ship/SKILL.md
  • sdv-toolkit/skills/sdv-ship/scripts/ci_wait.py
  • sdv-toolkit/tools/test_ci_wait.py
  • 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

@sourcery-ai

sourcery-ai Bot commented Nov 26, 2026

Copy link
Copy Markdown

Sorry @saiemgilani, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 4 days and 18 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Nov 26, 2026

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Gate the Copilot fallback on --self-reviewed, after checking for an existing quota refusal, so the fallback stops for self-review without reading credits or requesting Copilot when the flag is absent.

  • sdv-toolkit/skills/sdv-ship/scripts/ci_wait.py L10-13, L577-586 (+3 small edits)

Documentation

Explain the self-review-first rule, the opt-in flag, and the updated meaning of the self-review verdict in the shipping workflow.

  • sdv-toolkit/skills/sdv-ship/SKILL.md L473-479, L520, L530

Tests

Add coverage for the no-flag gate and its exceptions, and pass --self-reviewed in tests that exercise post-review Copilot behavior.

  • sdv-toolkit/tools/test_ci_wait.py L228-232, L878-930 (+23 small edits)

Other changes

Files not grouped.

  • sdv-toolkit/.claude-plugin/plugin.json L3

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

…elf-reviewed

Round-2 review of #73. Exit 8 meant both 'no bot can review' and 'Copilot is next', and the doc told an agent to rerun without the flag to wait for CI, which hit the gate at once: a self-review loop with no CI verdict. The gate now returns self-review-first (exit 9), and the no-bot exits say to wait for CI with --copilot never. --self-reviewed takes the reviewed SHA (4-40 hex, prefix match), so a later push, such as Copilot's own fixes, can't spend credits on commits nobody self-reviewed; the push test now expects exit 9, not a second request. New tests: never mode and a Copilot review of this head need no flag; a flag on another head and a malformed flag (usage error, exit 6). Every mutation in the matrix fails a test.

Copilot AI 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.

🟡 Changes recommended

A critical race allows a push during credit lookup to trigger Copilot on an unreviewed head, requiring head revalidation before both request paths and a regression test.

1 open issue
What changed in this PR

This PR updates sdv-ship so its Copilot fallback requires a self-reviewed head, reserving Copilot for the final review gate.

Changes:

  • Adds --self-reviewed SHA and exit 9 (self-review-first) when the current head lacks self-review confirmation.
  • Clarifies exit 8 and documents using --copilot never to continue waiting for CI.
  • Expands regression coverage and bumps the plugin to version 0.25.4.
File Description
sdv-toolkit/​tools/​test_ci_wait.py Adds self-review gate tests and updates existing fallback cases.
sdv-toolkit/​skills/​sdv-ship/​SKILL.md Documents review ordering, the SHA flag, and verdict handling.
sdv-toolkit/​skills/​sdv-ship/​scripts/​ci_wait.py Implements the self-review gate and revised action messages.
sdv-toolkit/​.claude-plugin/​plugin.json Bumps the plugin version to 0.25.4.

Review effort: Balanced

Copilot review of #73: the self-review gate checked the poll's snapshot, so a push during the user/credit lookups could get the new, unreviewed head a Copilot request. The head is re-read just before the request; if it moved, the poll restarts (the head-move check resets the rule, and the gate then wants a new --self-reviewed SHA). requested_reviewers takes no SHA, so a ms-wide window remains between the re-read and the POST (ponytail comment). Regression test for a push during the checks; four fixtures gain the extra pulls/7 read.
@saiemgilani
saiemgilani merged commit 48b265e into main Nov 26, 2026
6 checks passed
@saiemgilani
saiemgilani deleted the feat/ci-wait-self-review-first branch November 26, 2026 17:11
saiemgilani added a commit that referenced this pull request Nov 26, 2026
…breaking change

Round-2 review of #74: '--copilot auto --self-reviewed <old head>' (the line #73 documented) fell through to the Copilot request after a push. A stale flag now returns self-review-first under any --copilot mode; regression test added. Restored the guidance not to rerun --copilot auto after fixing Copilot's own threads (wait with --copilot never), on the explicit path and in the bots-unaddressed row. Fixed a stale --self-reviewed comment. A breaking change bumps the minor version in this repo (b679baf, b91c604): 0.26.0, not 0.25.5.
saiemgilani added a commit that referenced this pull request Nov 26, 2026
… (0.26.0) (#74)

* feat(sdv-ship)!: two self-review rounds replace Copilot in ci_wait.py (0.25.5)

Owner rule restated 2026-11-26: after two self-review rounds, Copilot is not requested at all. #73 encoded the earlier draft (self-review, then Copilot as the last gate). Now --self-reviewed <head SHA> satisfies the rate-limited-bots fallback: no Copilot request, no ask, no credit read; the script waits for CI. --copilot defaults to unset, so by default the fallback returns self-review-first (exit 9); the Copilot request path runs only with an explicit --copilot auto|ask, for a PR that gets no self-review. The #73 head re-read is removed: it guarded a path that no longer requests Copilot. sdv-ship documents the two rounds and limits re-requesting Copilot to PRs where it was the chosen reviewer.

BREAKING CHANGE: ci_wait.py no longer requests Copilot by default; pass --copilot auto explicitly for the old fallback.

* fix(sdv-ship): any --self-reviewed rules Copilot out; 0.26.0 for the breaking change

Round-2 review of #74: '--copilot auto --self-reviewed <old head>' (the line #73 documented) fell through to the Copilot request after a push. A stale flag now returns self-review-first under any --copilot mode; regression test added. Restored the guidance not to rerun --copilot auto after fixing Copilot's own threads (wait with --copilot never), on the explicit path and in the bots-unaddressed row. Fixed a stale --self-reviewed comment. A breaking change bumps the minor version in this repo (b679baf, b91c604): 0.26.0, not 0.25.5.
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