Skip to content

A land that waits on an earlier CI run decides on what that run did, and main's reuse skips cancelled runs (GST-3634) - #4763

Merged
capy-ai[bot] merged 2 commits into
mainfrom
land-ci-reuse-follow-ups
Nov 24, 2026
Merged

capy-ai[bot] merged 2 commits into
mainfrom
land-ci-reuse-follow-ups

Conversation

@garrytan

@garrytan garrytan commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

A land that waits on an earlier CI run now goes by that run's real result, and main's Free Tests run skips a cancelled run when it looks for a land's run.
Why: a green run rerun at the moment land picked it up could have its red result ignored, and a cancelled run made main rerun the whole suite.
Nothing to do.

What changed

This follows up #4760. Land used to decide whether to start a fresh run from the run list it read before waiting. If a green run was rerun at that moment and the rerun went red or ran past the wait, land threw the result away and dispatched again. Now it decides on what it saw while polling. A red rerun refuses as red, a slow one times out naming the run, and only a run that was already finished green and no longer proves the tree gets a fresh dispatch.

scripts/ci-tree-reuse.ts, which lets main's own Free Tests run reuse the run a land already did, now passes over cancelled runs on gstack-land/<pr>, as land does. In #4753's case, an older green run and a newer cancelled one, main now reuses the green run instead of running the suite again.

Blast radius

The change touches only runMergedCi's decision to fall through and one filter in findReuse. Every existing case in test/land-merged-ci.test.ts and test/ci-tree-reuse.test.ts still passes. A read-only probe with #4753's real runs still adopts green run 45249277829 with no dispatch.

Test Coverage

Tests first: bebcfc7 adds two cases that fail against main's code (a rerun that goes red or stays running, and a cancelled land run ahead of a green one). They pass with the fix, 48 in the two files.

Pre-Landing Review

The specialist pass found nothing. The adversarial pass found two low-severity notes, recorded below and not fixed.

Review notes

Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.

  • INFORMATIONAL scripts/ci-tree-reuse.ts:82 It's hard to reach. A green-and-provable A on the same tree means land wouldn't have started B, so you'd also need a passing verify failure (an api_error) when B was started. Land itself already skips cancelled runs, so nothing it already merges changes. FIXABLE: in both places, skip a cancelled run only when run_attempt === 1. | Severity: Low | Blocks: no
  • INFORMATIONAL scripts/ci-tree-reuse.ts:82 Finding 2: a cancelled run at the same head commit still blocks reuse, so the changelog promise doesn't always hold (scripts/ci-tree-reuse.ts:82 together with lib/run-evidence.ts:186,237). verifyRun counts any newer run at the same head commit that didn't end in success, skipped or neutral as a veto. A cancelled run counts. When the cancelled land run shares the older green run's head co
Exploratory QA

Pass. Probe 001: PR #4753's real runs still adopt green run 45249277829 through the real verifyRun, with no push or dispatch. Limits: the rerun race and the cancelled-run pick are covered by unit tests only.

TODOS

No TODO items completed in this PR.

Documentation

Status: current — no doc edits needed; docs already match the change.

Scope: committed diff 1cb381b..HEAD (lib/land-merged-ci.ts, scripts/ci-tree-reuse.ts, two tests, docs/pregate.md, changelog fragment); no staged, unstaged or new-file content.

Documentation health

  • docs/pregate.md — Current (updated in the diff): the stale-base reuse step now skips cancelled scratch-branch runs, matching scripts/ci-tree-reuse.ts.
  • docs/ship-policy.md — Current: land-direct already says the newest non-cancelled run decides and only a green run that no longer proves the tree leads to a fresh dispatch; the code now matches.
  • changelog.d/land-ci-reuse-follow-ups.md — Current (fragment, parent-owned).

Coverage debt: none new; CiResult.unproved is internal. Diagram drift: none in scope.

