Skip to content

/ship's state-machine check accepts the header lines its reader is told to write (GST-3115) - #4504

Merged
capy-ai[bot] merged 1 commit into
mainfrom
state-matrix-check-accepts-reader-header
Nov 18, 2026
Merged

capy-ai[bot] merged 1 commit into
mainfrom
state-matrix-check-accepts-reader-header

Conversation

@garrytan

@garrytan garrytan commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

The state-machine check in /ship no longer stops a review because its reader opened the reply with the REVIEWED_TREE and REVIEW_VERDICT lines its instructions require.
Why: on yc-software/qm#3728 the check reported those two lines as gaps, so /ship stopped before its adversarial review step.
Nothing to do after merge.

What changed

The state-machine check used to flag the reader's required header lines as gaps; it now reads them and reports ok

The state-machine check used to flag the reader's required header lines as gaps; it now reads them and reports ok.

Before/after as text: The state-machine check used to flag the reader's required header lines as gaps; it now reads them and reports ok
--- Before · before.txt · captured output
+++ After · after.txt · captured output
+$ gstack-state-matrix check reader-reply.txt   # this branch
+STATE_MATRIX_CHECK: ok machines=0
+exit 0
-$ gstack-state-matrix check reader-reply.txt   # gstack 1.101.0.0 (main)
-STATE_MATRIX_GAP: unparsed-line — REVIEWED_TREE: 225264fb303085455cdb4cffbfd1393470205b32 /workspace/gstack
-STATE_MATRIX_GAP: unparsed-line — REVIEW_VERDICT: blocking=0
-STATE_MATRIX_GAP: unparsed-line — NO FINDINGS
-STATE_MATRIX_CHECK: incomplete gaps=3 machines=0
-gstack-state-matrix check: the state-machines specialist output lacks a kind × owner action cell, maps a cell to a test that does not exist, or leaves an untested cell without a CRITICAL finding (3 gap(s)); fix: rerun the state-machines specialist on the same diff; its review coverage stays incomplete until gstack-state-matrix check passes (STATE_MATRIX_INCOMPLETE)
-exit 1
 

A reader that followed its brief got its review marked incomplete. Now the check skips a REVIEWED_TREE first line and a well-formed REVIEW_VERDICT line right under it, using isReviewedTreeLine (lib/review-brief.ts) and parseVerdict (lib/review-verdict.ts), the parsers the collector already uses, so there is no second list of header names. NO FINDINGS under the header counts as clean. Any other non-JSON line is still an unparsed-line gap: prose, the header repeated later, the two lines in the wrong order, or a malformed verdict such as blocking=none. The new test in test/state-matrix.test.ts builds the header from the brief itself and fails on main with the two gaps from the report.

Why

"STATE_MATRIX_CHECK: incomplete gaps=2" on yc-software/qm#3728: the reader did what its brief says and /ship treated the review as missing. Reviews of proposal, hold and approval flows now reach the adversarial step instead of stopping.

Blast radius

parseSpecialistOutput is called by checkStateMatrix and by lib/review-scope.ts through the findings parse; both now see the same lines minus the header, and every other line keeps its old handling (lib/state-matrix.ts:70 read; 17 tests in test/state-matrix.test.ts ran, including the negative controls).

Pre-Landing Review

No blocking issues found. One batched reader (testing, security, state machines, red team) found nothing; the adversarial reader found two low-severity notes, listed below; the second-model review (GPT-6.1 Sol) was clean.

Review notes

Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.

  • INFORMATIONAL changelog.d/state-matrix-check-accepts-reader-header.md:4 Changelog says the check and collector can't drift apart; they share parsers but not position rules (collector accepts a tree line anywhere, check only at the top)
  • INFORMATIONAL lib/state-matrix.ts:70 isReviewedTreeLine calls fs.realpathSync on the reader-written path; one filesystem read per reply
Exploratory QA

CLI smoke on bin/gstack-state-matrix check, 3 probes, all pass: this pass's real reader reply (header, then NO FINDINGS) checks ok with exit 0; a malformed verdict under the header stays an unparsed-line gap with exit 1; the same real reply on main 1.101.0.0 reports the header lines as gaps. Wrong-order and repeated-header cases are covered by the unit tests, not probed.

Eval Results

No paid cases selected: the PR profile picked no probes or judges; review-army-state-matrix stays in scheduled release coverage.

