Repository navigation
Description
What happened
An interactive /autoplan session keeps its run in .gstack/tmp/autoplan (autoplan/SKILL.md:422) under the run id ${BRANCH}-${DATETIME} (line 428). The skill writes $_AP/gate.json itself (line 625) and appends the gate's decision rows to decisions.jsonl (lines 631-632; the rows come from gstack-gate decisions, bin/gstack-gate:89-97). In our run gate.json and every row carried that run id in run (the skill does not pin the value; lib/gate-list.ts:265 copies gate.json's run into each row). Nothing on this path writes a run.json, plan.md or plan-active.md into the directory (it does write a restore copy of the plan, <branch>-autoplan-restore-<datetime>.md, lines 427 and 433-438): in autoplan/SKILL.md and autoplan/sections/*.md only sections/unattended.md, the hand-off to the gstack-autoplan driver, mentions run.json, and the driver names that file in lib/autoplan-state.ts:96.
After the owner answered the gate, gstack-approvals import --autoplan .gstack/tmp/autoplan --by owner printed APPROVAL_IMPORTED: n=1, and the row's source is autoplan:autoplan@gate_rev=1. lib/approval-record.ts reads the run only from run.json (lines 331-335) and otherwise falls back to the directory name (line 340):
const runId = String(run.run ?? run.id ?? path.basename(runDir));Every interactive run in a repository uses the same directory name, so every interactive run whose directory has no run.json is imported as run autoplan. That has three effects.
- The run id cannot be cited.
docs/troubleshooting.md:2211-2213says to import and "then cite the run id or the row id it printed".gstack-approvals plan-check --plan "Plan: approved: <run id>"refuses withPLAN_UNRESOLVED("no approval row from autoplan run "), becauselib/plan-record.ts:178-181looks for sources that start withautoplan:<run id>@gate_rev=.gstack-approvals render --planwith that line ends inPlan check: PLAN_UNRESOLVED (gstack-approvals plan-check says why)(on a private repo; we did not try a public one). - Separate runs share one gate state. For a row id,
resolveApprovedtakes the run from the row's source (lib/plan-record.ts:203), andgateState(lines 177-185) answers with that run's highest gate revision and, within it, the newest answered row. Following a run's newer revision is the stated design (lines 172-175). The trouble is that every interactive approval row carries the same run in its source (autoplan:autoplan@gate_rev=N), so a different interactive run of the repository, imported on any branch (the store reads every branch's file), decides for the earlier one when its gate revision is higher, or when the revisions are equal and its answer is newer. In a scratch copy of the approval store,plan-check --plan "Plan: approved: a-f8be6d9b6686"printedPLAN: approved autoplan row=a-f8be6d9b6686; after we imported a simulated second interactive run (a.gstack/tmp/autoplandirectory in a second checkout, withoutrun.json, its gate_rev 1 answeredp1elater), it printedrow a-9d55f7f6d092 (autoplan:autoplan@gate_rev=1) is rejected. - The row's text is wrong. It reads
Approve the plan "the plan" (autoplan run autoplan, 9 decisions),the reviewed plan (sha256 unknown)andowner, relayed by unknown.reviewedPlan(lib/captain-brief.ts:37) finds norun.active_plan,plan-active.mdorplan.mdin the directory, and our answered rows have areplybut noanswered_by, whichlib/approval-record.ts:357-362renders as "relayed by unknown" (gstack-gate decisionscallsapplyReplywithout anansweredBy,bin/gstack-gate:94; we did not confirm that this is the call that wrote our rows).
A path token, Plan: approved: .gstack/tmp/autoplan, resolves today, because runIdFor (lib/plan-record.ts:146-150) falls back to the same directory name; the only place we found it described is the header comment of lib/plan-record.ts (lines 5-7). It shares effect 2.
The docs that describe the import (autoplan/DRIVER.md:56 and the captain docs) run it "after answer", on the driver's output directory. We found no doc that says how an interactive run's approval should be recorded, or that its run id cannot be cited.
What we expected
Either an interactive run is imported under its own run id (the run its gate.json and rows carry), so the run-id citation works and two runs never share a gate state; or the import refuses a directory without run.json, and the docs say how to record an interactive approval.
For the first option, a possible change (not tested): in importAutoplan read run from gate.json (or from the first answered row; DecisionLike at line 312 would need run?: string) before falling back to the directory name, and make runIdFor in lib/plan-record.ts:146-150 read it the same way, so the path token keeps resolving. A --plan <file> option would give reviewedPlan a plan to hash.
In test/approval-record.test.ts the importAutoplan cases that import an answered gate use the autoplanRun helper, which writes run.json and plan-active.md (lines 321-322), or write run.json themselves (lines 351, 367); lines 392-398 use a directory without one, but with an unanswered gate, and expect APPROVAL_IMPORT_UNANSWERED. The other callers a code search found (test/autoplan-carry.test.ts, test/autoplan-ceo-only-driver.test.ts, test/capy-captain-flow.test.ts) import driver output or CEO-only and broken-run.json cases. We found no test that imports an answered gate from a directory without run.json.
Steps to reproduce
- Run
/autoplaninteractively in Claude Code and answer its final gate..gstack/tmp/autoplan/then holdsgate.jsonanddecisions.jsonl, each with"run": "<branch>-<datetime>"in our run, and norun.json. ~/.claude/skills/gstack/bin/gstack-approvals import --autoplan .gstack/tmp/autoplan --by owner, thengstack-approvals list --jsonto see the new row's id and its sourceautoplan:autoplan@gate_rev=1.gstack-approvals plan-check --plan "Plan: approved: <branch>-<datetime>":PLAN_UNRESOLVED.gstack-approvals plan-check --plan "Plan: approved: <row id>":PLAN: approved autoplan row=<row id>.- Import a second interactive run of the same repository, from another worktree or clone, whose gate was rejected (we simulated it in a scratch store: a
.gstack/tmp/autoplandirectory in a second checkout, withoutrun.json, gate_rev 1 answeredp1eafter the first). Step 4 now printsrow <second row id> (autoplan:autoplan@gate_rev=1) is rejected.
Readiness report
gstack doctor 1.99.4.0
ok install root ~/.claude/skills/gstack: claude global current (1.99.4.0), agy global current (1.99.4.0), codex global current (1.99.4.0)
ok rescue refs none in ~/.claude/skills/gstack
ok state root ~/.gstack durable=yes (selected by default)
ok bun 1.4.4 at /usr/local/bin/bun (floor 1.3.3, tested 1.4.2)
ok hooks 15 hook(s) parse
ok codex codex-cli 0.160.1; self-locate ok; model gpt-6.1-sol (source: GSTACK_CODEX_MODEL)
ok codex probe cached MODEL_OK, 5h ago (not re-run; --live probes now)
ok artifacts sync status ok (mode full; queue 0)
ok browse bundle browse/dist built
ok binaries find-browse, design, pdf, gstack-global-discover launch (4 of 4)
ok cso native helper 1.99.4.0 (81fb9008351d)
ok claude code 2.1.311 (Claude Code) at /usr/local/bin/claude
ok session journal largest of 1: 18.5 MiB
ok guard log 175 decisions (8 denied)
ok CLAUDE.md no gstack section lists skills (~/.claude/CLAUDE.md, <repo>/CLAUDE.md)
15 ok, 0 warn, 0 not configured, 0 fail
Environment
- Host (Claude Code, Codex, Cursor, ...) and its version: Claude Code 2.1.311
- OS: Linux (a Debian-based Docker container)
- gstack 1.99.4.0 installed. Every file and line above was read on
mainat 0326b14, and the installed copy behaves the same. Step 5 was run on a scratch copy of the approval store with a simulated second run, not on a second real /autoplan session. - Related, a different approval-record defect: approvals: same-day rows differing only by scope dedupe to one id, and sync lets an older local copy win #3502 (closed).
Activity
capy-ai commentedon Nov 16, 2026
Thanks for tracing this through the code. On main (8c3c39b),
lib/approval-record.ts:340still falls back to the directory name when a run has norun.json, so every interactive/autoplanrun imports as runautoplanand its id can't be cited or told apart. Reading the run id fromgate.jsonbefore that fallback is a small, plainly correct fix, so we're taking it. It will be rebuilt on current main and linked here; gstack's tooling is frozen until November 21, so it lands after that.capy-ai commentedon Nov 22, 2026
Picking this up. A maintainer agent working through a batch of fixes (our tracking thread GSTA-802) will first reproduce this on current main. If it reproduces, the agent fixes it on main and we'll close this issue with a link when the change lands. If it no longer reproduces, we'll close it and say what changed.
capy-ai commentedon Nov 22, 2026
Thanks @exGeni. This reproduces on current main: an interactive /autoplan run (no
run.json) imports as runautoplan, so separate runs share one gate state. We tried recording the run's own id, but ids likegst-4681-20261122-104500trip gstack's privacy scanner (the digits read as a card or phone number), which would turn a working import into a refusal on numbered branches. So this is queued behind a related privacy-scanner fix, and the run-id change will come in its own PR using an id form the scanner accepts. We'll keep this issue open until then.fix: pre-landing review fixes
Stop false phone-number holds on /ship run ids and name interactive /…
capy-ai commentedon Nov 23, 2026
Fixed by #4747 (0d6cc1b): an interactive /autoplan run is now imported under its own run id (from its gate rows) instead of
autoplan, and new interactive run ids putautoplanbetween the branch name and the time stamp, so a numbered branch no longer trips the privacy check. Thanks for the report, @exGeni.