Skip to content

A stopped or crashed /ship run no longer blocks the next run or its granted fix round (GST-3260) - #4654

Merged
capy-ai[bot] merged 5 commits into
mainfrom
ship-run-record-replaces-stale-marker
Nov 22, 2026
Merged

capy-ai[bot] merged 5 commits into
mainfrom
ship-run-record-replaces-stale-marker

Conversation

@garrytan

@garrytan garrytan commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

A /ship run that stopped or crashed no longer blocks the next run or the fix round it stopped for, and a run that is still working past two hours stays protected.
Why: a leftover "run in progress" note blocked fix-round grants on four PRs, and the old 2-hour timer could mark a live run as finished.
Nothing for readers to do; a run that really died is ended with gstack-ship-run abandon.

What changed
  • The bare .git/gstack-ship-run note becomes a small record with a state (open, stopped, finished, abandoned) that only gstack's own commands change, under a lock, as a compare-and-swap. A record that can't be read blocks, as before.
  • Preflight, stop, claim, finish and gstack-skill-end move it through those states, and review logging refreshes its heartbeat, with or without a token cap. Liveness no longer reads the 120-minute lease file (the lease stays for the upgrade guard).
  • A stopped run may record only the fix-round grant for its own stop, once per run. Extra rounds, a second fix round, --not-security rulings and test exceptions stay refused until the run has finished or been abandoned. Relayed rulings (--owner-ref) still work.
  • A preflight with no --run stops on a stopped record instead of merging the base under it.
  • New gstack-ship-run status and abandon (refused within 60 minutes of the last heartbeat; an unreadable record is ended by its file digest; abandon also leaves an entry in the PR body).
  • A stop raised after a follow-up check or a second-model review now records its stop instead of failing to bind (seen on Eval plans now pilot every arm, check the judge per arm, state their cost and take one planned look above 500 dollars (GST-3218) #4591).
  • Review-round history counts a run id reused at different heads as separate rounds (seen on gstack-evals#406); preflight refuses a run id that already finished.
Behavior changes
  • lib/ship-preflight.ts, lib/gate-dispositions.ts: a run parked before finish used to stop counting after 120 minutes; now it counts until it is stopped, finished or abandoned.
  • bin/gstack-approvals: a stopped run's checkout can record the fix-round grant for its own stop (previously refused); every refusal names the state, heartbeat age and the abandon command.
  • lib/pr-review-history.ts: entries sharing a run id at different heads each count as a round.
Why

A run that stopped or died left a note that blocked the very grant its stop asked for, and the 2-hour lease could be pruned by another run while the first was still working, so preflight could merge the base under live reviewers. This gives every /ship run one record with a plain state, so nothing ends a run except gstack's own commands.

Blast radius

/ship preflight, gstack-approvals round grants, rulings and test-coverage exceptions, gate dispositions, gstack-ship-receipt stop, claim and history, finish, and gstack-skill-end. A run parked before finish used to stop counting after 120 minutes; now it counts until it is stopped, finished or abandoned. The upgrade guard's lease file is unchanged.

Pre-Landing Review

Two full review rounds (gate-class panel: specialists, red team, second-model native and outside reviews, targeted reader), one fix round, no blocker. Round 1 fixed five informational findings (a stopped run granting itself repeated fix rounds, two untested transitions, a preflight with no run id merging under a stopped record, and heartbeats dropped under a token cap); two were left as notes. Round 2 and the second-model reviews found nothing at the blocking floor; their notes are listed below and are not fixed in this PR.

  • Note: when the claim write itself fails, the once-per-run limit is not enforced on that run (the PR-body grant marker still stops a grant being spent twice).
  • Note: a grant relayed from a maintainer also uses up the run's own fix round, and the refusal names it as the run's own.
  • Note: a run can record more than one self-grant for the same stop before it claims one.
  • Note: the stop message a preflight with no run id prints for a stopped record still says to let that run finish.
  • Note: review logging from any session on the checkout refreshes the run's heartbeat.
  • INFORMATIONAL security finding, details recorded privately (2 such notes).

Exploratory QA: 5 functional probes of gstack-ship-run status and abandon, pass, rerun after the fix.

Documentation

Status: updated. The audit made two factual terminology fixes and found no blockers.

Scope: branch ship-run-record-replaces-stale-marker against base dd61103, using candidate docs2-pre.json (head dca87ed, 28 selected files, plus unstaged edits to docs/review-policy.md, docs/ship-policy.md and docs/troubleshooting.md). Authored .md and .tmpl docs were searched for references to the old run marker and the 120-minute lease.

Documentation health:

  • docs/ship-policy.md: Updated. The rule and test-coverage exception guards now say they read the run record, not the old marker, and link to the what-ends-a-run section.
  • docs/review-policy.md: Current. The stopped run's own follow-up grant (once per run) matches bin/gstack-approvals.
  • docs/troubleshooting.md: Current. The preflight-run-open, gate, STOP_UNBOUND, SHIP_RUN_ABANDON_REFUSED and SHIP_RUN_RECORD_UNREADABLE entries match the code.
  • docs/capy-install.md: Current. Its 120-minute text describes the separate workflow lease.

Debt: no coverage gaps or diagram drift found. No generated output needs regenerating.

Tests
  • Targeted tests (test/ship-run-record, ship-preflight, pr-review-history, round-cap-granted-stop, ship-gate-dispositions): 113 pass, 0 fail
  • bun run test: carried from CI run 44977756783 at this tree (38736 tests)
  • bun run typecheck: clean

Tests ran: targeted 113
Tests ran: test 38736

Issues

Refs #4591

Agent notes

Agent notes

  • Plan: handoffs/GST-3260/plan-v2.md, approved by Garry 2026-11-21 ("Do it"), autoplan run run-ovthvh-20261121061438. PR 1 of 3 stacked (PR 2 fix-check clearing builds on this record; PR 4 /ship can finish again when a docs check ran before a base merge (GST-3260) #4648 is independent).
  • Failing-first: test/ship-run-record.test.ts was 0 pass / 14 fail on main; 17 pass here.
  • No reviewer prompt, packet or depth change.
  • Coverage audit: 17 of 20 traced paths tested (85%), audit-only.

REVIEW_LOOP: passes=2 blocking_found=0 deferred=0 noted=7 fixed=5 scope=frozen ledgers_read=4 dispatches=4 est_input_tokens=74722
Gate edits: none detected (13 listed, 10 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)

Approvals

Approved: yes (record r-43e48e297893). The full approval record stays private.
Plan: approved (record r-8e2f1973faf3)
Plan check: approved (record r-8e2f1973faf3)

{
  "schema_version": 1,
  "pr": 4654,
  "head": "c4a6af16372d19bb9adbe2af34518be6f908392e",
  "version": "1.102.2.0",
  "base": "main",
  "gate": {
    "targeted": {
      "pass": 113,
      "fail": 0,
      "skip": 0
    },
    "test": {
      "pass": 38736,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "test",
      "run": 44977756783,
      "attempt": 1,
      "tree": "460faffb2c6438ed57cdbd2a501b7a2e16d54f55"
    }
  ],
  "calls": 38,
  "session_kind": "unattended",
  "run": "ship-4654-fc31ab3",
  "head_tree": "460faffb2c6438ed57cdbd2a501b7a2e16d54f55",
  "product_patch_id": "222c17d04575402c1d1a7cde70cbccd619e01760",
  "gstack_version": "1.102.2.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 549,
    "rules": "85b3923b1a978e41",
    "base": "abdc09dad16a4c15070cc7ba0b863409992d49d1",
    "registry": "abdc09dad16a4c15070cc7ba0b863409992d49d1",
    "gate_scan": {
      "tagged": 3,
      "head": "c4a6af16372d19bb9adbe2af34518be6f908392e"
    },
    "reasons": [
      "gate-class",
      "risk:money",
      "risk:secret",
      "risk:security",
      "runtime=549"
    ],
    "risk": [
      "money",
      "secret",
      "security"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @460faffb2c64 (8 checks, current for c4a6af16372d)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/44977756783/attempts/1",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44977756783/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/44977249343/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=460faffb2c64 tests=38736 skipped=105 runs=44977756783/1 profiles=ci-reuse/free-tests heads=c4a6af16372d verified=2026-11-22T02:54:32.715Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [
      4591
    ],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "docs/, README.md, AGENTS.md (run record, run marker and lease references)"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 7,
    "fixed": 5,
    "scope": "frozen",
    "rounds": 2,
    "est_input_tokens": 74722,
    "ledgers_read": 4,
    "dispatches": {
      "specialist-batched": 2,
      "red-team": 2
    }
  },
  "gate_dispositions": [],
  "review_targeted": {
    "classes": [
      "money",
      "gate",
      "secret"
    ],
    "rules": "b3f6f8b4843c0c30",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "222c17d04575402c1d1a7cde70cbccd619e01760",
    "status": "done",
    "findings": 2,
    "raised_by": "targeted"
  }
}

Open in Capy

garrytan and others added 2 commits November 22, 2026 00:39
…nd a live run past two hours stays open (GST-3260)

The bare run marker becomes a run record whose state only gstack commands change; gstack-ship-run status and abandon end a run that stopped working. Stops bind to the head their last reading row read (#4591), and a reused run id counts once per head (gstack-evals#406).

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ip run record (GST-3260)

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

trunk-io Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 3 commits November 22, 2026 02:15
…nder a token cap refreshes the run's heartbeat (GST-3260)

Review-Finding: p1/specialist-batched#1 reader=security
Review-Finding: p1/specialist-batched#2 reader=testing
Review-Finding: p1/specialist-batched#3 reader=state-machines
Review-Finding: p1/specialist-batched#4 reader=state-machines
Review-Finding: lib/ship-run-record.ts:167:correctness reader=core
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ound (GST-3260)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…r a /ship run is open (GST-3260)

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