Review bot comments

No review bot comments.

Scope Drift

Scope Check: CLEAN

TODOS

No TODO items completed in this PR.

Documentation

Scope: the changes from base 2f57b07 to HEAD e06095b. They cover the state-matrix check skipping the reader's REVIEWED_TREE and REVIEW_VERDICT header lines (lib/state-matrix.ts), its tests, and a changelog.d fragment. The worktree had no uncommitted or new files. Docs that mention the state-matrix check were reviewed: docs/troubleshooting.md (STATE_MATRIX_INCOMPLETE), docs/review-policy.md (test-gap precedence) and docs/TESTING_INTERNALS.md.

Result: current, with no edits. The fix makes the check behave the way those docs already describe, and the changelog fragment explains the change to users.

Debt: none.

Tests
  • bun test test/state-matrix.test.ts: 17 pass, 0 fail
  • Full free suite in CI (free-tests run 44407828340): 1701 files, green at e06095b
  • Typecheck, module-size and conflict-marker guards: pass
Agent notes

Refs GST-3115. Reported by CAPY-1 with gstack 1.101.0.0. Follow-up (not in this PR): an incomplete state-matrix check is "dispatched reviewer output missing" (ship/sections/review-army.md, decision 1), which stops before Step 11, so the adversarial reader never runs on that pass.

Approvals

No approvals recorded for branch state-matrix-check-accepts-reader-header.
Plan: exempt: bug fix
Plan check: exempt bug fix

REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=2 fixed=0 scope=frozen dispatches=1
Gate edits: none detected (2 listed, 0 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)

