Skip to content

Make the /autoplan approval gate render and accept plan replies (#4181) - #4191

Closed
szsunyuan wants to merge 1 commit into
garrytan:mainfrom
szsunyuan:fix/4181-autoplan-gate-p1
Closed

szsunyuan wants to merge 1 commit into
garrytan:mainfrom
szsunyuan:fix/4181-autoplan-gate-p1

Conversation

@szsunyuan

@szsunyuan szsunyuan commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

/autoplan's final approval gate now renders, and its plan-approval replies parse. The skill told the agent to name that item plan and to read replies like plana, which gstack-gate refuses.

Why (in your own words)

/autoplan Phase 4 tells the agent to write $_AP/gate.json with one item per user challenge (uc<n>), one per taste decision (d<n>), and a plan-approval item named plan. It then says plana approves and planc/pland/plane interrogate, revise or reject. gstack-gate accepts only a lowercase label followed by a number (ID_RE in lib/gate-list.ts:75), so a gate written as the skill says fails to render, and none of the plan<letter> replies can ever match an item. The owner's approval step breaks on the text the skill itself supplies.

This addresses #4181, reported with the exact lines by @exGeni.

Validation status: Full free CI passed on head 34a0b6904 (32 checks passed, 20 skipped, none failed), including all eleven free-suite shards, typecheck, macOS named regressions and Windows smoke. Locally, the full free suite ran once and every failing file was rerun on unchanged main (below): the only failure this change caused was a size pin, fixed in this commit. Required selected paid coverage and remaining shipping reviews are still pending; skipped fork jobs are not passes.

Why this shape

p1 is already the id everywhere except the skill text. The helper-built gate writes { id: 'p1', title: 'Plan approval' } (lib/autoplan-gate.ts:269), and docs/unattended.md:513 calls the item p1 plan approval. The skill prose is the stale side, so the change renames three tokens on three template lines and leaves the grammar, which is a parsed contract, alone.

Three lines in one template, its regenerated SKILL.md, twelve exact size pins the rename moved, one test case in the existing gate-grammar owner file, and one changelog fragment. Fine to absorb into a wave.

What it does

  • Names the plan-approval item p1 in the Phase 4 gate.json instructions.
  • Teaches p1a (approve) and p1c/p1d/p1e (interrogate, revise, reject) as the reply tokens.
  • Regenerates autoplan/SKILL.md; bun run gen:skill-docs --host all changes no other file.
  • Lowers the twelve */gstack-autoplan pins in test/fixtures/skill-md-size-allowlist.json by 10 characters each. Those renders are over the 100,000-character limit and pinned at their exact size, and the rename shortens each by 10, which test/skill-md-size-guard.test.ts reports with the exact values to set.
  • Adds one case to test/gate-list.test.ts that reads the template's plan-approval id and its reply tokens, then checks them with the real validateGateList and parseReply. It reads the tokens from the template rather than pinning a sentence, so a later rewording that keeps a valid id still passes.

What it deliberately does not do

Live evidence

Bun 1.4.4 and Node 22.23.4 on Linux, LC_ALL=C, private HOME and GSTACK_HOME. No browser or live model was used. The gate file holds one auto item (d1) and the plan-approval item with options a to e, written exactly as each version of the skill describes.

Actual CLI before and after

Before: the item named plan, as the skill says on main at a229e2580:

$ gstack-gate render gate.json
gstack-gate: gate.json is not a gate list:
  items[1].id must match [a-z]*[0-9]+ (lowercase label plus a number, e.g. d3, uc1, 12)
exit=1

$ gstack-gate parse gate.json --reply "plana" --gate-rev 1 --json
gstack-gate: gate.json is not a gate list:
  items[1].id must match [a-z]*[0-9]+ (lowercase label plus a number, e.g. d3, uc1, 12)
exit=1

After: the item named p1, as the skill says on this branch:

$ gstack-gate render gate.json
GATE: run=r gate_rev=1 items=2 page=1/1

1. [d1] Taste decision (auto; recommended: a)
   d1a) keep (recommended)
   d1b) change
2. [p1] Plan approval (approval; recommended: a)
   p1a) approve as-is (recommended)
   p1b) with overrides
   p1c) interrogate
   p1d) revise
   p1e) reject
