Skip to content

v1.91.364.0 fix: pregate --policy-from head only adds lanes, and timeout_s reaches preflight and finish (GST-419, GST-420) - #3676

Merged
capy-ai[bot] merged 6 commits into
mainfrom
gsta195-pregate-head-timeout
Oct 31, 2026
Merged

capy-ai[bot] merged 6 commits into
mainfrom
gsta195-pregate-head-timeout

Conversation

@garrytan

@garrytan garrytan commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3676,
  "head": "aab795ec2d0bf9bb147b134e5d6c0c4c982ce4a7",
  "version": "1.91.357.0",
  "base": "main",
  "gate": {
    "focused": {
      "pass": 636,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "head_tree": "98775fb40f69a346907c6c7a29e80c9526f4322c",
  "product_patch_id": "452dea0ca180efb5f4e1d6e0964746e4fe6985e5",
  "gstack_version": "1.91.356.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 221,
    "rules": "1ef4ba88e39e688c",
    "base": "89f203300498596cfcee37017f9966af9b0ebc3a",
    "registry": "89f203300498596cfcee37017f9966af9b0ebc3a",
    "gate_scan": {
      "tagged": 0,
      "head": "aab795ec2d0bf9bb147b134e5d6c0c4c982ce4a7"
    },
    "reasons": [
      "gate-class",
      "runtime=221>50"
    ]
  },
  "pregate": "requires-remote cleared @98775fb40f69 (1 checks, current for aab795ec2d0b)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/41190722578/job/124506797360",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/41190722578/job/124506797282",
    "windows-free-tests.yml/windows-free-shard: https://github.com/garrytan/gstack/actions/runs/41190722520",
    "pregate.json/remote_gate: remote-gate tree=98775fb40f69 tests=24302"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "docs/, README.md, AGENTS.md, CLAUDE.md, CONTRIBUTING.md"
  },
  "review_loop": {
    "passes": 4,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 5,
    "fixed": 2,
    "scope": "frozen",
    "fix_checks": 1,
    "dispatches": {
      "specialist": 6,
      "red-team": 2
    }
  }
}

What changed

The new GST-419/GST-420 tests fail on main and pass on this branch

The new GST-419 and GST-420 tests fail on main and pass on this branch: a head policy may only add lanes, preflight forwards --policy-from head, and timeout_s reaches pregate.

Before/after as text: The new GST-419/GST-420 tests fail on main and pass on this branch: a head policy may only add lanes, preflight forwards --policy-from head, and timeout_s reaches pregate.
--- Before · before.txt · captured output
+++ After · after.txt · captured output
+$ bun test test/pregate-head-policy.test.ts test/ship-preflight.test.ts   # this branch
+(pass) gstack-ship-preflight Step 5 pregate: head policy and timeout_s (GST-419, GST-420) > --policy-from head reaches pregate: the branch lane counts, and without the flag PREGATE_DETAIL names the missing lane
+(pass) gstack-ship-preflight Step 5 pregate: head policy and timeout_s (GST-419, GST-420) > --policy-from head with a head policy that removes a lane stops with PREGATE_HEAD_POLICY_LOOSENS
+(pass) gstack-ship-preflight Step 5 pregate: head policy and timeout_s (GST-419, GST-420) > timeout_s from the base policy bounds Step 5 pregate and PREGATE_DETAIL names it
+(pass) gstack-pregate --policy-from head: additive only (GST-419) > a head policy that only adds a lane gates the touched file; the base policy still reports no lane
+(pass) gstack-pregate --policy-from head: additive only (GST-419) > a head policy that removes a lane is refused
+(pass) gstack-pregate --policy-from head: additive only (GST-419) > a head policy that swaps a lane for another test is refused
+(pass) gstack-pregate --policy-from head: additive only (GST-419) > a head policy that adds a [] declaration is refused
+(pass) gstack-pregate --policy-from head: additive only (GST-419) > a head policy that changes the runner is refused
+(pass) gstack-pregate --policy-from head: additive only (GST-419) > a head policy that downgrades a check is refused
+(pass) gstack-pregate --policy-from head: additive only (GST-419) > a head policy that allowlists a finding is refused
+(pass) gstack-pregate --policy-from head: additive only (GST-419) > a head policy that deletes the file is refused
-$ bun test test/pregate-head-policy.test.ts test/ship-preflight.test.ts   # on main (047dad7) with the new tests
-(fail) gstack-pregate --policy-from head: additive only (GST-419) > a head policy that only adds a lane gates the touched file; the base policy still reports no lane
-(fail) gstack-pregate --policy-from head: additive only (GST-419) > a head policy that removes a lane is refused
-(fail) gstack-pregate --policy-from head: additive only (GST-419) > a head policy that swaps a lane for another test is refused
-(fail) gstack-pregate --policy-from head: additive only (GST-419) > a head policy that adds a [] declaration is refused
-(fail) gstack-pregate --policy-from head: additive only (GST-419) > a head policy that changes the runner is refused
-(fail) gstack-pregate --policy-from head: additive only (GST-419) > a head policy that downgrades a check is refused
-(fail) gstack-pregate --policy-from head: additive only (GST-419) > a head policy that allowlists a finding is refused
-(fail) gstack-pregate --policy-from head: additive only (GST-419) > a head policy that deletes the file is refused
 (pass) gstack-pregate --policy-from head: additive only (GST-419) > reordering lists and adding a test to an existing lane is additive
