Files
gstack/lib/result-codes-autoplan.ts
T
Garry Tanandcapy-ai[bot] 2767d229fb gstack-artifact validate now refuses a run.json that gstack-autoplan never wrote (GST-3090) (#4494)
`gstack-artifact validate` and `ack` now refuse a run.json that
gstack-autoplan never wrote, so a hand-built run can no longer pass as a
finished review.

Why: a session skipped `gstack-autoplan next`, built run.json with a
script copied from the reference fixture, and got ARTIFACT_VALID.

Nothing to do unless you validate old or hand-made run directories:
rerun those through gstack-autoplan.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
2026-11-18 16:45:06 +00:00

56 lines
3.8 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Result codes for the /autoplan publication guard line (GUARD_ENFORCED, printed by
* gstack-skill-start; lib/autoplan-guard-status.ts), the CEO-only driver run (`gstack-autoplan next --ceo-only`,
* lib/autoplan-ceo-only.ts) and its shadow-mode reader (`gstack-autoplan shadow`,
* lib/autoplan-shadow-reader.ts), and the writer check `gstack-artifact validate` runs on a run.json
* (lib/autoplan-writer-check.ts). Kept beside lib/result-codes.ts, which spreads
* this table into RESULT_CODES; the same rules apply: one stable
* docs/troubleshooting.md anchor, a summary and a fix clause each. The run is
* documented in docs/unattended.md#ceo-only-runs.
*/
import type { ResultCode } from './result-codes';
export const AUTOPLAN_RESULT_CODES = {
ARTIFACT_NOT_AUTOPLAN_RUN: {
anchor: 'artifact-not-autoplan-run',
summary: 'run.json lacks what gstack-autoplan writes on every run (its host, plan_input and the other run-state fields) or has no attempts.jsonl journal',
fix: 'drive the run with gstack-autoplan next/submit/answer/export; a run.json written by hand or by a script is not evidence of a review',
},
ARTIFACT_JOURNAL_MISMATCH: {
anchor: 'artifact-journal-mismatch',
summary: 'attempts.jsonl, a bound review output or the run’s checkpoint disagrees with run.json',
fix: 'treat the run as edited after the fact; restore it from a checkpoint (gstack-autoplan resume --from) or rerun it with gstack-autoplan',
},
GUARD_ENFORCED: {
anchor: 'guard-enforced',
summary: 'Claude Code runs the autoplan publication hook, so a phase Read or reviewer dispatch is denied until the previous phase report is published',
fix: 'publish each phase report as visible message text, not reasoning, in a message whose only tool call is `true autoplan-published <phase>`',
},
CEO_ONLY_CONFLICT: {
anchor: 'ceo-only-conflict',
summary: '--ceo-only was combined with a flag that adds a phase (--ui, --developer-tool, --agent-primary), or a plan\'s scope marker names it',
fix: 'drop the conflicting flag, or run without --ceo-only for the full review; --ceo-only goes on the command line of the first next only, never in a gstack-autoplan-scope marker',
},
CEO_ONLY_AFTER_INIT: {
anchor: 'ceo-only-after-init',
summary: 'next --ceo-only named a run directory that already holds a full review run',
fix: 'a run keeps the mode it started with: pass --ceo-only on the first next with a new --out directory',
},
CEO_ONLY_NO_GATE: {
anchor: 'ceo-only-no-gate',
summary: 'answer, recommend, revise and approvals import need a gate or an approvable run, and a CEO-only run has neither: it ends status=reviewed and is never approved',
fix: 'read <run dir>/ceo-review.md; to get a gate and an approval, start a full review with gstack-autoplan next --out <new dir> --plan <file> (no --ceo-only)',
},
SHADOW_BEFORE_ANSWER: {
anchor: 'shadow-before-answer',
summary: 'gstack-autoplan shadow skipped a gate revision whose plan approval is unanswered or answered c (interrogate): the export pairs predictions with answers, so it waits for the owner',
fix: 'answer the gate (gstack-autoplan answer --gate-rev <n> ...), then run gstack-autoplan shadow again; answered revisions of the same run still export',
},
// GST-1243: the public copy of an autoplan run never carries the owner's own words.
ARTIFACT_OWNER_WORDS: {
anchor: 'artifact-owner-words',
summary: 'a public copy of an autoplan run still quotes the owner\'s own words: a relayed gate reply, carried words or a human\'s deferral reason the private run recorded',
fix: 'export with `gstack-autoplan export --out <run> --public <dir>`, which drops those fields and redacts quotes of them in prose; a quote inside a code span or fence in the plan is never rewritten, so edit the plan, revise, and export again',
},
} as const satisfies Record<string, ResultCode>;