Skip to content

feat: crew PRs carry their brief's Plan line; ship-queue ready and land check it (GST-1751) - #4118

Merged
capy-ai[bot] merged 12 commits into
mainfrom
capy/gst-1751-plan-record
Nov 7, 2026
Merged

capy-ai[bot] merged 12 commits into
mainfrom
capy/gst-1751-plan-record

Conversation

@garrytan

@garrytan garrytan commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 4118,
  "head": "0097a914329f4b550f309bc56e9759ac78b9223f",
  "version": "1.97.0.0",
  "base": "main",
  "gate": {
    "test": {
      "pass": 1626,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "test",
      "run": 42356714058,
      "attempt": 1,
      "tree": "4da31b47ec43fc94b42edf48b3449e8f714cbc85"
    }
  ],
  "session_kind": "unattended",
  "head_tree": "1a1f8c4a6a80810e56633f928b5fdf4f06278582",
  "product_patch_id": "98308267bde920545cbc8b6946d0dc3516fd6bf6",
  "gstack_version": "1.97.0.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 393,
    "rules": "c6a079fdf812f479",
    "base": "fd0e3390e9e89db3481499df6eb32c5ce8761843",
    "registry": "fd0e3390e9e89db3481499df6eb32c5ce8761843",
    "gate_scan": {
      "tagged": 0,
      "head": "0097a914329f4b550f309bc56e9759ac78b9223f"
    },
    "reasons": [
      "gate-class",
      "risk:security",
      "runtime=393"
    ],
    "risk": [
      "security"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @1a1f8c4a6a80 (8 checks, current for 0097a914329f)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/42359895289/attempts/1",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/42359895289/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/42359895263/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=1a1f8c4a6a80 tests=36070 skipped=106 runs=42359895289/1 profiles=ci-reuse/free-tests heads=0097a914329f verified=2026-11-07T09:36:22.587Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "docs/, README.md, CONTRIBUTING.md, captain/templates (plan_record docs and templates)"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 7,
    "deferred": 4,
    "noted": 3,
    "fixed": 4,
    "scope": "frozen",
    "rounds": 2,
    "est_input_tokens": 63415,
    "ledgers_read": 4,
    "dispatches": {
      "specialist-batched": 2,
      "red-team": 2
    }
  },
  "carry": {
    "from": "b5c0443123bc150e17f78201c16dffbf9e3e7c68",
    "reason": "base merge + scoped re-check by openai/gpt-6.1-sol (range-diff 215 lines; base context moved in lib/ship-queue-land-direct.ts, lib/ship-release.ts, ship/sections/capy-pr.md.tmpl; range_base 3742ee952761) + test-only change + release metadata + regenerated outputs",
    "product_patch_id": "98308267bde920545cbc8b6946d0dc3516fd6bf6",
    "changed_paths": [
      "product:.github/workflows/windows-smoke.yml",
      "product:AGENTS.md",
      "product:BROWSER.md",
      "product:CLAUDE.md",
      "product:NOTICE.md",
      "product:README.md",
      "product:SKILL.md",
      "product:SKILL.md.tmpl",
      "product:TODOS.md",
      "product:autoplan/DRIVER.md",
      "product:autoplan/DRIVER.md.tmpl",
      "product:bin/gstack-artifacts-init",
      "product:bin/gstack-autoplan-snapshot.ts",
      "product:bin/gstack-capy-install",
      "product:bin/gstack-ci-carry",
      "product:bin/gstack-codex-probe",
      "product:bin/gstack-config",
      "product:bin/gstack-diff-scope",
      "generated:bin/gstack-doctor-components.sh",
      "product:bin/gstack-hook-check",
      "product:bin/gstack-install-registry.sh",
      "product:bin/gstack-relink",
      "product:bin/gstack-review-dispatch",
      "product:bin/gstack-ship-queue",
      "product:bin/gstack-ship-receipt",
      "product:bin/gstack-skill-gates",
      "product:bin/gstack-skill-route",
      "product:bin/gstack-skill-start",
      "product:bin/gstack-team-init",
      "product:browse/src/cli.ts",
      "product:browse/src/meta-commands.ts",
      "product:browse/src/routes/commands.ts",
      "test:browse/test/dual-listener.test.ts",
      "test:browse/test/tab-isolation.test.ts",
      "test:browse/test/tunnel-gate-unit.test.ts",
      "product:careful/bin/hook-extract.sh",
      "metadata:changelog.d/capy-gst-1695-fixture-sweep.md",
      "metadata:changelog.d/capy-gst-1698-retired-followups.md",
      "metadata:changelog.d/capy-gst-1713-github-poll-floor.md",
      "metadata:changelog.d/capy-gst-1717-retire-investigate.md",
      "metadata:changelog.d/capy-gst-1718-template-ui-scope.md",
      "metadata:changelog.d/capy-gst-1747-installer-bun-isolation.md",
      "metadata:changelog.d/capy-gst-1747-make-pdf-local-images.md",
      "metadata:changelog.d/capy-gst-1747-tunnel-web-urls.md",
      "metadata:changelog.d/capy-keep-the-gbrain-database.md",
      "metadata:changelog.d/capy-require-the-daemon-secret.md",
      "metadata:changelog.d/gst-1750-autoplan-ui-scope.md",
      "product:design-consultation/sections/proposal-and-preview.md",
      "product:design-shotgun/SKILL.md",
      "product:design/src/cli.ts"
    ],
    "merge_commits": 1,
    "range_diff": "1:  32c4fa9 =  1:  32c4fa9 feat: crew PRs carry their brief's Plan line; ship-queue ready and land check it (GST-1751)\n 2:  9a46df1 =  2:  9a46df1 feat: /ship finish and train ready/land check the Plan line (GST-1751)\n 3:  66ea948 =  3:  66ea948 fix: pre-landing review fixes\n 4:  14509c1 =  4:  14509c1 test: cover the plan check at ready, train ready, land-direct, finish and the policy key (GST-1751)\n 5:  2d19360 =  5:  2d19360 fix: the Plan line stands for the gate's real state, and a broken store never throws (GST-1751)\n 6:  6ede93d =  6:  6ede93d test: train land refuses a slot with no plan record under require (GST-1751)\n 7:  64e514d =  7:  64e514d fix: pre-landing review fixes\n 8:  25d6beb =  8:  25d6beb docs: changelog fragment passes the prose lint (GST-1751)\n 9:  b5c0443 =  9:  b5c0443 docs: captain.md describes the READY PLAN: line (GST-1751)\n -:  ------- > 10:  6b6e4f6 fix: plan discovery splits the Plan line on whitespace and skips record kinds in any case (GST-1751)\n -:  ------- > 11:  0097a91 test: lower the gstack-review size pins after the Step 8 binding shrank 4 bytes (GST-1751)",
    "covers": [
      "pre-landing review",
      "adversarial review",
      "gate integrity",
      "documentation audit"
    ],
    "reruns": [
      "CI at head (gstack-ship-queue ready requires it); test and helper code changed since the reviewed head runs there unreviewed"
    ],
    "ancestry": "linear",
    "trees": [
      "4da31b47ec43fc94b42edf48b3449e8f714cbc85"
    ]
  }
}
{"head":"b5c0443123bc150e17f78201c16dffbf9e3e7c68","version":"1.97.0.0","gstack_version":"1.97.0.0","review_loop":{"passes":2,"blocking_found":7,"deferred":4,"noted":3,"fixed":4,"scope":"frozen","rounds":2,"est_input_tokens":63415,"ledgers_read":4,"dispatches":{"specialist-batched":2,"red-team":2}},"depth":"full"}

