Skip to content

feat: opt-in /autoplan stop gate with GSTACK_GATE markers (GST-1666) - #4100

Merged
capy-ai[bot] merged 5 commits into
mainfrom
capy/gst-1666-autoplan-gate
Nov 7, 2026
Merged

capy-ai[bot] merged 5 commits into
mainfrom
capy/gst-1666-autoplan-gate

Conversation

@garrytan

@garrytan garrytan commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 4100,
  "head": "c601f20f9a905659d68479ac2f6c9401c441548f",
  "version": "1.97.0.0",
  "base": "main",
  "gate": {
    "test": {
      "pass": 1621,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "test",
      "run": 42319586363,
      "attempt": 1,
      "tree": "07596b82912fe2949b260daaf52e07f72e960e3e"
    }
  ],
  "session_kind": "unattended",
  "head_tree": "07596b82912fe2949b260daaf52e07f72e960e3e",
  "product_patch_id": "ed7485cb77402f6d34977bf8b44d69e7e06c65a6",
  "gstack_version": "1.97.0.0",
  "review_depth": {
    "depth": "full",
    "class": "code",
    "runtime_lines": 371,
    "rules": "70895942bb8a8ee2",
    "base": "e4b1e3455230a958cc53667e920994a9747d440c",
    "registry": "e4b1e3455230a958cc53667e920994a9747d440c",
    "gate_scan": {
      "tagged": 0,
      "head": "c601f20f9a905659d68479ac2f6c9401c441548f"
    },
    "reasons": [
      "risk:security",
      "runtime=371"
    ],
    "risk": [
      "security"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @07596b82912f (8 checks, current for c601f20f9a90)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/42319586363/attempts/1",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/42319586363/attempts/1",
    "windows-setup-e2e.yml/windows-setup: https://github.com/garrytan/gstack/actions/runs/42319582835/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/42319582857/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=07596b82912f tests=36112 skipped=111 runs=42319586363/1 profiles=ci-reuse/free-tests heads=c601f20f9a90 verified=2026-11-07T00:47:25.384Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "docs/ and README.md (docs/skill-gates.md, docs/skill-routing-and-contracts.md updated)"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 4,
    "deferred": 0,
    "noted": 3,
    "fixed": 5,
    "scope": "frozen",
    "rounds": 2,
    "ledgers_read": 3,
    "dispatches": {
      "specialist": 2,
      "red-team": 2
    }
  }
}

What changed

Before: a session told to run /autoplan could stop after any phase, and nothing held it until the pipeline finished. After: with the opt-in autoplan_gate switch on (./setup --autoplan-gate, GSTACK_AUTOPLAN_GATE=on or gstack-config set autoplan_gate on), a Stop hook holds the final stop of a session that loaded /autoplan until Phase 0 ran scope, every applicable phase published its report and the Final Approval Gate is written. A --ceo-only run needs Phase 1 and its end line instead. The gate is off by default. No screenshot: this is a CLI hook with no UI.

Why

In GEVA-2's admission eval, Opus 5.5 told to run /autoplan showed none of autoplan's phases in 23 sessions. The leading hypothesis, not a proven cause because those transcripts were deleted, is that nothing kept the session going until every phase was done, so it stopped early. The gate turns that into a held stop that names the next missing step, capped at 3 blocks per run.

Summary

Runs of /autoplan ended early and silently. This PR adds an off-by-default Stop gate that reads the transcript, works out which phases the run's scope makes applicable, and blocks the stop with the next missing step. Stops that ask the user a question, stops waiting on a running background reviewer, and runs driven by the gstack-autoplan runner are never held. Review in /ship found four ways the check could misread a run; those are fixed here with tests.

Blast radius

The change adds one new hook (hosts/claude/hooks/autoplan-stop-gate.ts behind the autoplan-stop-gate-stop shim) and one new switch name in setup, gstack-config, gstack-skill-gates, gstack-skill-route and gstack-settings-hook. It is safe because the switch defaults to off in lib/skill-route.ts SWITCH_DEFAULT, and every error fails open through runGateHook. The hook was run against fixture transcripts in /ship's QA: a complete run is released, an incomplete one is blocked, and with the switch off there is no output.

Approvals

No approvals recorded for branch capy/gst-1666-autoplan-gate.

Documentation

Status: updated. I made two factual fixes for the opt-in /autoplan stop gate (GST-1666).

Scope: base e325b6d to HEAD 0654776: 4 commits and 16 files (setup, bin/gstack-config, bin/gstack-skill-gates, bin/gstack-skill-route, bin/gstack-settings-hook, lib/skill-gates.ts, lib/skill-route.ts, lib/autoplan-stop-gate.ts, hosts/claude/hooks/autoplan-stop-gate*, scripts/skill-gates-smoke.ts, tests, docs/skill-gates.md and the changelog fragment). Nothing was staged, unstaged or new.

Documentation health:

