Skip to content

Pull requests that merged a release reuse their earlier test run when the release only regenerated a declared file (GST-3067) - #4483

Merged
capy-ai[bot] merged 2 commits into
mainfrom
reuse-test-run-after-release-regenerates-declared-file
Nov 19, 2026
Merged

capy-ai[bot] merged 2 commits into
mainfrom
reuse-test-run-after-release-regenerates-declared-file

Conversation

@garrytan

@garrytan garrytan commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

When a pull request merges a release whose only extra change is a generated file the repo lists under release_outputs, its earlier remote test run now counts for it, if the clear command gets --allow-repo-commands.
Why: gbrain paid one extra full CI run for each such pull request, several a day.
Without the flag nothing changes except that the refusal now says to pass it; a hand edit to the generated file, or any other changed file, is still refused.

Tests
  • The two changed test files: 10 pass, 0 fail on this branch; 5 pass, 5 fail on main.
  • CI free suite (run 44287738353) at 7abca34: green, 1696 test files.
  • Pre-merge guards (typecheck, module size, conflict markers) passed.
What changed

The five new tests fail on main and pass on this branch, because clear now accepts a regenerated release output when given --allow-repo-commands

The five new tests fail on main and pass on this branch, because clear now accepts a regenerated release output when given --allow-repo-commands. The text version of this picture is in the Agent notes.

A pull request that merged a release commit into its branch had its earlier remote test run refused, even though the only difference was a generated file the release tool rewrites. The clear command checked that file against the stamp_files list before the release-output rule, and it never reran the release tool the way the two-commit comparison already does. Now a release_outputs file is judged by the release-output rule. With --allow-repo-commands the clear reruns release_tool on the recorded head and accepts the file when it comes out byte for byte the same. The troubleshooting entry for the refusal now says when the tool reruns.

Why