What changed

Crew PRs now carry their brief's Plan: line under ## Approvals, and /ship's finish step, gstack-ship-queue ready and land check it.

  • The line. gstack-approvals render --plan "<the brief's Plan line>" prints Plan: approved: <autoplan run id or approval row id>, Plan: exempt: <reason> or Plan: required, with a Plan check: line under it. gstack never infers "feature" from the diff, title or changelog. A missing line reads as required, and a diff of changelog fragments only needs no line.
  • The resolver (lib/plan-record.ts) reads every branch's approval rows on the machine: the state root plus each Drive mirror.
    • A run id needs the newest gate revision's row to be approved and not answered in an agent's own words.
    • A row id needs an approved row that is not a ruling or grant.
    • An exemption must be on docs/captain.md's list, or crew:<rule>.
    • importAutoplan now records a structured words_by.
  • /ship finish (gstack-ship-release finish --plan "<the brief's Plan line>") resolves the line before its first stage and prints PLAN:, so a crew that never runs ship-queue (qm) is still checked.
  • ready (direct, train and base-red) prints PLAN: and writes the resolved record into the READY note. land (direct, stamp and train) checks that the note carries the PR body's current line and never reads the approval store.
  • Mode. The new plan_record policy key (off | warn | require, tentative key version 1.98.0.0) defaults to off. A Capy crew session under off gets warn. require comes only from the repo policy or GSTACK_PLAN_RECORD=require.
  • Step 8 plan discovery (lib/ship-audit.ts and the plan-completion sections) skips the Plan record line, so a later Plan: <path> binding still binds, and render --plan refuses a line it cannot parse.
  • Refusals. There are six result codes, each with a fix and a troubleshooting entry: PLAN_RECORD_MISSING, PLAN_UNRESOLVED, PLAN_NOT_APPROVED, PLAN_EXEMPT_UNKNOWN, PLAN_STORE_UNAVAILABLE and QUEUE_PLAN_MISMATCH. gstack-approvals plan-check --plan "<line>" checks a line by hand.