{
  "schema_version": 1,
  "pr": 4504,
  "head": "e06095b14967b7c81a1301f43c575460a2353e50",
  "version": "1.101.0.0",
  "base": "main",
  "gate": {
    "state-matrix": {
      "pass": 17,
      "fail": 0,
      "skip": 0
    },
    "tests": {
      "pass": 1701,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "tests",
      "run": 44407828340,
      "attempt": 1,
      "tree": "225264fb303085455cdb4cffbfd1393470205b32"
    }
  ],
  "calls": 11,
  "session_kind": "unattended",
  "run": "/home/user/.capy/work/gstack-ship/pr4504-e06095b",
  "head_tree": "225264fb303085455cdb4cffbfd1393470205b32",
  "product_patch_id": "f0788f8020efe0509195ec36b2aa3ee442914bcf",
  "gstack_version": "1.101.0.0",
  "review_depth": {
    "depth": "light",
    "class": "code",
    "runtime_lines": 11,
    "rules": "1afa38a4be3b5eef",
    "base": "2f57b07495f04e53ab146747d48dd9aed2aded29",
    "registry": "2f57b07495f04e53ab146747d48dd9aed2aded29",
    "gate_scan": {
      "tagged": 0,
      "head": "e06095b14967b7c81a1301f43c575460a2353e50"
    },
    "reasons": [
      "runtime=11"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @225264fb3030 (8 checks, current for e06095b14967)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44407828340/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=225264fb3030 tests=37870 skipped=88 runs=44407828340/1 profiles=ci-reuse/free-tests heads=e06095b14967 verified=2026-11-18T22:23:51.263Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/, README.md, AGENTS.md, CLAUDE.md (state-matrix check docs: troubleshooting, review-policy, TESTING_INTERNALS)"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 2,
    "fixed": 0,
    "scope": "frozen",
    "rounds": 1,
    "dispatches": {
      "specialist": 1
    }
  },
  "gate_dispositions": []
}

…s told to write (GST-3115)

The check read REVIEWED_TREE and REVIEW_VERDICT at the top of the reply as unparsed-line gaps and stopped /ship. It now skips them with the parsers collect uses; any other stray line is still a gap.

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

trunk-io Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

@capy-ai
capy-ai Bot merged commit 4302697 into main Nov 18, 2026
54 of 55 checks passed
@garrytan garrytan mentioned this pull request Nov 19, 2026
capy-ai Bot added a commit that referenced this pull request Nov 19, 2026
- `gstack-artifact validate` no longer passes a run.json that gstack-autoplan never wrote. (#4494)
- /ship's changed-number check no longer stops on tests that only share a word with the change (#4478). (#4496)
- On Capy, /ship no longer edits or comments on pull requests as you. (#4518)
- The destructive-command check stops asking about scratch deletes and catches the real damage it used to miss. (#4513)
- The destructive-command check reads commands more carefully, closing gaps found after the last release. (#4525)
- The Codex readiness check and the second-model review now pick the same model for a custom Codex provider (GST-3089). (#4491)
- gstack's Codex hooks work when your Codex folder's path has a `(`, `&` or other shell character in it. (#4528)
- Uninstalling gstack keeps your own Codex hooks trusted. (#4528)
- Codex hook setup matches Codex more closely. (#4528)
- On Windows, setup copies the Claude Code hook code that gstack's Codex hooks import (#4528)
- /review's checklist on Codex reads shell commands more carefully. (#4528)
- On Codex, gstack now suggests the right skill for a prompt and stops destructive commands before they run. (#4512)
- On Codex, /review is now held once when it tries to finish without its adversarial pass or its report, as it already is on Claude Code. (#4522)
- On Codex, gstack's skill suggestion now names the skill the way Codex lists it. (#4523)
- On Codex, gstack's suggested prompts and docs now name skills the way Codex lists them. (#4524)
- /review on Codex with gpt-6.1-sol is no longer held back for a second-model pass it already ran. (#4526)
- On Codex, office-hours, plan-design-review and gstack-upgrade work again when you name them. (#4510)
- gstack knows when Codex is running unattended. (#4510)
- Codex reviewers start with a clean context. (#4510)
- Docs no longer say Codex has no hook support. (#4510)
- A command whose output was cut off no longer counts as a finished read. (#4492)
- A folder marked as published data can no longer hide source code or agent files from /ship's review. (#4516)
- Correction to the on-by-default helper hooks entry: the hook still routes only to /review, /qa and /verify, so skills you've installed yourself aren't suggested yet. With gstack's skills it routes 14 of 60 real bug reports (was 17), and long prompts are no longer skipped. (#4505)
- /sync-gbrain's read check now works when the first page in your code source is over 64 KB. (#4497)
- Free-suite CI no longer fails before any test runs when Ubuntu's package mirror is slow. (#4530)
- Syncing a second repo no longer makes the first one ask for /sync-gbrain again. (#4532)
- gstack's helper hooks are now on by default in Claude Code, OpenClaw and Hermes, and the prompt-routing hook fires on real bug reports. (#4503)
- `gstack-pregate clear --receipt` accepts a remote gate run from before a merged release when the release only regenerated a declared release output. (#4483)
- The second-model review now keeps the reviewer's own result, and reports a used-up budget as a budget stop. (#4515)
- When the reviewer wrote its review to the result file it was asked for, Codex then replaced that file with its short closing message ("Done, I wrote the review"), so the review was thrown away and reported as missing its markers. (#4515)
- When the provider refuses the call with HTTP 402 Payment Required (usually a metering proxy that hit its allowance, or an account out of credits or quota), gstack used to record only "exit 1". (#4515)
- The pre-commit /verify check now fails a check that times out, and its checks share one time budget (GST-3201). (#4527)
- /ship's review collector no longer reads a reviewer's own scope list or list of passed checks as findings (GST-3201). (#4527)
- Merge-queue stack tests fail when git cannot list a PR's added test files (GST-3201). (#4527)
- /ship can now review results PRs that publish raw session data. (#4511)
- /ship's review pass works when the checkout you ship isn't the project's default checkout. (#4507)
- A second review round no longer reports done when nothing was reviewed. (#4520)
- The prompt-routing hook now suggests skills you install yourself, and no longer sends ordinary bug reports to /qa (GST-3123). (#4506)
- gstack's script runner and merge-queue checks now also refuse cut-off output. (#4502)
- A failed second-model review reports the cause that actually stopped it, and the runner never deletes its own prompt. (#4519)
- `gstack-ship-queue ready` now fills in the trial merges and the second-model trail read instead of printing lines to fill. (#4529)
- Five small ship-tool fixes. (#4529)
- A ruling the owner gives while a `/ship` run is open can be relayed. (#4529)
- /ship no longer kills a working test run as stalled when the test command starts its workers in their own session. (#4533)
- /ship no longer stops a review because the state-machine reader started its reply the way its instructions say. (#4504)
- When Claude Code runs /verify right before a commit, it now gets a quick check instead of the full fix loop (GST-3150). (#4508)

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