File Status
docs/skill-gates.md Updated: the Headless smoke section now says three scripted sessions and describes the /autoplan one. The new gate's own section was already in this branch
docs/skill-routing-and-contracts.md Updated: the intro now names the /autoplan gate with the other opt-in gates
README.md, AGENTS.md, CLAUDE.md Current: none of them list the gates

Coverage debt: autoplan_gate, GSTACK_AUTOPLAN_GATE, --autoplan-gate and gstack-skill-gates settings --autoplan have reference and explanation coverage in docs/skill-gates.md and in setup --help. There is no how-to or tutorial, which is common debt.

Diagram drift: none.

Test Coverage

All new code paths have test coverage (Coverage: deterministic; each of 11 changed runtime files has a changed test naming it). The review fixes add three tests to test/autoplan-stop-gate.test.ts; each is red on the pre-fix lib. The focused autoplan-stop-gate and autoplan-ceo-only files are green on the fix (48 tests).

Pre-Landing Review

Pass 1 ran at full depth: a batched specialist, the red team, a native adversarial reader (Opus 5.5) and an outside voice (openai/gpt-6.1-sol). Four blocking findings, all in lib/autoplan-stop-gate.ts, were fixed in 0654776:

  • A Bash command that only mentioned the runner (for example rg "gstack-autoplan next" docs/...) put the run in runner mode, so it was exempt. The runner match is now anchored to a command position.
  • A background Agent launch that failed counted as pending forever, so the run was never held. A failed launch is no longer pending.
  • --ceo-only was missed on Read loads and on Skill calls that carry it in command or skill. It is now read from those fields and from the prompt before a Read load.
    Pass 2 reviewed the fix range and found 3 informational notes, listed below.

REVIEW_LOOP: passes=2 blocking_found=4 deferred=0 noted=3 fixed=5 scope=frozen ledgers_read=3 dispatches=4

Gate edits: none detected (5 listed, 1 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)

Outside review: openai/gpt-6.1-sol completed, verdict request changes (3 findings, all fixed in 0654776).

Review notes

None of these block. Each is a candidate for a follow-up:

  • lib/autoplan-stop-gate.ts:75: the --ceo-only prompt fallback matches the bare substring (so "not --ceo-only" counts) and does not stop at an earlier load.
  • lib/autoplan-stop-gate.ts:33: the anchored runner match misses runner calls behind timeout, env, if or {, quoted paths with spaces, and the run/revise verbs (the old match never covered those verbs either).
  • lib/autoplan-stop-gate.ts:33: a heredoc line that starts with gstack-autoplan next still counts as running the runner.
  • Step 11 notes: a legitimate STATUS: BLOCKED run has no exit from the gate; published and the gate check come from the model's wording, so the record shows what the model claimed, not proven exposure; the 2 s settle loop runs before the /autoplan-load check; runner skips are keyed by run, so report does not show "runner"; a background agent with no result stays pending; scope evidence needs the literal snapshot path.

Exploratory QA

Functional CLI surface, smoke bound 5 minutes / 12 probes, isolated state roots under the run directory. Captures 001-004 on 8277020: a complete run with the switch on is released (phases=ceo,eng); an incomplete run is blocked with missing=scope; the same run with the switch off prints nothing; gstack-skill-gates settings --autoplan registers the Stop shim and sets GSTACK_AUTOPLAN_GATE=on. Verdict: pass. After the fix, captures 005-007 reran the three hook probes on current inputs and pass. The ceo-only, runner, pending-agent and exhaustion paths are covered by unit tests, not probed.

Design Review

No frontend files changed — design review skipped.

Eval Results

No prompt-related files changed — evals skipped.

Review bot comments

No review bot comments.

Scope Drift

Scope Check: CLEAN. Intent: an opt-in Stop gate for /autoplan. Delivered: that gate, its switch wiring, docs, tests, and the review fixes.

Verification Results

No plan file is bound to this branch, so there are no plan-specific checks (VERIFY_RESULT: skipped).

garrytan and others added 2 commits November 6, 2026 23:40
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 6, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 3 commits November 7, 2026 00:05
…(carve guard)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Anchor the runner match to a command position, treat a failed background launch as not pending, and read --ceo-only from a Skill call's command/skill fields and from the prompt before a Read load.

Review-Finding: p1/outside-voice#1 reader=outside-voice
Review-Finding: p1/outside-voice#2 reader=outside-voice
Review-Finding: p1/outside-voice#3 reader=outside-voice
Review-Finding: p1/adversarial-native#1 reader=adversarial-native
Review-Finding: p1/red-team#1 reader=red-team
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>
@capy-ai
capy-ai Bot merged commit ca5dbfc into main Nov 7, 2026
69 checks passed
capy-ai Bot added a commit that referenced this pull request Nov 7, 2026
…T-1701) (#4102)

* test: failing-first cases for the CEO review gate reading a transcript before Claude Code flushes it (GST-1701)

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

* fix: the CEO review gate waits for the transcript flush through #4100's shared settle helper (GST-1701)

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>
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