+(pass) gstack-pregate --policy-from head: additive only (GST-419) > a stale branch keeps the lanes the base added after it forked
+(pass) gstack-pregate --policy-from head: additive only (GST-419) > with no base copy, a head policy that drops the user-owned guard is refused; one that adds a lane runs
-(fail) gstack-pregate --policy-from head: additive only (GST-419) > a stale branch keeps the lanes the base added after it forked
-(fail) gstack-pregate --policy-from head: additive only (GST-419) > with no base copy, a head policy that drops the user-owned guard is refused; one that adds a lane runs
-(pass) gstack-pregate --policy-from head: additive only (GST-419) > with no base copy and no user-owned file, a head policy is a bootstrap and runs as written
-(fail) timeout_s in the base policy (GST-420) > timeout_s bounds each runner process when --timeout is absent, and --timeout still overrides it
-(pass) timeout_s in the base policy (GST-420) > timeout_s 0 is invalid
 

Why

GEVA-2 (gstack-evals#93) added its own pregate lane, but "preflight could not pass --policy-from head", so Step 5 stopped with PREGATE_NO_LANE and the lane ran its tests by hand (GST-419). HARN-1 (HARN-12) had lanes of about 780 s while preflight and finish ran pregate at its 600 s default, so every run ended PREGATE: incomplete (GST-420). Now preflight forwards --policy-from head, a head policy may only add test lanes, and the repo sets the per-process timeout with timeout_s in .gstack/pregate.json.

Blast radius

This touches every gstack-pregate run that reads a policy. The new timeout_s key is optional, and without it the timeout stays at 600 s (lib/pregate/context.ts, covered by the timeout_s tests). The head-policy comparison runs only under --policy-from head, so base-policy runs, which is every train and CI run, take the same path as before (script ran: the 636-test focused lane and the remote free tier on this tree).

Approvals

Date Asked Exact words Outcome Covers Still pending
2026-10-31 Approve the plan "GST-422: four /ship tooling fixes (pregate timeout, head policy, cache fingerprint, prose check)" (autoplan run autoplan-20261031081834, 2 decisions) “Answer autoplan-20261031081834 gate_rev 1: rec (A1 B1 C1 D1 E1), as my call under the fix-lane exemption; it doesn't go to Garry. Adding the additive-only head rule closes a real hole, so keep it. For C1, update the Dart workaround doc and test:572 and list it under Behavior cha…” (GStack Minder, relayed by agent:jam_01M68GAJ8YTNF4HD696KC1TQR3) approved the reviewed plan (sha256 fa78b114978f), every recommendation taken none

Source: gstack-approvals record for gsta195-pregate-head-timeout (display only; not an approval citation).

Summary

Parent issue GST-422. GST-419 (from GEVA-2, gstack-evals#93) and GST-420 (from HARN-1, HARN-12).

  • A head policy can only add lanes. Under --policy-from head, .gstack/pregate.json on the branch is compared with the trusted policy (the base copy, or the user-owned file when the base has none). It may add a dependencies glob with tests or add tests to an existing glob; anything else is refused with PREGATE_HEAD_POLICY_LOOSENS and each difference is named. A branch behind its base is compared with its merge-base copy and runs the base tip's policy plus its additions. A head file with no trusted policy anywhere still runs as a bootstrap, but --remote refuses it.
  • --remote works with --policy-from head once that check passes, and still runs the trusted copy's remote_gate.
  • timeout_s (1 to 3600 s) sets pregate's per-process timeout when --timeout is absent, so preflight, finish and plain runs all pick it up; the remote gate gets it as PREGATE_TIMEOUT_S. A timed-out lane names where its timeout came from.
  • gstack-ship-preflight --policy-from head forwards to Step 5's pregate, prints up to three PREGATE_DETAIL: lines when pregate does not pass, and reports a refusal as PREGATE: refused (<code>).

Behavior changes

  • A [] declaration added only on the branch is now refused under --policy-from head, the Dart device-test workaround included. Declare "**/integration_test/**": [] on the base first. test/pregate-dart.test.ts:572 and the PREGATE_NO_LANE doc say so (GStack Minder's C1 answer).
  • Under --policy-from head, an invalid user-owned policy now refuses (PREGATE_CONFIG_INVALID) instead of being ignored, because it is the policy the head file is compared with.
  • A head record (--policy-from head over a user-owned policy) now stores that policy's digest; a record written before this change fails verify and needs a rerun.

Test Coverage

All new code paths have test coverage (Step 7 audit: 100%, 0 gaps). Every new test was red on main first.

Tests ran: focused 636

Pre-Landing Review

No blocking findings. Every finding was informational; two were fixed in pass 1, and Step 11's native adversarial pass found the bootstrap --remote self-clear, which is fixed with a failing-first test.

REVIEW_LOOP: passes=4 blocking_found=0 deferred=0 noted=5 fixed=2 scope=frozen fix_checks=1 dispatches=8

Gate edits: 8 listed, 6 read, 2 findings — 2 kept (reasons below), 0 restored, 0 open

  • kept: untagged test/pregate-dart.test.ts: a branch-only [] under --policy-from head is refused, then passes once on the base (GStack Minder's C1 answer).
  • kept: untagged test/pregate-user-policy.test.ts: an invalid user-owned policy under --policy-from head refuses instead of being ignored (fails closed by design).

Outside review: GPT-6.1 Sol (the Codex CLI is not installed), completed on the full diff and on the fix range; the docs-only range skipped it.

Review notes

  • finish fallback drops head-policy lanes (outside voice, Medium): lib/ship-release.ts reruns pregate on the stamped tree under the base policy, so a lane added under --policy-from head disappears after a version bump. GSTA-194 owns that file; filed in TODOS.
  • The 3600 s preflight and finish wrapper deadline caps the whole run, even when each runner fits timeout_s (outside voice). Filed in TODOS.
  • A bootstrap head policy can still certify itself without --remote (remote_gate: null, or clear --receipt with its own gate), and the --remote refusal prints the generic PREGATE_HEAD_POLICY_LOOSENS fix line. Filed in TODOS.
  • docs/pregate.md still says a bootstrap head file "runs as written" without naming the --remote refusal; only lanes timeouts name their source, not guard or remote-gate timeouts. Informational.

Exploratory QA

No browser, API or UI surface; CLI behavior is covered by the fixture-repo tests above.

Design Review

No frontend files changed — design review skipped.

Eval Results

No prompt-related files changed — evals skipped.

Plan Completion

Plan autoplan-20261031081834 (eng-only, approved at gate_rev 1): every item done (A1 B1 C1 D1 E1).

Verification Results

Step 8.1 obligations: the negative control (a head policy that removes or loosens a lane is still refused) and the failing-first tests per bug: PASS.

TODOS

No TODO items completed in this PR. Three follow-ups filed under "pregate head-policy follow-ups".

Documentation

Status: updated: three factual additions to docs/pregate.md; no blockers.

Scope: base 047dad7..c247079 (3 commits, 18 files: pregate head-policy rule, timeout_s policy key, gstack-ship-preflight --policy-from head, the --remote bootstrap refusal) plus unstaged TODOS.md and the changelog fragment. Audited docs/pregate.md in full, the affected sections of docs/troubleshooting.md, docs/ship-policy.md, ship/sections/tests.md.tmpl, ship/SKILL.md.tmpl, CONTRIBUTING.md and docs/recommended-harness.md, and checked them against the changed source.

Documentation health:

  • docs/pregate.md: Updated. The test-tier bullet and the supervision "timed out" bullet now give the timeout order (--timeout, else timeout_s, else 600) and say the detail names the source; the remote gate's environment now lists PREGATE_TIMEOUT_S.
  • docs/troubleshooting.md: Current. The branch already added the PREGATE_HEAD_POLICY_LOOSENS section and the Dart [] note.
  • CONTRIBUTING.md: Current. The remote pregate command row is still valid.
  • README.md, CLAUDE.md, AGENTS.md: Current. No new skill or command surface.
  • CHANGELOG.md, TODOS.md: owned by /ship, not edited.

Documentation coverage:

  • timeout_s (pregate.json key): reference ✅ (docs/pregate.md table, --explain); how-to ✅ (the table row names the preflight and finish use); tutorial ❌; explanation ✅ (changelog fragment).
  • gstack-pregate --policy-from head (adds lanes only): reference ✅ (docs/pregate.md trust boundary); how-to ✅ (troubleshooting PREGATE_NO_LANE route 2); tutorial ❌; explanation ✅.
  • PREGATE_HEAD_POLICY_LOOSENS: reference ✅ (troubleshooting anchor); how-to ✅ (fix line).
  • gstack-ship-preflight --policy-from head and PREGATE_DETAIL / PREGATE: refused: reference ✅ (preflight help); how-to: partial (the troubleshooting example omits --base/--lane; /ship Step 5 prose does not mention it). Common gap.

Debt: /ship Step 5 (ship/sections/tests.md.tmpl) could name the --policy-from head route and the refused verdict. The troubleshooting PREGATE_INCOMPLETE fix could point preflight and finish users at timeout_s.

Diagram drift: none; no diagrams reference the changed modules.

Test plan

  • focused lane (13 files, bun test test/pregate-head-policy.test.ts test/ship-preflight.test.ts ...): 636 pass, 0 fail
  • bun run typecheck: clean
  • remote free tier on one Ubicloud VM: 24302 tests, 0 failed, $0.07 (tree 98775fb40f69)

🤖 Generated with Claude Code

garrytan and others added 4 commits October 31, 2026 08:50
…; preflight forwards --policy-from (GST-419, GST-420)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ser policy; remote test timeout)

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

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…s in TODOS

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

trunk-io Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits October 31, 2026 09:50
@github-actions github-actions Bot changed the title fix: pregate --policy-from head only adds lanes, and timeout_s reaches preflight and finish (GST-419, GST-420) v1.91.364.0 fix: pregate --policy-from head only adds lanes, and timeout_s reaches preflight and finish (GST-419, GST-420) Oct 31, 2026
@capy-ai
capy-ai Bot merged commit 088bfc5 into main Oct 31, 2026
63 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