Tests
  • bun test test/land-merged-ci.test.ts test/ci-tree-reuse.test.ts: 48 pass, 0 fail (2 failed on main's code before the fix)
  • bun run typecheck and bun run typecheck:test: clean, no new diagnostics
  • test/troubleshooting-anchors.test.ts, test/module-size-ratchet.test.ts: 429 pass
  • Full free suite: CI on this head
Agent notes

Refs GST-3634. Fixes ruled note A on #4760 (lib/land-merged-ci.ts:77) and its cancelled-run note.

Approvals

No approvals recorded for branch land-ci-reuse-follow-ups.
Plan: exempt: bug fix (R65)
Plan check: exempt bug fix

REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=2 fixed=0 scope=frozen unbound=2 dispatches=1
Gate edits: none detected (GATE_SCAN tagged=0)

{
  "schema_version": 1,
  "pr": 4763,
  "head": "61f5654c766bf905d8cb4884a3d51d80ba5a8af1",
  "version": "1.103.0.0",
  "base": "main",
  "gate": {
    "free": {
      "pass": 1779,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "free",
      "run": 45301055159,
      "attempt": 1,
      "tree": "b3a461ad9fe38893bed3337d130b3607454b6871"
    }
  ],
  "calls": 11,
  "session_kind": "unattended",
  "run": "/home/user/.capy/work/gsta-831/ship2",
  "head_tree": "b3a461ad9fe38893bed3337d130b3607454b6871",
  "product_patch_id": "821bf20e3c81e44014f3ed48c06591e0993592e0",
  "gstack_version": "1.103.0.0",
  "review_depth": {
    "depth": "light",
    "class": "code",
    "runtime_lines": 16,
    "rules": "33831f8248a814fd",
    "base": "1cb381b048bd0024a0fb046e520674b5833f41dd",
    "registry": "1cb381b048bd0024a0fb046e520674b5833f41dd",
    "gate_scan": {
      "tagged": 0,
      "head": "61f5654c766bf905d8cb4884a3d51d80ba5a8af1"
    },
    "reasons": [
      "runtime=16"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "pass @b3a461ad9fe3 (8 checks, current for 61f5654c766b)",
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/, crew/docs/, README.md, CLAUDE.md, AGENTS.md"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 2,
    "fixed": 0,
    "scope": "frozen",
    "rounds": 1,
    "unbound": 2,
    "dispatches": {
      "specialist": 1
    }
  },
  "gate_dispositions": []
}
{"head":"61f5654c766bf905d8cb4884a3d51d80ba5a8af1","run":"ship","mark":"abandoned","by":"lane GSTA-831","reason":"#4760 shipped and merged; this run is finished"}

Open in Capy

garrytan and others added 2 commits November 24, 2026 00:55
…t actually ran

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…p cancelled runs

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

trunk-io Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

@capy-ai
capy-ai Bot merged commit 7c321ff into main Nov 24, 2026
54 checks passed
@garrytan garrytan mentioned this pull request Nov 24, 2026
capy-ai Bot added a commit that referenced this pull request Nov 24, 2026
- `/ship` now tells you what to change when GitHub refuses a push for email privacy. (#4748)
- The release gate's /cso check accepts the low-confidence hypotheses /cso now reports. (#4753)
- /cso reports every security finding the code supports instead of dropping most of them. (#4739)
- /cso can search the whole repository in one call, and a daily report now lists its low-confidence hypotheses. (#4742)
- A first version's plan and try-it message now open with the owner's own words, and the build is tried the same way he will try it before he is asked. (#4759)
- A first version's public export now keeps out the owner's short quotes and his reasons to leave something out, and a phone first-use check installs a build the cloud phone can actually run. (#4772)
- Three intermittent test failures are fixed. (#4745)
- Free Tests runs its shards on 8-core runners again. (#4749)
- A land that waits on an earlier CI run now decides on what that run actually did. (#4763)
- Landing a PR no longer starts a new CI run when one for the same merged code is already running or has passed. (#4760)
- /ship no longer misses a file-mode change from main on files whose names start with `:`. (#4774)
- make-pdf keeps quotes in alt text, link titles and raw HTML attributes inside the attribute, so a Markdown file can no longer add an `onerror`, `onload` or `javascript:` link that runs in the print browser. (#4761)
- Posting a PR body that lists earlier /ship runs no longer stops for a phone number that isn't there. (#4747)
- A first version's public export now catches a short owner quote whose padding or quote marks are encoded. (#4778)
- A first version's public export now also keeps out a short owner quote written with spaces just inside its quote marks. (#4776)
- Posting a PR body that lists earlier /ship runs no longer stops for a card number that isn't there. (#4751)
- /ship no longer asks for an extra reader when you merge the base branch next to code that was already reviewed. (#4754)
- /ship no longer plans narrow re-checks after a fix. (#4741)
- /ship can't quietly gain new refusals. (#4740)
- `gstack-upgrade` no longer refuses to run after you disable skills. (#4743)
- The free test suite splits its shards from this week's recorded test times. (#4744)
- gstack now writes up a failed or shelved attempt before closing it. (#4735)

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