Skip to content

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

Merged
capy-ai[bot] merged 5 commits into
mainfrom
reused-ci-runs-mark-rerun-passes
Nov 18, 2026
Merged

capy-ai[bot] merged 5 commits into
mainfrom
reused-ci-runs-mark-rerun-passes

Conversation

@garrytan

@garrytan garrytan commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

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=<files> attempts=<list>.
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.

What changed

A CI run that went green only because someone re-ran its failed jobs looked exactly like a clean first-attempt pass when /ship reused it, so a flaky test could ship unnoticed. Now, when a run's tree.json lists rerun_files and attempts, the reused-run line, the stored test record and the final summary line all say how many files passed on a re-run and which attempts ran. The run is still accepted. Each re-run file is counted once per run even when two checks read the same run, and a check that reuses the same run without the record no longer hides the marker.

Blast radius

The change touches the reused-run reader (lib/run-evidence.ts), the stored test record (bin/gstack-evidence) and the summary line (lib/ship-receipt.ts). It is safe for existing runs because every new field is optional, and a tree.json without rerun_files prints byte-for-byte as before, which test/ci-carry-rerun.test.ts checks with and without an inventory (script ran). The existing line parsers match single tokens such as runs=(\S+), so the inserted marker does not break them (file:line read by two reviewers).

Test Coverage

Coverage: 75% value-weighted (83% including 1 weakly covered path).
Test value: 1 test written, 0 rejected by the authoring gate, 0 existing tests extended, 1 path weakly covered.
Gaps left as proposed tests: the attempts=unrecorded branch (a re-run record with no attempts list) has no row of its own, and the stored test record write in record-ci is reachable only with a live CI run (end-to-end only).
Regression proof — fails at HEAD: yes (import of the new helper fails before the fix) · passes at base: unavailable (new helper) · passes after fix: yes
Tests ran: tests 1692 (files, CI run 44230473580)

Pre-Landing Review

Two review rounds plus one owner-approved check of a one-line test fix. Round 1 found that re-run counts could be overwritten or double-counted when two checks or two run profiles read the same CI run; that is fixed. Round 2 and that last check found nothing to change. Second-model review (GPT-6.1 Sol) completed; its two findings were the counting bugs above, fixed.

Review notes

Below the blocking floor; recorded here and not fixed in this PR.

  • INFORMATIONAL lib/ship-release.ts:727 The /ship summary clips the CI_CARRY line at 240 characters, which can drop the rerun marker on a long multi-run line; the stored check record keeps the full text.
  • INFORMATIONAL scripts/ci-tree-reuse.ts:158 gstack's own tree.json writer does not write rerun_files, so gstack's own reused runs never show the marker.
  • INFORMATIONAL lib/run-evidence.ts:248 attempts is validated even without rerun_files, so a writer using attempts for something else is refused (fails closed).
  • INFORMATIONAL lib/run-evidence.ts:254 Re-run data is only shape-checked: paths outside files, attempts [1] with re-run files, and a corrupt stored rerun entry is dropped silently.
  • INFORMATIONAL lib/ship-receipt.ts:216 Across checks that share a run, the summary merges re-run counts with the maximum, a lower bound that is display-only.
Exploratory QA

Smoke: bun test test/ci-carry-rerun.test.ts test/evidence-reuse.test.ts covers one success (a re-run record carries and is marked) and the riskiest failure (a malformed record is refused); 11 of 11 passed before the fix round and the re-run test passes 5 of 5 at the final head. No plan checks (bug fix, no plan).

TODOS

No TODO items completed in this PR.

Documentation

Status: current. docs/ship-policy.md, docs/pregate.md and docs/troubleshooting.md already describe the marker and the new error code, so the audit made no edits. The full audit section is in the Agent notes.

Tests
  • bun test test/ci-carry-rerun.test.ts: 5 pass, 0 fail
  • bun test test/free-fixtures.test.ts test/ci-carry-rerun.test.ts test/evidence-reuse.test.ts: 23 pass, 0 fail
  • bun run typecheck and bun run typecheck:test: clean, no new diagnostics
  • CI run 44230473580 at 37c9c4f: free suite green (1692 test files)
Agent notes

Refs GST-3054

Approvals

Approved: yes (record r-1be5dffddae9). The full approval record stays private.
Plan: exempt: bug fix (--kind fix; failing-first test test/ci-carry-rerun.test.ts)
Plan check: exempt bug fix

  • The new code CI_CARRY_RERUN_MALFORMED lives in lib/result-codes-release.ts, which is merged into RESULT_CODES, because lib/result-codes.ts is at the 800-line module-size cap (Captain GStack Minder approved).
  • lib/run-evidence.ts reads optional rerun_files and attempts from tree.json; wrong types refuse that run (rerun_malformed, troubleshooting anchor ci-carry-rerun-malformed). rerunByRun groups re-run files and attempts per <run>/<attempt> for both runReceiptFields and record-ci.
  • gstack-ship-queue ready and land print the SHIP_RECEIPT line through bindShippedReceipt, so the marker shows at land time; neither refuses on it.
  • Captain GStack Minder ruling (option b) on GST-3054. Decision trail: reports/GSTA-606-decisions.tsv in the crew drive.
  • Docs debt from the audit: the CI_CARRIED: line and the run-clear receipt also print the marker and no doc mentions it there.
  • Outside review: completed (host subagent, openai/gpt-6.1-sol).