...
exit=0

$ gstack-gate parse gate.json --reply "p1a" --gate-rev 1 --json
{"valid":true,"gate_rev":1,"reply":"p1a","choices":[{"id":"d1","chosen":"a","kind":"auto","how":"auto_default"},{"id":"p1","chosen":"a","kind":"approval","how":"recommended"}],"pending":[],"unparsed":[],"mode":"tokens"}
exit=0

$ gstack-gate parse gate.json --reply "p1c" --gate-rev 1 --json
{"valid":true,"gate_rev":1,"reply":"p1c","choices":[{"id":"d1","chosen":"a","kind":"auto","how":"auto_default"},{"id":"p1","chosen":"c","kind":"approval","how":"override"}],"pending":[],"unparsed":[],"mode":"tokens"}
exit=0

Control: the old token against the same valid gate is still refused, so the reply half of the bug is real on its own, not only a side effect of the render failure.

$ gstack-gate parse gate.json --reply "plana" --gate-rev 1 --json
{"valid":false,"gate_rev":1,"reply":"plana","choices":[],"pending":[],"unparsed":["plana"],"error":"GATE_REPLY_UNPARSED"}
exit=1

Failing-first regression

The new case was written before the template edit and run against the unchanged template:

$ bun --no-env-file --no-load-bunfig test test/gate-list.test.ts --test-name-pattern 'autoplan gate text'
error: expect(received).toEqual(expected)
- []
+ [
+   "items[0].id must match [a-z]*[0-9]+ (lowercase label plus a number, e.g. d3, uc1, 12)",
+ ]
(fail) the /autoplan gate text (#4181) > its plan-approval item id validates, and each reply token for that item parses to its option

 0 pass
 15 filtered out
 1 fail

After the fix it passes (1 pass, 7 expect() calls), and the whole owner file passes 16 of 16.

Focused checks

Commands ran under the isolated environment above.

Check Pass Fail
test/gate-list.test.ts (gate grammar owner, including the new case) 16 0
autoplan template suites: autoplan-stop-gate, autoplan-phase-handoff, autoplan-publication-generation, autoplan-phase-order, autoplan-scope 110 0
test/skill-validation.test.ts 320 0
test/context-budget-ratchet.test.ts, test/catalog-budget.test.ts 10 0
test/test-of-test-ratchet.test.ts, test/module-size-ratchet.test.ts, test/spawnsync-timeout-tripwire.test.ts, test/egress-receipt-wiring.test.ts 22 0
test/changelog-fragments.test.ts 15 0
Total 493 0

Each run was bun --no-env-file --no-load-bunfig test <files> --timeout=60000. Product bun run typecheck exits 0. bun run typecheck:test reports 812 known diagnostics, none new. bun run gen:skill-docs --host all leaves the tree clean. gstack-plain-title check on the title, branch, commit subject and fragment prints PLAIN_TITLE: ok; gstack-prose-lint --gate on the fragment prints PROSE_LINT: ok; git diff --check is clean; gstack-redact --repo-visibility public on the exact staged patch reports zero findings.

Full free suite and base control

bun run test ran once locally on this change before the size-pin fix; that tree differs from the final commit only in the pin fixture. All five shards reported failures in 71 files. This container's Playwright browsers are Chromium build 1243, while the repo pins Playwright 1.65.0 (build 1254), so every browser launch fails here; most of the other failures are /cso, iOS QA and Ubicloud runner tests that need tooling this container lacks.

Every failing file was then rerun on its own, with the same flags, on unchanged main at a229e2580:

Result Files Fails on this branch Fails on unchanged main
Fails on main as often or more 68 190 226
Caused by this change: test/skill-md-size-guard.test.ts 1 1 0
Failed more only under the parallel run 2 8 6
  • The size guard was this change. It is fixed by the pin update above.
  • The two parallel-run extras clear alone. On the final commit, test/plan-count-timeout.test.ts passes 2 of 2 (main: 0 failures), and browse/test/chromium-profile-isolation.test.ts fails 5 (main: 6), all 30-second Chromium launch timeouts.

Upstream main moved to 10fc9b1ea while this was in review, including #4186's one-line autoplan template edit. This commit cherry-picks onto it cleanly, gen:skill-docs --host all leaves no drift, and the size guard (2/2), test/gate-list.test.ts (16/16), test/skill-validation.test.ts (320/320), both budget suites (10/10) and test/changelog-fragments.test.ts (15/15) pass there.

Every test that reads the pin fixture, rerun on the final commit:

Check Pass Fail
test/skill-md-size-guard.test.ts 2 0
test/free-fixtures.test.ts 11 0
test/windows-path-scope-workflow.test.ts 15 0
test/gate-list.test.ts 16 0

Scope

  • Changed: five files, +38/-18 against main at a229e2580: autoplan/SKILL.md.tmpl, the regenerated autoplan/SKILL.md, test/fixtures/skill-md-size-allowlist.json, test/gate-list.test.ts and changelog.d/fix-4181-autoplan-gate-p1.md. One commit: 34a0b6904cc9f29a4d573c0669b827e313f34030.
  • Verified live by: full free CI on this head, the real gstack-gate CLI before and after, the failing-first run of the new case against the unchanged template, 493 focused passing checks, the full free suite with a per-file base control on unchanged main, both typechecks, an all-host regeneration with no drift, and exact-patch lint and redaction scans.
  • Did NOT test: a green full free suite locally (this container cannot launch the pinned Chromium; CI ran it green on this head), a live /autoplan run through Phase 4 with a model, native Windows or macOS execution, or any paid lane.

The free paid-coverage planner (bun run eval:select --base upstream/main) selects no behavioral probes and no quality judges for this diff in the PR profile. It defers 32 broad behaviors (the autoplan, carve-section-loading and journey cases) to scheduled/release coverage. None was run; none receives pass credit here.

Liveness proof (required for external contributors)

image

Checklist

  • Liveness screenshot attached (GSTACK PR typed live into a real surface).
  • This is not a generated-file-only diff; the .tmpl source and the existing owner test are changed, and SKILL.md was regenerated from it.
  • No ETHOS.md edits, and no changes to voice / founder perspective / YC references.
  • New public command / external service / host adapter has an accepted issue linked: N/A, none added.
  • Linked issue and reproduction: /autoplan tells the agent to write a gate item with id plan, which gstack-gate rejects #4181.

Test plan

  • Reproduce the gate refusing an item named plan and the parser refusing plana, with the real CLI.
  • Prove the new case fails against the unchanged template.
  • Show p1 renders, and p1a/p1c resolve to the right options; keep the old token refused as a control.
  • Pass the gate-grammar owner suite, the autoplan template suites, skill validation, budgets and layout guards.
  • Regenerate for every host with no other file changing.
  • Run the full free suite once, rerun every failing file on unchanged main, and fix the one failure this change caused (the autoplan size pins).
  • Pass strict product types and the unchanged test-type debt limit.
  • Check the plain title, fragment prose, whitespace and the exact outgoing patch for sensitive content.
  • Complete full free acceptance on this PR head (CI on 34a0b6904: 32 passed, 20 skipped).
  • Complete required selected paid coverage, with maintainer-run fork-PR coverage where needed.
  • Complete remaining shipping reviews and verification before merge.

Fork PRs do not receive upstream eval secrets. Skipped paid jobs are not passes; required maintainer-run coverage remains necessary before merge. Broad-profile deferrals are scheduled/release coverage, not PR passes.

Fixes #4181.

…ytan#4181)

The autoplan skill told the agent to write the plan-approval gate item as
`plan` and to read replies `plana` through `plane`. gstack-gate accepts
only a lowercase label followed by a number, so the gate refused to
render and those replies were never applied. Use `p1`, the id
lib/autoplan-gate.ts and docs/unattended.md already use.

Add a gate-list case that reads the template's plan-approval id and reply
tokens and checks them with the real validator and reply parser.

Fixes: garrytan#4181

Co-Authored-By: Claude Code <[email protected]>
@trunk-io

trunk-io Bot commented Nov 9, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@capy-ai

capy-ai Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Thanks. This idea landed in #4219 (merged as 1b96d9f), rewritten on current main with you credited as co-author. Closing this one as superseded.

@capy-ai capy-ai Bot closed this Nov 9, 2026
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.

/autoplan tells the agent to write a gate item with id plan, which gstack-gate rejects

1 participant