Why

In qm, a Captain's brief replaced /autoplan with "Light plan, then build … There's no gate to Garry" for a new UI feature (qm#3186). Nothing noticed (GSTA-380 root cause 1). The brief already has a Plan: line, but nothing read it. Now the line is visible in every PR, and a repo can make ready and land refuse a PR that lacks an owner-approved plan or a listed exemption.

Blast radius

  • Default behavior is unchanged outside Capy, because plan_record defaults to off. Capy crew sessions get one extra PLAN: line in ready and land output, and nothing is refused until a repo sets require or a crew opts in.
  • The READY note gains an optional plan field, so older notes still load.
  • Stamp-only diffs need an explicit Plan: exempt: stamp; lanes never stamp under merge: direct, so this only matters for a hand-made stamp PR.
  • Release PRs keep skipping READY entirely.

Replay (shipped resolver, last 60 merged gstack PRs)

Each PR carried the line its brief would have had, resolved against today's approval store. Result at 2d19360: 57 pass and 3 refused, all PLAN_NOT_APPROVED (unchanged since 32c4fa9).

All 50 non-feature PRs pass. For comparison, branch-keyed lookup would have refused 7 of the 10 features. In qm (11 crew PRs), the line would have refused #3186; qm's approval store isn't readable here, so that count comes from the planning replay rather than this resolver.

Approvals

Approved: yes (record r-8c06e88fb2db). The full approval record stays private: this repository is public or its visibility is unknown.
Plan: approved: ap-20261107055041
Plan check: approved ap-20261107055041 row=a-b6f3743f2146

Main (fd0e339) was merged into this branch at 1a33c74 under the Captain's rule-19 grant a-7e8368a20320, recorded in this branch's approval store.

Summary

A Captain's brief in qm skipped the plan gate for a new feature and nothing noticed. A crew PR now carries its brief's Plan line, and ready, land and /ship finish resolve it against the owner's approval rows, so a repo can refuse a feature that never had an owner-approved plan.

Test Coverage

