Skip to content

A green CI run now counts for your branch when only main moved under it (GST-3567) - #4728

Merged
capy-ai[bot] merged 7 commits into
mainfrom
green-ci-run-counts-when-only-main-moved-gst-3567
Nov 23, 2026
Merged

capy-ai[bot] merged 7 commits into
mainfrom
green-ci-run-counts-when-only-main-moved-gst-3567

Conversation

@garrytan

@garrytan garrytan commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

/ship's final CI check (gstack-ship-release accept) now accepts a green pull request run that tested your branch merged onto a newer main, when main changed none of your lines.
Why: before, it refused that run and you had to merge main and rerun CI, which never settles on a busy repo (harness-evals #576, gstack #4722).
Nothing to do. Repos with a land step still re-check the merged tree; repos with land: null get no merged-tree check.

What changed

Details
  • onlyBaseMoved in lib/pregate/run-check.ts counts a pull request run for your head when GitHub's merge commit is a commit on main plus your pushed head, and your own added and removed lines in that merge are byte-identical to your head's at the same places. It uses ownLinesSame, the rule a base-only merge of a reviewed head already meets. Main may change other files, or other parts of your files, but none of your lines and none next to one.
  • When that merge used a main commit newer than your checkout's origin/main, the check fetches main once before it refuses.
  • Every check that reuses a CI run for a test command uses it: accept, gstack-evidence record-ci, gstack-ci-carry, and gstack-pregate's own reuse, --from-run and clear --run. Land's merged-tree CI (lib/land-merged-ci.ts) never does.
  • The accepted line adds base_moved=<main commit>. A refusal keeps its old line and adds a CARRY_DIAGNOSIS: line that says why.
  • Docs: docs/ship-policy.md#ci-carry-base-moved, docs/pregate.md#base-moved-carry, docs/troubleshooting.md and CONTRIBUTING.md.

Why

Details

GitHub tests a pull request by merging it onto main as main was when the run started. Once main moved past your fork point, that merge's tree was not your head's tree, so accept refused the run with tree_mismatch. The only way out was to merge main and run CI again, and on a busy repo main moves again before that run finishes.

Blast radius

Details

Only checks that reuse a CI run change, and they now accept one more case. Landing is unchanged: a repo with a land step checks the tree that lands with land.merged_ci, so a change that only passed on the older merge is still caught there. A repo whose land is null, such as harness-evals, gets no merged-tree check before landing, just as before this change.

Tests

Details

test/ship-accept-base-moved.test.ts rebuilds harness-evals #576's run 45058890128: a pull request run at the head that tested a merge with a newer main. accept takes the test result and its final check from that run, with nothing run locally. A main edit to another part of the branch's own file (gstack #4722's run 45089670503) still counts, and a main commit newer than the checkout's origin/main is fetched, then counts. These refuse: an edited merge, a main edit next to the branch's line, a merge of an earlier commit, a red run, a base commit not on main, and verifyRun without the opt-in, which is land's path. test/pregate-carry-gate.test.ts covers clear --run. On this PR's own final head, bin/gstack-ci-carry find from this branch counted pull request run 45104696756 with base_moved=dd1b610a3a52.

Issues

Refs #4722

Agent notes

Lane GSTA-817 for GStack Minder (GST-3567).

Documentation audit (Step 14.5, docs-a2-gsta817):

Status: updated. One factual fix in CONTRIBUTING.md; the branch's own docs already cover the change.

Scope: 12 committed files against base ccd80de (no staged, unstaged or new files): the rule that a green pull_request run carries when only main moved (GST-3567), CARRY_DIAGNOSIS: output and the base_moved= receipt field.

Documentation health:

  • docs/pregate.md: current (branch adds #base-moved-carry)
  • docs/ship-policy.md: current (branch adds #ci-carry-base-moved)
  • docs/troubleshooting.md: current
  • CONTRIBUTING.md: updated. The "Which command do I run?" CI carry row now says a branch behind main dispatches Free Tests only when CARRY_DIAGNOSIS: says its run does not count.
  • changelog.d fragment: reviewed, not edited (owned by the parent)

Coverage debt: none. The new behavior has a reference (pregate.md), an explanation (ship-policy.md) and a how-to (troubleshooting.md, CONTRIBUTING.md). Diagram drift: none.

Approvals

Approved: yes (record r-b3fa65954f9d). The full approval record stays private.
Plan: exempt: bug fix that blocks other crews; the brief needs no plan approval
Plan check: exempt bug fix

Ruled note: lib/run-evidence.ts:410:functional-contract at 6dd30ce ruled by GSTA-36 (relayed from GSTA-36:2026-11-23T03:03:35Z) at 2026-11-23T03:03:36.178Z: explicit --from-run takes the same base-moved rule as the lane carry, by design (approval a-7fa4ac613255)

Review notes (below the floor, not fixed): the flaky-exception clear path (lib/pregate/flaky-exception.ts:155) does not take the rule, so it refuses a base-moved run it could count; a refused run can cost extra git work; the base fetch writes no egress receipt and also runs under --simulate; and ", even after fetching it" also shows when the fetch failed or already ran in this process.

The final carry at 4d209f6 used workflow_dispatch run 45106024858 of the head's own tree, because the installed gstack (1.102.2.0) predates this fix and refused pull request run 45104696756 with tree_mismatch; this branch's code counts that same run.

{
  "schema_version": 1,
  "pr": 4728,
  "head": "4d209f637557bfa6534b36d3c58137fbab016810",
  "version": "1.102.2.0",
  "base": "main",
  "gate": {
    "test": {
      "pass": 1774,
      "fail": 0,
      "skip": 7
    }
  },
  "ci_carried": [
    {
      "lane": "test",
      "run": 45106024858,
      "attempt": 1,
      "tree": "40e673cce7256d179a3d91fc97411bb42e785ee2"
    }
  ],
  "calls": 40,
  "session_kind": "unattended",
  "run": "ship-20261123T022335-29e5a1",
  "head_tree": "40e673cce7256d179a3d91fc97411bb42e785ee2",
  "product_patch_id": "28d527fae494b0c09e829766a47dc2b897459bc2",
  "gstack_version": "1.102.2.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 138,
    "rules": "33831f8248a814fd",
    "base": "0408128f2fa5a11ffb5862e1fa05802a3708754c",
    "registry": "0408128f2fa5a11ffb5862e1fa05802a3708754c",
    "gate_scan": {
      "tagged": 0,
      "head": "4d209f637557bfa6534b36d3c58137fbab016810"
    },
    "reasons": [
      "gate-class",
      "runtime=138"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @40e673cce725 (8 checks, current for 4d209f637557)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/45106024858/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/45104696798/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=40e673cce725 tests=39228 skipped=72 runs=45106024858/1 profiles=ci-reuse/free-tests heads=4d209f637557 verified=2026-11-23T03:38:01.503Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [
      4722
    ],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "12 committed files against ccd80de8 (GST-3567 base-moved CI reuse); second audit docs-a2-gsta817 fixed one CONTRIBUTING.md row; first audit docs-a1-gsta817 was current"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 3,
    "deferred": 0,
    "noted": 7,
    "fixed": 3,
    "scope": "frozen",
    "fix_checks": 1,
    "rounds": 2,
    "dispatches": {
      "specialist": 4,
      "red-team": 2
    }
  },
  "review_round_grants": [
    {
      "kind": "fix-check",
      "head": "6dd30ced11a113edcfd9032e8a368bbd522a67ea",
      "pr": 4728,
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "round-2 second-model blocker fixed in e68e5f1; one scoped read confirms it.",
      "at": "2026-11-23T03:03:36.002Z",
      "approval": "a-e18e95cd2ad9",
      "stop_run": "ship-20261123T022335-29e5a1",
      "findings": [
        "p2/outside-voice#1",
        "p2/outside-voice#2"
      ]
    }
  ],
  "ruled_notes": [
    {
      "finding": "lib/run-evidence.ts:410:functional-contract",
      "head": "6dd30ced11a113edcfd9032e8a368bbd522a67ea",
      "by": "GSTA-36",
      "reason": "explicit --from-run takes the same base-moved rule as the lane carry, by design",
      "at": "2026-11-23T03:03:36.178Z",
      "approval": "a-7fa4ac613255",
      "relayed": "GSTA-36:2026-11-23T03:03:35Z"
    }
  ],
  "gate_dispositions": []
}
{"head":"6dd30ced11a113edcfd9032e8a368bbd522a67ea","run":"ship-20261123T022335-29e5a1","mark":"stop","tree":"0929c9b99c430a4f4cff68ad8de356a50d05ccfa","at":"2026-11-23T03:01:45.901Z"}

garrytan and others added 3 commits November 23, 2026 01:35
…ST-3567)

A pull_request run tests the branch merged onto main as main was when it started. When main had moved past the branch fork point, accept refused that run as tree_mismatch, so on a busy repo the lane merged main and reran CI without end. The run now counts for the head when its merge commit is the head merged onto a commit of the base and the pull request own changes in it are byte-identical to the head own diff. Lane carries and pregate clear --run take the rule through one helper (onlyBaseMoved); land merged-tree CI does not.

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

trunk-io Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 4 commits November 23, 2026 02:38
…two tests are tighter (GST-3567)

Exploratory check on #4722's real run 45089670503: comparing whole files refused it, because main and the branch both edited docs/pregate.md and docs/troubleshooting.md in different places. The rule now uses ownLinesSame, the same own-lines comparison a base-only merge of a reviewed head meets, and lives in lib/pregate/run-check.ts. The red-run test checks the exit status, and a new test drives clear --run through the forwarded rule.

Review-Finding: p1/specialist-batched#1 reader=testing
Review-Finding: lib/pregate/run-check.ts:70:functional-contract reader=qa
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…t has fetched (GST-3567)

Review-Finding: p2/outside-voice#1 reader=outside-voice
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…e check (GST-3567)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…nly when its run does not count (GST-3567)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot marked this pull request as ready for review November 23, 2026 03:40
@capy-ai
capy-ai Bot merged commit 261f380 into main Nov 23, 2026
85 of 86 checks passed
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