Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .agents/skills/drive-pr/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ this skill exists to prevent. So is forgetting to loop back to the promotion PR
step 2's attestation as `coverage=local` and requests none, unless a partial round or a truncated
review history is on record. Exit `49` means the head carries no attestation, so run and record a
pass over it, push, and attest. Exit `46` means a thread is open on the head, so dispose of each
one per "Disposing of Every Finding" and wait again. A promotion re-reviews content its feature PRs already carried,
one per "Disposing of Every Finding" and wait again. Read `state=` in every digest `wait` or `status` prints.
A peer can merge or close the pull request mid-drive. A digest carrying `state=MERGED` on a feature PR into develop means the merge has landed.
Skip the merge in step 4 and go on to its post-merge path.
On a promotion PR it means the drive's end state is passed, so stop and report it merged.
A digest carrying `state=CLOSED` is a stop to report, with its `closed_at=`.
On such a PR `state=` decides the next step over any exit code `wait` or `status` returns. A promotion re-reviews content its feature PRs already carried,
so the hosted review runs once per change, at the promotion in step 6.
4. Merge the feature PR into
develop, `gh pr merge <number> --squash --repo <owner>/<repo>`. Never `--delete-branch` on this
Expand Down
2 changes: 1 addition & 1 deletion .claude-plugin/fleet-skills/.source-digests/drive-pr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a82430936f2eb666
2e23bf5d78aaa8b5
7 changes: 6 additions & 1 deletion .claude-plugin/fleet-skills/skills/drive-pr/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ this skill exists to prevent. So is forgetting to loop back to the promotion PR
step 2's attestation as `coverage=local` and requests none, unless a partial round or a truncated
review history is on record. Exit `49` means the head carries no attestation, so run and record a
pass over it, push, and attest. Exit `46` means a thread is open on the head, so dispose of each
one per "Disposing of Every Finding" and wait again. A promotion re-reviews content its feature PRs already carried,
one per "Disposing of Every Finding" and wait again. Read `state=` in every digest `wait` or `status` prints.
A peer can merge or close the pull request mid-drive. A digest carrying `state=MERGED` on a feature PR into develop means the merge has landed.
Skip the merge in step 4 and go on to its post-merge path.
On a promotion PR it means the drive's end state is passed, so stop and report it merged.
A digest carrying `state=CLOSED` is a stop to report, with its `closed_at=`.
On such a PR `state=` decides the next step over any exit code `wait` or `status` returns. A promotion re-reviews content its feature PRs already carried,
so the hosted review runs once per change, at the promotion in step 6.
4. Merge the feature PR into
develop, `gh pr merge <number> --squash --repo <owner>/<repo>`. Never `--delete-branch` on this
Expand Down
7 changes: 6 additions & 1 deletion .github/skills/drive-pr/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ this skill exists to prevent. So is forgetting to loop back to the promotion PR
step 2's attestation as `coverage=local` and requests none, unless a partial round or a truncated
review history is on record. Exit `49` means the head carries no attestation, so run and record a
pass over it, push, and attest. Exit `46` means a thread is open on the head, so dispose of each
one per "Disposing of Every Finding" and wait again. A promotion re-reviews content its feature PRs already carried,
one per "Disposing of Every Finding" and wait again. Read `state=` in every digest `wait` or `status` prints.
A peer can merge or close the pull request mid-drive. A digest carrying `state=MERGED` on a feature PR into develop means the merge has landed.
Skip the merge in step 4 and go on to its post-merge path.
On a promotion PR it means the drive's end state is passed, so stop and report it merged.
A digest carrying `state=CLOSED` is a stop to report, with its `closed_at=`.
On such a PR `state=` decides the next step over any exit code `wait` or `status` returns. A promotion re-reviews content its feature PRs already carried,
so the hosted review runs once per change, at the promotion in step 6.
4. Merge the feature PR into
develop, `gh pr merge <number> --squash --repo <owner>/<repo>`. Never `--delete-branch` on this
Expand Down
43 changes: 35 additions & 8 deletions catalog/snippets/hub_fetch_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def resolve_main_commit() -> str | None:

Every file a run fetches comes from that one commit, so a script and its data always pair.
Where neither resolves, one line names both causes and the gate runs against `main` instead.
That run fetches twice and refuses to run, if the two reads differ, a push having landed mid-run.
A hook with no network cannot fetch the gate at all, and the CI gate is the enforcement.
"""
token = (os.environ.get("GH_TOKEN") or os.environ.get("GITHUB_TOKEN") or "").strip()
Expand Down Expand Up @@ -145,6 +146,26 @@ def resolve_unborn_head(argv: list[str]) -> list[str]:
return out


class FetchError(Exception):
def __init__(self, url: str, cause: Exception) -> None:
super().__init__(url)
self.url = url
self.cause = cause


def fetch_all(ref: str, paths: tuple[str, ...]) -> dict[str, bytes]:
"""Fetch each hub path at `ref` in order, raising FetchError naming the first that fails."""
fetched: dict[str, bytes] = {}
for path in paths:
url = f"{HUB_RAW_BASE}/{ref}/{path}"
try:
with urllib.request.urlopen(url, timeout=30) as response:
fetched[path] = response.read()
except (urllib.error.URLError, OSError) as exc:
raise FetchError(url, exc) from exc
return fetched


USAGE = "usage: hub_fetch_run.py <hub-relative-path> [script-args...]"


Expand All @@ -171,16 +192,22 @@ def main(argv: list[str]) -> int:
else:
env[PROVENANCE_VAR] = f"{HUB_REPO}@main (hub-fetch-run, commit unresolved)"
with tempfile.TemporaryDirectory() as scratch:
# The script is fetched last, so a companion it needs is in place before it can run.
for path in (*COMPANIONS.get(hub_path, ()), hub_path):
url = f"{HUB_RAW_BASE}/{ref}/{path}"
try:
with urllib.request.urlopen(url, timeout=30) as response:
content = response.read()
except (urllib.error.URLError, OSError) as exc:
print(f"hub_fetch_run: could not fetch {url}: {exc}", file=sys.stderr)
paths = (*COMPANIONS.get(hub_path, ()), hub_path)
try:
fetched = fetch_all(ref, paths)
if commit is None and len(paths) > 1 and fetch_all(ref, paths) != fetched:
print(
"hub_fetch_run: main moved while the files were fetched, "
"so a mixed pair was refused, re-run to fetch a consistent pair.",
file=sys.stderr,
)
print("hub_fetch_run: the gate did not run.", file=sys.stderr)
return 1
except FetchError as exc:
print(f"hub_fetch_run: could not fetch {exc.url}: {exc.cause}", file=sys.stderr)
print("hub_fetch_run: the gate did not run.", file=sys.stderr)
return 1
for path, content in fetched.items():
(Path(scratch) / Path(path).name).write_bytes(content)
script = Path(scratch) / Path(hub_path).name
cmd = [uv, "run", "--no-project", "--script", str(script), *script_args]
Expand Down
6 changes: 4 additions & 2 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,15 @@ uv run --no-project --script scripts/pr_review.py cleanup 452 --repo ptr727/Proj

`wait` does not classify a request from `copilot_work_started`, since GitHub can complete an effort-labeled review without that event. A request with no review or answer remains `PENDING` until the bounded timeout. Where a second bounded wait times out as well, read the pending set. In that case, clear it only where no human or team reviewer is requested alongside the bot, and rerun `wait`, which then requests afresh. The clear replaces that set rather than adding to it. A stall on a pull request with a human or team reviewer requested therefore goes to the maintainer. The mutation itself is in [`pr-reviewer-reference.md`][pr-reviewer-reference]. `--pickup-grace` remains accepted for command compatibility and has no effect.

On a pull request no longer open, `pr=` is followed by `state=MERGED`, `merged_at=`, and `merge_commit=`, or by `state=CLOSED` and `closed_at=`. `merge_commit=` is the first 8 characters of the merge commit. GitHub computes no mergeability for such a pull request, so its `merge=UNKNOWN` never clears. `wait` requests no Copilot review and does not poll, on the first read or on any poll. It exits as `status` does, so its `0` says nothing about review coverage, and `state=` says why. An open pull request prints none of these fields.

`wait` exits `41` when the newest round is a refusal or a quota state. A refusal is a formal review carrying the head and no threads, which is the clean pass byte for byte. So it is not coverage: `review_on_head` reports `NO` and `refusal=` carries its kind. A quota refusal reads `refusal=QUOTA`. An error refusal is the body the weekly rate limit posts. So the job log of the reviewer's own failed run on that commit is read. A logged rate limit reads as `QUOTA` with its reset time, and anything else reads as `ERROR`. `wait` sends no request while the pull request's newest Copilot review is a quota or error refusal on any head. It sends none where the reviewer's newest activity elsewhere in the repository is a quota refusal nothing answered since. The exception is an error refusal whose run log names `too many files changed`, a transient fetch failure one re-request clears. `wait` sends that one re-request, unless the round before it was an error refusal too. A re-request already made after the refusal is never sent again, even where the request has since vanished. It exits `30` while that request is pending, and `41` as `COPILOT_ERROR_TRANSIENT` on a held head, where only `--request` sends it. A `RUN LOG READING` line in the digest names the reading taken, and a log unread or naming neither cause keeps the possible-quota reading. Pass `--ignore-quota-signal` once the quota is believed to have reset. A file-count refusal is cleared by splitting the pull request. `status` exits `0` over a refusal and carries it in `refusal=`.

The digest reports the completed head review's effective effort as `lite`, `balanced`, or `max`. It reports `effort_source=default` for `Default (<level>)` and `explicit` for a bare level, and `unknown` for both where the body states none. Effort never changes a verdict, and the workflow never selects or changes the user-controlled setting.

**`coverage=` names how the head's diff is shown read, and only partial coverage is an exit.** `full` and `PARTIAL` are the reviewer's own statement, the `fleet-review` marker the fleet's review instructions ask for. `UNKNOWN` is a statement this cannot believe, such as one reading more files than changed, or a body the reader failed on. The reason is printed beside it. A count Copilot states in a top-level paragraph that opens on it is read too. It is never read from a list item and never from inside a counted finding section. A partial wins over any other reading beside it. Beside an earlier partial round, a head round reading `UNKNOWN` reads as `PARTIAL`, and so does a head with non-refusal rounds, none stating coverage. Where nothing states coverage, a round covering the head whose own file table names exactly the changed files reads as `table`. Likewise where nothing states coverage, the newest round on any commit whose table does reads as `carried:table`. A table stands in only where no round states partial coverage and the review history is not cut by its window. That is because a table names the whole changed set on a partial round too. The changed-file list is paged to GitHub's own ceiling of 3,000 files. A list not read whole, or read empty, is read again before a table is matched against nothing. A table row matches a changed path exactly, or by a `*` or `?` glob. Otherwise `coverage=none` prints with the reason no table stood in, and `status` adds a note. In that case the exit stays `0`, since Merge Gate item 2 in `pr-review-conduct` reads this field rather than an exit code. A partial round is reported and handed over rather than retried into. That is because every partial on record stayed partial at the identical ratio across every later round.
**`coverage=` names how the head's diff is shown read, and only partial coverage is an exit.** `full` and `PARTIAL` are the reviewer's own statement, the `fleet-review` marker the fleet's review instructions ask for. `UNKNOWN` is a statement this cannot believe, such as one reading more files than changed, or a body the reader failed on. The reason is printed beside it. A count Copilot states in a top-level paragraph that opens on it is read too. It is never read from a list item and never from inside a counted finding section. A partial wins over any other reading beside it. Beside an earlier partial round, a head round reading `UNKNOWN` reads as `PARTIAL`, and so does a head with non-refusal rounds, none stating coverage. Where nothing states coverage, a round covering the head whose own file table names exactly the changed files reads as `table`. Likewise where nothing states coverage, the newest round on any commit whose table does reads as `carried:table`. A table stands in only where no round states partial coverage and the review history is not cut by its window. That is because a table names the whole changed set on a partial round too. The changed-file list is paged to GitHub's own ceiling of 3,000 files. A list not read whole, or read empty, is read again before a table is matched against nothing. A table row matches a changed path exactly, or by a `*` or `?` glob. A file added, modified, or deleted with no added or deleted line GitHub counts is left out unless the table names it. That is a binary file, but an empty file, a mode-only change, and a text file `.gitattributes` marks `binary` or `-diff` all read the same. GitHub's file list does not tell them apart. A rename or copy is never left out. Nothing is left out unless a file with an added or deleted line remains, and the reason line says how many were. Otherwise `coverage=none` prints with the reason no table stood in, and `status` adds a note. In that case the exit stays `0`, since Merge Gate item 2 in `pr-review-conduct` reads this field rather than an exit code. A partial round is reported and handed over rather than retried into. That is because every partial on record stayed partial at the identical ratio across every later round.

**Findings no thread carries are counted and printed whole.** `suppressed=`, `previously_missed=`, and `cr_outside_diff=` count the findings a review body collapses into a counted section. They are read over every round rather than the head's alone, since a push does not answer a finding nobody replied to. Each reads `N (on_head=X earlier=Y)` with a trailing `+` where the reviews window was cut. A tally holding a count the reader cannot believe reads `?`. `previously_missed=` and `cr_outside_diff=` print only where one was raised or the window was cut. `qodo_open=` counts the entries in Qodo's findings comment carrying neither its `Resolved` nor `Dismissed` badge, `unknown` where that comment can sit behind the window. `overview=T/M` is the open findings the round covering the head states beside the threads it opened, `?` where it states no count. A count it cannot believe reads `?` too. `FINDINGS WITH NO THREAD` names findings the round names that no open entry links to a thread on the pull request. The round names them in its count, its findings list, or its file table's findings column. None of these decides an exit code. Each takes the triage a suppressed finding gets, answered with `comment` since no thread exists to reply on.
**Findings no thread carries are counted and printed whole.** `suppressed=`, `previously_missed=`, and `cr_outside_diff=` count the findings a review body collapses into a counted section. They are read over every round rather than the head's alone, since a push does not answer a finding nobody replied to. Each reads `N (on_head=X earlier=Y)` with a trailing `+` where the reviews window was cut. A tally holding a count the reader cannot believe reads `?`. `previously_missed=` and `cr_outside_diff=` print only where one was raised or the window was cut. `qodo_open=` counts the entries in Qodo's findings comment carrying neither its `Resolved` nor `Dismissed` badge, `unknown` where that comment can sit behind the window. `overview=T/M` is the open findings the round covering the head states beside the threads it opened, `?` where it states no count. A count it cannot believe reads `?` too. `FINDINGS WITH NO THREAD` names findings the round names that no open entry links to a thread on the pull request. The round names them in its count, its findings list, or its file table's findings column. Each findings list item prints beneath that block on one line. Its mark says whether a thread read here sits on a `path:line` range its code spans name. A span counts only where its path is a changed file or a thread's. An outdated thread on that path is named rather than counted, since its lines predate the head. An item no thread sits on counts toward the block even where the counts balance. Where the thread page was cut, that mark reads unknown instead. None of these decides an exit code. Each takes the triage a suppressed finding gets, answered with `comment` since no thread exists to reply on.

`status` and `wait` exit `50` where the round covering the head opens on a verdict other than the clean one. This applies while that round states no open finding, has no open entry, opened no thread, and collapsed nothing, and no thread is open. Its headline prints under `VERDICT WITH NO COUNTED FINDING`, since it names what that round flags beside any findings list or file table it carries. The code repeats on that head after the answer, since nothing here reads one. Where a check on that head has not concluded, `wait` names a bounded `gh pr checks --watch` to watch it with. A clean verdict on the same terms prints its headline under `CLEAN VERDICT HEADLINE`, advisory and gating nothing. A clean round whose findings list or file table names a finding prints none, since `FINDINGS WITH NO THREAD` names those.

Expand Down
Loading
Loading