Coverage: 73% value-weighted (80% of 15 paths with any test). 1 existing test extended (test/ship-queue-train-land.test.ts, train land refuses a slot with no plan record under require); pass-1 fix added "the Plan record line is never Step 8's plan-file binding" in test/plan-record.test.ts. Remaining gaps: train-land direct path, stamp-commit recheck with a matching record, trainPlan on base-red ready.
Tests ran: test 1626 (files; carried from free-tests run 42356714058 at b5c0443)

Pre-Landing Review

REVIEW_LOOP: passes=2 blocking_found=7 deferred=4 noted=3 fixed=4 scope=frozen ledgers_read=4 dispatches=4 est_input_tokens=63415
Pre-Landing Review (pass 1): 4 issues — 3 auto-fixed, 1 asked (0 fixed, 1 skipped), 0 deferred, 0 noted. Pass 2: 3 noted, 0 open. The owner granted diff-plus-blocking scope for red-team#1 in pass 1; red-team#2 (a row id accepts any approved non-ruling row) is skipped under accepted gate change d5.
Gate edits: none detected (16 listed, 6 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 at b5c0443): 2 findings marked blocking. Both are fixed at 6b6e4f6:

  • outside-voice#1 lib/ship-audit.ts:41: planBinding dropped plan files whose name starts with a record word (approved-plan.md, required.md). Fixed: parsePlanLine (lib/plan-record.ts:62) now needs :, whitespace or the end of the line after a record kind, and a test covers both names.
  • outside-voice#2 scripts/resolvers/plan-gates.ts:206: the Step 8 sed matched only spaces after Plan:, so a tab-separated binding resolved to a path with a leading tab. Fixed: the binding splits with awk on any whitespace and skips record kinds in any case, and planBinding accepts tabs; a test covers the tab case.

Scoped re-check at 0097a91 (J1 receipt carry from b5c0443): one reader (openai/gpt-6.1-sol) read the range-diff of the reviewed range against the current one, plus the changed product paths and the base context that moved next to reviewed hunks (215 lines after the pregate regen check proved the regenerated outputs). Verdict: NO FINDINGS. Nothing is open.

Docs fix after the review bound (docs/captain.md, commit b5c0443) had only a lead read by the lane model (anthropic/claude-opus-5-5), not an independent reader.

Review notes

Below the blocking floor (advisory, informational, test-gap or wording items). All three are fixed at 6b6e4f6 by the outside-voice fixes above.

  • INFORMATIONAL scripts/resolvers/plan-gates.ts:206 Shell discovery filter was case-sensitive while the TS planBinding is case-insensitive. Fixed: the shell filter uses grep -viE.
  • INFORMATIONAL ship/sections/plan-completion.md:30 The sed skipped only spaces after Plan:, so a tab-separated line captured differently from planBinding. Fixed: the awk split takes any whitespace.
  • INFORMATIONAL scripts/resolvers/plan-gates.ts:206 The shell filter used (:|$) while parsePlanLine used a word boundary, so approved-plan.md disagreed between shell and TS discovery. Fixed: both now need :, whitespace or the end after a record kind.

Exploratory QA

Functional smoke at 2d19360 (5 captures): plan-check success, unknown exemption exit 3 and finish's require stop passed; the Plan record line read as Step 8's plan binding failed (captures 002, 005) and was fixed in pass 1. Revalidation after the fix: 5 of 5 pass, including the binding pipeline and the render --plan refusal.

Design Review

No frontend files changed — design review skipped.

Eval Results

Evals not run: the selector picks 118 behavioral probes through lib/plan-record.ts, lib/ship-*.ts and bin/gstack-approvals, over the crew's $10 per-PR paid cap; left to release coverage.

Scope Drift

Scope Check: CLEAN

Plan Completion

