Reused CI runs that passed only after a re-run are now marked instead of shown as clean passes (GST-3054) (#4473)

When /ship reuses a CI run that passed only after its failed jobs were
re-run, its CI line and its final summary line now add `rerun=
attempts=`.

Why: gbrain's CI now records which test files passed on a re-run
(gbrain#9690), and a pass on a re-run must read as flaky, never as
clean.

Nothing to do: runs without that record print as before; a malformed
record is refused with `CI_CARRY_RERUN_MALFORMED`.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/outside-voice#1 reader=outside-voice
Review-Finding: p1/outside-voice#2 reader=outside-voice
Review-Finding: p1/adversarial-native#2 reader=adversarial-native
Review-Finding: p1/red-team#1 reader=red-team
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-18 03:47:25 +00:00
1 parent 237371474b
commit 0a6bb42e74
17 files changed
+270 -17

No files matched your search

+4 -1
View File
@@ -1339,7 +1339,10 @@ each mapped lane from the green run at that exact tree, reuses or runs the rest,
checks every lane FRESH and reruns the pregate there, whose tests stage carries
the same run. `gstack-ship-receipt write` records the carried runs as
`ci_carried: [{ lane, run, attempt, tree }]`, and the `SHIP_RECEIPT:` line names
them (`ci_carried=<lane>:<run>/<attempt>`). Each `record-ci` gets the base
them (`ci_carried=<lane>:<run>/<attempt>`). A run whose `tree.json` lists
`rerun_files` adds `rerun` and `attempts` to its entries and
`rerun=<files> attempts=<list>` after `ci_carried=`, as its `CI_CARRY:` line does
([ship-policy.md](ship-policy.md#ci-carry-rerun)). Each `record-ci` gets the base
policy's [`ci_record_timeout_s`](ship-policy.md#ci-record-timeout) (600 s by
default, 3600 s at most), and accept prints it as `CI_RECORD_TIMEOUT:`.
+11
View File
@@ -2730,6 +2730,17 @@ body plain: they become main's history.
A `pull_request` CI run tests GitHub's merge commit rather than your branch,
so on a branch behind main `gstack-ci-carry` reports `tree_mismatch`:
dispatch the workflow on the branch (`gh workflow run <workflow> --ref <branch>`).
- <a id="ci-carry-rerun"></a>**A carried run that passed only after a re-run is marked, not refused.**
When only a run's failed jobs were re-run, its `tree.json` may list
`rerun_files` (the files whose newest result came from a re-run attempt) and
`attempts` (for example `[1, 2]`). The carry still accepts the run, but the
`CI_CARRY:` line, the `SHIP_RECEIPT:` line's `ci_carried=` field, and the
receipt line `ready` and `land` print all add `rerun=<files> attempts=<list>`,
so a pass on a re-run reads as flaky, never as a clean first-attempt pass. A
`tree.json` without `rerun_files`, or with an empty list, prints exactly as
before. A `rerun_files` that is not a list of paths, or `attempts` that is not
a list of attempt numbers, refuses that run
([`CI_CARRY_RERUN_MALFORMED`](troubleshooting.md#ci-carry-rerun-malformed)).
<a id="land-direct-contract"></a>
#### Every check land makes
+17
View File
@@ -7251,6 +7251,23 @@ pass the `gstack-review-scope summary` file as `--review-loop`, put the printed
line in the PR body, and write again
([ship-policy.md](ship-policy.md#ship-receipt)).
<a id="ci-carry-rerun-malformed"></a>
### `CI_CARRY_RERUN_MALFORMED`
**Meaning.** A CI run's `tree.json` names `rerun_files` or `attempts`, the
fields that say some test files passed only on a re-run attempt, but in a shape
gstack cannot read: `rerun_files` is not a list of file paths, or `attempts` is
not a list of attempt numbers of 1 or more. gstack fails closed: that run is not
evidence, the carry refuses it (`rerun_malformed` in the `CI_CARRY: none` or
`no_verified_run` detail), and the lane runs here instead. A well-formed record
is accepted and marked `rerun=<files> attempts=<list>`
([ship-policy.md](ship-policy.md#ci-carry-rerun)).
**Fix.** Fix the workflow step that writes `tree.json` so it writes
`"rerun_files": ["test/a.test.ts", …]` and `"attempts": [1, 2]`, or leaves both
out. Then dispatch a fresh run at the same head and rerun
`gstack-ci-carry wait`.
<a id="receipt-carry-tree-mismatch"></a>
### `RECEIPT_CARRY_TREE_MISMATCH`