"gbrain paid one extra full CI run for each such pull request, several a day" (gbrain#9679). After this, a release merge that only regenerated a declared file reuses the test run it already has.

Blast radius

The rule lives in the shared classifyFile, so the two-commit comparison, the merge-time recheck, the merge-batch verifier and review-depth sizing also let a release_outputs path past stamp_files. That is safe because such a file still counts as unchanged only for exact version rewrites or a byte-for-byte rerun of the base branch's own release tool on the recorded head. gstack's own policy also keeps its tests out of any such substitution through stamp_sensitive_gates (read in the shared classifier and in the clear command's substitution code, and walked by the four new clear tests).

Test Coverage

The clear path is covered by four new fixture tests and the two-commit comparison change by one. All five fail on main and pass here, as the picture above shows.
Tests: 1814 → 1814 (+0 new files; the branch adds 5 tests in one new and one extended file)
Coverage: 73% value-weighted (73% including 0 weakly covered paths)
Test value: 0 tests written, 0 rejected by the authoring gate, 0 existing tests extended, 0 paths weakly covered (weak = ★, gate-failing or unrated).
Gaps left as proposed tests: the --run clear and the CI reuse path passing --allow-repo-commands through, the "head is not a commit at the recorded tree" refusal, and an added release output with stamp_files set.
Tests ran: tests 1696 (files, reused from CI run 44287738353)

Pre-Landing Review

No blocking issues. The full review panel read the final reviewed tree once. It had a batched specialist reader (testing, security, state machines), a red-team reader, a native adversarial reader and a second-model review (GPT-6.1 Sol), which found nothing. Seven informational notes came back, and none is fixed in this PR because none would fail a test, break production or lose data:

  • No test covers the CI reuse path or the --run clear passing the flag through.
  • The "release_tool not rerun: head is not a commit at tree" refusal is untested.
  • The release_outputs exemption reaches every classifyFile caller, and the stamp_files descriptions in the ship-policy key reference and the remote-gate docs still call it the only list.
  • Accepted bytes can differ from the tested bytes in repos without stamp_sensitive_gates (gstack sets it).
  • The refusal names the missing flag before the head check, so following it can hit a second refusal.
  • A killed clear can leave a stale temporary worktree from the release-tool rerun.

Paths and line numbers for each note are in the Agent notes.

Exploratory QA

Functional (CLI) smoke, one probe: the two changed test files run against throwaway fixture repos (capture 001) and pass, 10 of 10. Not probed: the head-not-at-tree refusal, the --run clear and the CI reuse path.

Eval Results

No prompt-related files changed — evals skipped.

Review bot comments

No review bot comments.

Plan Completion

No plan file. This is a bug fix (plan exempt), so plan completion was not audited.

TODOS

No TODO items completed in this PR.

Documentation

Status: updated. The documentation audit covered docs/, README.md, AGENTS.md and CONTRIBUTING.md and made one factual edit to the troubleshooting page, which now says when the clear command reruns the release tool and that it needs --allow-repo-commands. No blockers. The audit's full section is in the Agent notes.

Agent notes
  • classifyFile (lib/tree-receipt.ts) judges a release_outputs path by the release-output rule instead of refusing it through the stamp_files allowlist first. It is still a stamp only if its hunks are version rewrites or release_tool regenerates it byte for byte.
  • The GST-1176 regenerate step moved out of buildReceipt into one helper, regenerateReleaseOutputs, which the tree receipt and gstack-pregate clear both call; the added-file case no longer requires a stamp_files match either.
  • clear --receipt (and the --run / --from-run substitutions, which share treeSubstitution) rerun the tool only under --allow-repo-commands, and only on pregate.json's head when that commit's tree is the recorded tree; otherwise the residual says why.
  • GSTA-610 for GStack Minder (GSTA-36), GST-3067, from GBRA-108 / gbrain#9679. Decision trail: reports/GSTA-610-decisions.tsv in the Captain drive.

Refs GST-3067

Documentation audit (verbatim)

Status: updated. One factual edit to docs/troubleshooting.md. No blockers.

Scope: base 44170d6 to head 9092086, 9 committed files and nothing staged, unstaged or untracked. The change: gstack-pregate clear (with --receipt, --run or the CI carry) now treats a regenerated release_outputs file as a stamp under rule release_tool when the file is in release_outputs and rerunning release_tool with --allow-repo-commands writes it byte for byte. The tree receipt now lets release_outputs paths through even when they aren't in stamp_files.

Documentation health:

  • docs/pregate.md: current (updated on the branch; describes the rule, the flag and the release_tool rule name)
  • docs/ship-policy.md: current (updated on the branch; covers the stamp_files exception and pregate clear)
  • docs/troubleshooting.md: updated (the PREGATE_RECEIPT_INVALID entry now lists release_outputs and the --allow-repo-commands refusal)
  • changelog.d/pregate-clear-accepts-regenerated-release-outputs.md: current
  • README.md, AGENTS.md, CONTRIBUTING.md: current (no change to the public surface they cover)

Coverage debt: none new. The behavior has reference coverage in pregate.md and ship-policy.md and a fix path in troubleshooting.md. The gate-ahead example in pregate.md doesn't show the --allow-repo-commands variant (minor how-to gap). No diagrams were affected.

Test commands

  • bun test test/pregate-remote-release-output.test.ts test/tree-receipt-release-tool.test.ts: 10 pass, 0 fail (head); 5 pass, 5 fail (main)
  • gstack-pregate guards: typecheck, module-size, conflict-markers passed

Review notes

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

  • INFORMATIONAL lib/tree-receipt.ts:148 A remote gate receipt can clear a head whose regenerated release output differs from the tested tree; repos without stamp_sensitive_gates get the GST-1176 rule (gstack sets it, so unaffected).
  • INFORMATIONAL lib/tree-receipt.ts:108 The release_outputs allowlist exemption reaches review-depth sizing (stampPathsSince); undocumented in changelog/docs.
  • INFORMATIONAL lib/pregate/remote-receipt.ts:110 notRerun checks the missing flag before the head-commit check, so following the hint can hit a second refusal.
  • INFORMATIONAL lib/pregate/index.ts:131 release_tool rerun can leave a stale git worktree under tmp if gstack-pregate is SIGKILLed mid-run.

Informational notes with paths: lib/pregate/index.ts:131 (CI reuse and --run flag threading untested), lib/pregate/remote-receipt.ts:110 (head-not-at-tree refusal untested), lib/tree-receipt.ts:108 with lib/ship-policy.ts:224 and docs/pregate.md:639 (stamp_files described as the only stamp list).

Before/after as text: The five new tests fail on main and pass on this branch: clear now accepts a regenerated release output only with --allow-repo-commands
--- Before · before.txt · captured output
+++ After · after.txt · captured output
+(pass) clear --receipt over a merged release commit that regenerated a declared release output (GST-3067) > with --allow-repo-commands the regenerated release o
+(pass) clear --receipt over a merged release commit that regenerated a declared release output (GST-3067) > without --allow-repo-commands the same merge is refu
+(pass) clear --receipt over a merged release commit that regenerated a declared release output (GST-3067) > a row the PR added to the generated file by hand, wh
+(pass) clear --receipt over a merged release commit that regenerated a declared release output (GST-3067) > a path outside release_outputs is still refused by t
 (pass) tree receipt: a release output release_tool regenerates (GST-1176) > a rendered release output is a stamp when release_tool reruns to the same bytes, and
 (pass) tree receipt: a release output release_tool regenerates (GST-1176) > a release output the tool would not write stays changed, with the regeneration named
 (pass) tree receipt: a release output release_tool regenerates (GST-1176) > a release output the tool adds for the first time is a stamp when the rerun writes t
+(pass) tree receipt: a release output release_tool regenerates (GST-1176) > with stamp_files set, a release output outside it is judged by the release-output ru
+(pass) tree receipt: a release output release_tool regenerates (GST-1176) > a release_tool that fails leaves the release output changed, with its exit named [16
-(fail) tree receipt: a release output release_tool regenerates (GST-1176) > with stamp_files set, a release output outside it is judged by the release-output ru
-(pass) tree receipt: a release output release_tool regenerates (GST-1176) > a release_tool that fails leaves the release output changed, with its exit named [17
 (pass) tree receipt: a release output release_tool regenerates (GST-1176) > a stamped train prefix over the merge passes stampMismatch only when the train runs 
+ 10 pass
+ 0 fail
+Ran 10 tests across 2 files. [21.82s]
-(fail) clear --receipt over a merged release commit that regenerated a declared release output (GST-3067) > with --allow-repo-commands the regenerated release o
-(fail) clear --receipt over a merged release commit that regenerated a declared release output (GST-3067) > without --allow-repo-commands the same merge is refu
-(fail) clear --receipt over a merged release commit that regenerated a declared release output (GST-3067) > a row the PR added to the generated file by hand, wh
-(fail) clear --receipt over a merged release commit that regenerated a declared release output (GST-3067) > a path outside release_outputs is still refused by t
- 5 pass
- 5 fail
-Ran 10 tests across 2 files. [21.99s]
 

Approvals

No approvals recorded for branch reuse-test-run-after-release-regenerates-declared-file.
Plan: exempt: bug fix (bug fixes skip plan review; covered by failing-first tests in test/pregate-remote-release-output.test.ts)
Plan check: exempt bug fix

REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=0 fixed=0 scope=frozen ledgers_read=3 dispatches=2 est_input_tokens=20368
Gate edits: none detected (2 listed, 0 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)
Outside review: completed (second-model review, openai/gpt-6.1-sol): VERDICT: CLEAN

{
  "schema_version": 1,
  "pr": 4483,
  "head": "7abca341ccd5b67d569746b5e0ab50e16fed6bdd",
  "version": "1.100.0.0",
  "base": "main",
  "gate": {
    "tests": {
      "pass": 1696,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "tests",
      "run": 44287738353,
      "attempt": 1,
      "tree": "5ce1ba3798e31b1f2b2bdfdfa046ecc3ff10235f"
    }
  ],
  "calls": 19,
  "session_kind": "unattended",
  "run": "ship-4483-9092086",
  "head_tree": "5ce1ba3798e31b1f2b2bdfdfa046ecc3ff10235f",
  "product_patch_id": "99734fa695a18a51077eae7dd9f0413fd8c65964",
  "gstack_version": "1.100.0.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 84,
    "rules": "1afa38a4be3b5eef",
    "base": "44170d67916dc80a008803f7b3f7cbf7dbe32ea7",
    "registry": "44170d67916dc80a008803f7b3f7cbf7dbe32ea7",
    "gate_scan": {
      "tagged": 0,
      "head": "7abca341ccd5b67d569746b5e0ab50e16fed6bdd"
    },
    "reasons": [
      "gate-class",
      "runtime=84"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @5ce1ba3798e3 (8 checks, current for 7abca341ccd5)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44287738353/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/44287744434/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=5ce1ba3798e3 tests=37815 skipped=71 runs=44287738353/1 profiles=ci-reuse/free-tests heads=7abca341ccd5 verified=2026-11-18T10:52:11.990Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "docs/, README.md, AGENTS.md, CONTRIBUTING.md (152 docs hashed); one factual edit to docs/troubleshooting.md"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 0,
    "fixed": 0,
    "scope": "frozen",
    "rounds": 1,
    "est_input_tokens": 20368,
    "ledgers_read": 3,
    "dispatches": {
      "specialist-batched": 1,
      "red-team": 1
    }
  },
  "gate_dispositions": []
}

Open in Capy

… the release only regenerated a declared file (GST-3067)

A file the repo lists under release_outputs is judged by the release-output rule, and the clear command reruns the release tool under --allow-repo-commands through the same helper as the tree comparison.

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.

…GST-3067)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit 12bd33b into main Nov 19, 2026
58 checks passed
@garrytan garrytan mentioned this pull request Nov 19, 2026
capy-ai Bot added a commit that referenced this pull request Nov 19, 2026
- `gstack-artifact validate` no longer passes a run.json that gstack-autoplan never wrote. (#4494)
- /ship's changed-number check no longer stops on tests that only share a word with the change (#4478). (#4496)
- On Capy, /ship no longer edits or comments on pull requests as you. (#4518)
- The destructive-command check stops asking about scratch deletes and catches the real damage it used to miss. (#4513)
- The destructive-command check reads commands more carefully, closing gaps found after the last release. (#4525)
- The Codex readiness check and the second-model review now pick the same model for a custom Codex provider (GST-3089). (#4491)
- gstack's Codex hooks work when your Codex folder's path has a `(`, `&` or other shell character in it. (#4528)
- Uninstalling gstack keeps your own Codex hooks trusted. (#4528)
- Codex hook setup matches Codex more closely. (#4528)
- On Windows, setup copies the Claude Code hook code that gstack's Codex hooks import (#4528)
- /review's checklist on Codex reads shell commands more carefully. (#4528)
- On Codex, gstack now suggests the right skill for a prompt and stops destructive commands before they run. (#4512)
- On Codex, /review is now held once when it tries to finish without its adversarial pass or its report, as it already is on Claude Code. (#4522)
- On Codex, gstack's skill suggestion now names the skill the way Codex lists it. (#4523)
- On Codex, gstack's suggested prompts and docs now name skills the way Codex lists them. (#4524)
- /review on Codex with gpt-6.1-sol is no longer held back for a second-model pass it already ran. (#4526)
- On Codex, office-hours, plan-design-review and gstack-upgrade work again when you name them. (#4510)
- gstack knows when Codex is running unattended. (#4510)
- Codex reviewers start with a clean context. (#4510)
- Docs no longer say Codex has no hook support. (#4510)
- A command whose output was cut off no longer counts as a finished read. (#4492)
- A folder marked as published data can no longer hide source code or agent files from /ship's review. (#4516)
- Correction to the on-by-default helper hooks entry: the hook still routes only to /review, /qa and /verify, so skills you've installed yourself aren't suggested yet. With gstack's skills it routes 14 of 60 real bug reports (was 17), and long prompts are no longer skipped. (#4505)
- /sync-gbrain's read check now works when the first page in your code source is over 64 KB. (#4497)
- Free-suite CI no longer fails before any test runs when Ubuntu's package mirror is slow. (#4530)
- Syncing a second repo no longer makes the first one ask for /sync-gbrain again. (#4532)
- gstack's helper hooks are now on by default in Claude Code, OpenClaw and Hermes, and the prompt-routing hook fires on real bug reports. (#4503)
- `gstack-pregate clear --receipt` accepts a remote gate run from before a merged release when the release only regenerated a declared release output. (#4483)
- The second-model review now keeps the reviewer's own result, and reports a used-up budget as a budget stop. (#4515)
- When the reviewer wrote its review to the result file it was asked for, Codex then replaced that file with its short closing message ("Done, I wrote the review"), so the review was thrown away and reported as missing its markers. (#4515)
- When the provider refuses the call with HTTP 402 Payment Required (usually a metering proxy that hit its allowance, or an account out of credits or quota), gstack used to record only "exit 1". (#4515)
- The pre-commit /verify check now fails a check that times out, and its checks share one time budget (GST-3201). (#4527)
- /ship's review collector no longer reads a reviewer's own scope list or list of passed checks as findings (GST-3201). (#4527)
- Merge-queue stack tests fail when git cannot list a PR's added test files (GST-3201). (#4527)
- /ship can now review results PRs that publish raw session data. (#4511)
- /ship's review pass works when the checkout you ship isn't the project's default checkout. (#4507)
- A second review round no longer reports done when nothing was reviewed. (#4520)
- The prompt-routing hook now suggests skills you install yourself, and no longer sends ordinary bug reports to /qa (GST-3123). (#4506)
- gstack's script runner and merge-queue checks now also refuse cut-off output. (#4502)
- A failed second-model review reports the cause that actually stopped it, and the runner never deletes its own prompt. (#4519)
- `gstack-ship-queue ready` now fills in the trial merges and the second-model trail read instead of printing lines to fill. (#4529)
- Five small ship-tool fixes. (#4529)
- A ruling the owner gives while a `/ship` run is open can be relayed. (#4529)
- /ship no longer kills a working test run as stalled when the test command starts its workers in their own session. (#4533)
- /ship no longer stops a review because the state-machine reader started its reply the way its instructions say. (#4504)
- When Claude Code runs /verify right before a commit, it now gets a quick check instead of the full fix loop (GST-3150). (#4508)

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