Plan ap-20261107055041 (gate_rev 1): 9 DONE, 3 CHANGED, 0 PARTIAL, 0 NOT DONE, 1 UNVERIFIABLE (this body states the replay numbers, below). CHANGED: ready reads the PR body's Plan line instead of a flag; stamp-only diffs need an explicit Plan: exempt: stamp; the replay stays outside the public repo.

Verification Results

The plan lists no executable verification items.

TODOS

No TODO items completed in this PR.

Documentation

Status: updated. One factual correction; no blockers.

Scope: the committed diff from 3742ee9 to 25d6beb on capy/gst-1751-plan-record (44 files; nothing staged, unstaged or untracked). I checked the authored docs and templates touched by the plan_record feature (GST-1751) against lib/plan-record.ts, lib/ship-policy.ts and lib/result-codes-capy.ts.

Documentation health:

  • docs/captain.md: updated. It used to say plan approval was not a READY field, but the READY template now requires a PLAN: line.
  • docs/ship-policy.md: current. The plan_record row matches the code: the default is off, the modes are warn and require, and it lists all six codes.
  • docs/troubleshooting.md: current. All six anchors exist and match the result codes.
  • captain/templates/READY.md: current.
  • captain/templates/brief.md: current.
  • ship/SKILL.md.tmpl, ship/DRIVER.md.tmpl and ship/sections/capy-pr.md.tmpl: current.
  • review/sections/plan-completion.md: current.
  • changelog.d/capy-gst-1751-plan-record.md: reviewed only, not edited.

Debt: the short version of 'The READY contract' in docs/captain.md doesn't list PLAN:; it points to the template instead. No diagram drift.

Test plan

  • bun run test: carried from free-tests run 42356714058 at b5c0443 (1626 files, success)
  • Windows smoke: windows-smoke run 42358231900 at b5c0443 (success)
  • Free Tests run 42359895289 at 0097a91 (success; CI carry accepted, tree 1a1f8c4a6a80, 36070 tests) and windows-smoke run 42359895263 at 0097a91 (success)
  • Pregate at 0097a91: 7 guards passed (typecheck, skill-size, parity-suite, context-budget, module-size, goldens, conflict-markers); requires-remote cleared
  • Local guards at 64e514d: typecheck, parity, size guards, context and catalog budgets, module-size, host-config, size-ledger, plan-record (166 pass, 0 fail)

Open in Capy

…nd check it (GST-1751)

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

trunk-io Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 11 commits November 7, 2026 07:03
finish --plan resolves the brief's Plan line before stage 1; train ready,
base-red ready, train land and stamp land read and write the READY note's
plan record like direct ready and land. Review fixes: grant and exception
rows never pass as plan approvals, render --plan stays short when redacted,
no explicit changelog-only exemption, off mode still records a resolved line.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/red-team#2 reader=red-team
Review-Finding: p1/red-team#3 reader=red-team
Review-Finding: p1/specialist-batched#1 reader=testing
Review-Finding: bin/gstack-approvals:56:functional-contract reader=qa
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… and the policy key (GST-1751)

Review-Finding: p1/specialist-batched#3 reader=testing
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…re never throws (GST-1751)

A row id from an autoplan run resolves to that run's newest gate revision; a
run id needs the plan approval answered and no decision left unanswered.
readStore skips malformed rows and unreadable files; with the key off the
check never throws or prints. Train land rechecks the Plan line before its
merge on every path. /ship's Step 19-C renders Approvals with --plan;
DRIVER.md back under its size limit.

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

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Step 8 plan discovery (lib/ship-audit.ts and the plan-completion sections) skips the Plan record line, so a later Plan: <path> binding is still found; render --plan refuses a line it cannot parse. The review skill's pins drop by 4 bytes.

Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: scripts/resolvers/plan-gates.ts:206:functional-contract reader=qa
Review-Finding: p1/red-team#3 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>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…368a20320)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…rd kinds in any case (GST-1751)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…nk 4 bytes (GST-1751)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit 901f246 into main Nov 7, 2026
46 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