You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: automatically start Crosscheck reviews on PR registration (#373)
* fix: start crosscheck on PR registration
* no-mistakes(review): Fix Crosscheck retirement handoff and live merge detection
* no-mistakes(review): Preserve Crosscheck registration order and completion state
* no-mistakes(document): Replace stale registration description with authoritative documentation pointer
* no-mistakes: apply CI fixes
* no-mistakes: apply CI fixes
Copy file name to clipboardExpand all lines: bin/fm-crosscheck.py
+29-3Lines changed: 29 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
1
#!/usr/bin/env python3
2
-
"""Fail-closed independent review ledger bound to an exact pull-request head."""
2
+
"""Fail-closed independent review ledger bound to an exact pull-request head.
3
+
4
+
The public `run TASK URL` surface resolves the live head itself.
5
+
The PR-registration coordinator additionally passes `--expected-head SHA` so a head change between registration and launch refuses before reviewer or Azure spending.
Copy file name to clipboardExpand all lines: docs/crosscheck.md
+36-13Lines changed: 36 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,40 @@
1
1
# Crosscheck
2
2
3
-
Crosscheck is an on-demand, exact-head PR reviewer. It is independent of
4
-
Firstmate task orchestration: any agent or operator that can run the supported
5
-
wrapper and read the configured Firstmate home can use it.
3
+
Crosscheck is an exact-head PR reviewer that starts automatically when Firstmate registers a PR-ready task and remains available on demand.
4
+
It is independent of Firstmate task orchestration: any agent or operator that can run the supported wrapper and read the configured Firstmate home can use it.
6
5
7
-
Crosscheck does one job. It reviews the current PR head, returns `CLEAR` or
8
-
`BLOCKING`, and records cited findings and suspicions against that exact SHA.
6
+
Crosscheck does one job.
7
+
It reviews the current PR head, returns `CLEAR` or `BLOCKING`, and records cited findings and suspicions against that exact SHA.
9
8
It does not rerun CI, manufacture proof scripts, or launch verifier VMs.
10
9
11
10
## Run it
12
11
13
-
Use a unique task ID and the full public GitHub PR URL:
12
+
The normal Firstmate path is PR-ready registration:
13
+
14
+
```sh
15
+
FM_HOME=/Users/dongkeun/firstmate-home \
16
+
bin/fm-pr-check.sh <task-id> \
17
+
https://github.com/OWNER/REPO/pull/NUMBER
18
+
```
19
+
20
+
Registration records the live PR head, arms the merge poll, durably requests Crosscheck, starts one task-local coordinator, and returns without waiting for the review.
21
+
A matching active request is reused, and a matching exact-head and exact-claims `CLEAR` result is verified without another review.
22
+
Registering a new head replaces the queued request so the coordinator reviews that head next.
23
+
Registration holds the task metadata lock from head capture through poll emission and request publication, so an older capture cannot replace a newer registration.
24
+
A short task-local handoff lock couples request publication, status reconciliation, and coordinator retirement; it is never held during review execution.
25
+
A dead or failed coordinator releases its task-local lock and retries when the same registration command runs again.
26
+
The merge poll observes live GitHub merge state before reporting launcher failures, so manual completion and merge still trigger cleanup without granting merge authorization.
27
+
Unrelated task coordinators share no launcher lock, so the Azure lane-capacity and cost-admission controls remain the only review spending authority.
28
+
29
+
Before launching a review, the coordinator loads the authoritative operator-private fleet environment from `~/.fm-azure/fleet.env` by default.
30
+
`FM_CROSSCHECK_FLEET_ENV` may select another absolute file.
31
+
The launcher opens that file without following symlinks and requires a current-operator-owned regular file that is not group or world writable.
32
+
It sources the already-open file only inside the Crosscheck child, suppresses output from the source operation, and never copies environment values into argv, prompts, logs, repository files, or launcher records.
33
+
34
+
Missing, unsafe, or incomplete fleet configuration does not undo or fail PR registration.
35
+
The task remains honestly uncleared, the actionable failure is recorded in `state/<task-id>.crosscheck-autostart.json` and `state/<task-id>.crosscheck-autostart.log`, and the task check surfaces it for repair and retry.
36
+
37
+
For an explicit on-demand run, use a unique task ID and the full public GitHub PR URL:
The fleet environment is operator-private Azure configuration. Load it into the
25
-
process environment; never paste its values into a prompt or command.
48
+
The fleet environment is operator-private Azure configuration.
49
+
Load it into the process environment; never paste its values into a prompt or command.
26
50
27
-
A new task ID needs no pre-created metadata file. Existing state must match the
28
-
same task and PR identity or the run fails closed.
51
+
A new task ID needs no pre-created metadata file.
52
+
Existing state must match the same task and PR identity or the run fails closed.
29
53
30
-
The command exits zero only for a valid `CLEAR` verdict on the live head. A
31
-
finding, unresolved suspicion, stale head, provider failure, malformed verdict,
32
-
or infrastructure failure exits nonzero and is never presented as clearance.
54
+
The command exits zero only for a valid `CLEAR` verdict on the live head.
55
+
A finding, unresolved suspicion, stale head, provider failure, malformed verdict, or infrastructure failure exits nonzero and is never presented as clearance.
0 commit comments