Documentation audit (verbatim):

Status: current. The docs for CI-carry re-run marking already match the code, so no edits were needed.

Scope: committed range 2373714..37c9c4f on reused-ci-runs-mark-rerun-passes (17 files; no staged, unstaged or new content). I read docs/pregate.md, docs/ship-policy.md, docs/troubleshooting.md, docs/standalone-binaries.md and docs/flaky.md against lib/run-evidence.ts, lib/ship-receipt.ts, lib/ci-carry.ts, lib/headless-artifacts.ts, lib/result-codes-release.ts and bin/gstack-evidence.

Documentation health:

  • docs/ship-policy.md: current (the branch added the #ci-carry-rerun section)
  • docs/pregate.md: current (the branch added ci_carried rerun and attempts)
  • docs/troubleshooting.md: current (the branch added the #ci-carry-rerun-malformed anchor, which matches the result code)
  • docs/standalone-binaries.md: current
  • docs/flaky.md: current
  • changelog.d/ci-carry-marks-rerun-passes.md: reviewed and accurate; not edited, because this audit doesn't touch changelog files

Coverage debt: the CI_CARRIED: line from gstack-evidence carried and the run-clear receipt also print rerun=<n> attempts=<list>, and no doc mentions this for those two outputs. No diagrams to drift.

Review-loop exception: accepted by GStack Minder (GSTA-36) 2026-11-18 via approval a-5e5031c2e6b1: Grant: one scoped fix-check for #4473 at 37c9c4f. It covers the test-only type fix that CI's typecheck:test forced after round 2. The cap rises once, to $24, to cover finish, the receipt and the rule-16 cross-family trail read. If the grant can't open the round (GST-2968), stop and send me the exact refusal. The result-codes-release.ts deviation is fine. Note it in the PR's Agent notes. (fix-check at 37c9c4f, 0 findings)

Gate edits: none detected (6 listed, 0 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)

{
  "schema_version": 1,
  "pr": 4473,
  "head": "37c9c4fa82c20debe8310486c444c39491e62534",
  "version": "1.100.0.0",
  "base": "main",
  "gate": {
    "tests": {
      "pass": 1692,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "tests",
      "run": 44230473580,
      "attempt": 1,
      "tree": "924db779ab76a38055cc79150f31edaac3495c80"
    }
  ],
  "calls": 11,
  "session_kind": "unattended",
  "run": "gsta606-ship",
  "head_tree": "924db779ab76a38055cc79150f31edaac3495c80",
  "product_patch_id": "d301bfa4c70a2c4e4ad78a09ae1f39f3f621c255",
  "gstack_version": "1.100.0.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 102,
    "rules": "85446ac5884d68a3",
    "base": "237371474bda407ccd2344f696b9508c55006c2d",
    "registry": "237371474bda407ccd2344f696b9508c55006c2d",
    "gate_scan": {
      "tagged": 0,
      "head": "37c9c4fa82c20debe8310486c444c39491e62534"
    },
    "reasons": [
      "gate-class",
      "runtime=102"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @924db779ab76 (8 checks, current for 37c9c4fa82c2)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/44230473580/attempts/1",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44230473580/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/44230473665/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=924db779ab76 tests=37725 skipped=105 runs=44230473580/1 profiles=ci-reuse/free-tests heads=37c9c4fa82c2 verified=2026-11-18T03:33:26.438Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/ and README.md against the committed range 237371474bda..37c9c4fa82c2"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 2,
    "deferred": 0,
    "noted": 2,
    "fixed": 3,
    "scope": "frozen",
    "fix_checks": 1,
    "rounds": 3,
    "ledgers_read": 4,
    "unbound": 1,
    "dispatches": {
      "specialist": 6,
      "red-team": 2
    }
  },
  "review_loop_exception": {
    "accepted_by": "GStack Minder (GSTA-36)",
    "date": "2026-11-18",
    "via": "approval a-5e5031c2e6b1",
    "reason": "Grant: one scoped fix-check for #4473 at 37c9c4fa82c20debe8310486c444c39491e62534. It covers the test-only type fix that CI's typecheck:test forced after round 2. The cap rises once, to $24, to cover finish, the receipt and the rule-16 cross-family trail read. If the grant can't open the round (GST-2968), stop and send me the exact refusal. The result-codes-release.ts deviation is fine. Note it in the PR's Agent notes.",
    "fix_check": {
      "head": "37c9c4fa82c20debe8310486c444c39491e62534",
      "findings": 0
    }
  },
  "gate_dispositions": []
}

… of shown as clean passes (GST-3054)

When /ship reuses a CI run whose tree.json lists rerun_files, its CI line and summary line add rerun=<files> attempts=<list>. Runs without the fields print as before; malformed values refuse that run with CI_CARRY_RERUN_MALFORMED.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 4 commits November 18, 2026 03:09
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…en another check reuses the same run

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
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit 0a6bb42 into main Nov 18, 2026
58 checks passed
This was referenced Nov 18, 2026
capy-ai Bot added a commit that referenced this pull request Nov 18, 2026
- A test, or a scratch repository in the temp directory, can no longer write approval rows into your real Capy Drive (GST-3027). (#4466)
- An unattended /autoplan run on Claude Code no longer says the publication guard is off while it is on. (#4481)
- A phase report written only in reasoning now gets a denial that says so and names the fix. (#4481)
- `gstack-autoplan revise` no longer refuses a plan that the first `next` accepted. (#4470)
- `revise --plan` with a different file now says the run follows that file. (#4470)
- A second-model plan review in `/autoplan` is no longer reported as unavailable when it actually ran (GST-3051). (#4471)
- The /ship conductor trial plan now lets case reverts that conflict with later code be resolved by hand in docs, tests and the planted file, so large pull requests can be cases (GST-3003). (#4460)
- A locked plan for a trial of /ship without its separate conductor subagent (GST-3003). (#4456)
- A driven /ship now runs each phase as one command, counts its calls, and stops itself at 100 minutes. (#4451)
- /ship stops asking owners to clear two kinds of bookkeeping noise: base-side merge text and a reviewer's confirmation prose. (#4458)
- A base merge that only touched base-side text no longer stops `/ship` finish for an owner's grant. (#4458)
- A reviewer's confirmation prose no longer becomes a Critical finding that only an owner can clear. (#4458)
- A CI run that passed only after its failed jobs were re-run is now marked wherever gstack reuses it. (#4473)
- /ship reuses CI's passing test run when merging the base changed no file, and stops instead of quietly starting hour-long test runs or reviewing an empty diff (GST-3019). (#4461)
- /ship on Codex no longer stops at the test coverage audit. (#4489)
- A cold first-use check before an app build reaches its owner (GST-3025). (#4465)
- `skill_prefix=true` now survives updates when gbrain is installed. (#4454)
- The OpenClaw docs no longer send you to ClawHub, which held only April 2026 builds of office-hours, ceo-review and retro and no longer has gstack skills (the docs also said four skills while listing three). (#4454)
- `gstack-issue-links` no longer reads other repositories' issues as gstack's. (#4454)
- /ship's pre-gate finds the tests of a monorepo app that imports through its own `@/` alias. (#4464)
- /office-hours explains why it recommends a mode. (#4450)
- /office-hours keeps its 34 founder videos and essays out of the skill file. (#4463)
- Two `gstack-owner-answers add` runs for the same answer no longer collide. (#4490)
- A Captain can check an ask against the owner's earlier answers before sending it. (#4467)
- `gstack-post` stops reading /ship's own receipt identifiers as phone numbers, so posting a /ship PR body no longer needs a confirm. (#4488)
- GitHub release notes now list every change in plain words, with a link to its pull request. (#4390)
- gstack's router no longer gives bug reports a special rule, so the model fixes a bug the way it would without gstack. (#4442)
- /ship's review plan now sorts Swift and Xcode files by risk instead of sending every iOS PR to the full review panel (GST-3041). (#4469)
- /ship's review plan now sends Swift code that touches private user data to the full review panel (GST-3052). (#4472)
- A round grant at /ship's review round cap now buys the fix round it names, in the same run or the next (GST-2968). (#4479)
- The secrets check stops flagging three kinds of ordinary code as a secret, and catches two misses. (#4457)
- A security finding's location and reason no longer go into a PR body. (#4486)
- The token-capped /ship child on Claude Code now starts its prompt with the typed `/ship` command, so the skill actually loads. (#4487)
- A /ship receipt now counts the second-model review's blocking findings, and refuses to be written while one is still open. (#4485)
- A `/ship` with a token cap on Claude Code no longer stops at its first handoff. (#4452)
- /ship's push step now always ends with one line that says whether it pushed (GST-3053). (#4474)
- A PR's review-round count can no longer be overwritten by the body `/ship` posts. (#4440)
- One queued record with a malformed path no longer stops artifacts sync for every project. (#4455)
- A failed artifacts push stays reported until a push succeeds. (#4455)
- The /sync-gbrain memory row no longer says OK when pages failed to import. (#4455)
- ### Tests (#4495)
- A policy-floor test no longer fails once gstack's own version reaches the minor after the newest policy key; it now checks a floor above both, so the v1.101.0.0 release can pass CI. (#4495)
- CI now uploads free-suite test results to Trunk with analytics-uploader v2.1.8 and analytics-cli 0.17.0, up from v2.1.6 and 0.16.2. (#4453)
- Packing a checkout for a Ubicloud run no longer fails when git beside it is rewriting a ref. (#4447)
- The /plan-ceo-review HOLD SCOPE eval no longer fails a review because its follow-up question didn't repeat the mode name. (#4447)
- Unattended /autoplan now records the owner's relayed gate reply instead of refusing it. (#4484)
- Unattended /autoplan now runs the second-model review you turned on, and waits for it instead of ending the session. (#4459)
- Two /autoplan runs started in the same second no longer share a run id. (#4459)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
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.

1 participant