feat(ship): reviewers read one packet; the parent reads only a compact findings record (GSTA-167)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
garrytanandcapy-ai[bot] committed 2026-10-29 20:13:58 +00:00
1 parent 53db038c6b
commit 23ea02a72c
27 files changed
+1300 -268

No files matched your search

+46 -1
View File
@@ -325,6 +325,50 @@ batches of 8`). Batching changes the order, never the set: every selected
specialist runs before the merge stage, and the Red Team's activation reads
the merged result as before.
<a id="reviewer-packets"></a>
## Reviewer packets
A `/ship` reviewer reads one file and the parent reads one record. On Capy a call
costs a host floor plus its context, so a reviewer that reads the whole diff and
explores the repository pays for that context on every call (GSTA-152 measured a
pass-1 specialist that explored at about 2.7M tokens, and one with a lean brief at
0.23–0.51M). `gstack-review-packet build --base <base> --out-dir <dir>` takes
`gstack-review-plan`'s flags, runs the same plan (`lib/review-plan-live.ts`) and
writes one packet per `DISPATCH:` line holding:
- the role's instructions and findings contract from `lib/review-prompts.ts`, the
strings the resolvers render into `/review`'s prose, so packet and prose cannot drift;
- its checklist inlined (every `checklists=` entry for light depth's batched
specialist, each finding tagged with its checklist);
- its `DIFF_CMD` diff at `-U8` against the literal diff base (`--range <sha>` from
pass 2 on), exclusions honored and untracked files included, under a stat; the
security specialist, the Red Team and the native adversarial pass see tests and
fixtures as a stat only;
- at most 8 KB of `--plan-file`, and past learnings for specialists;
- a read budget: at most 5 more reads of named ranges (200 lines at most) of files in
the diff, no repository search, no other packets, no transcript;
- its output path and the reply `DONE <name> crit=<n> info=<n>`.
A packet over 200,000 bytes is split by path into `<name>.1ofK` packets of the same
reviewer, each with the whole instructions and checklist: no hunk is cut and no path
dropped, and a hunk alone over the cap gets its own shard with a `SHARD_OVERSIZE` note.
The Red Team's packet waits for the specialists (`--only red-team --findings
<dir>/merged.jsonl`; until then collect lists it `pending`), the fix-check packet takes
`--fix-list`, `--tests` and `--callers` with `--range $PASS_HEAD`, and `--audit
test-coverage|plan-completion` writes a Step 7/8 audit packet from the generated
section's prompt. An outside backend gets the outside-voice packet as its prompt file.
`gstack-review-packet collect --dir <dir>` reads every output file and prints at most
60 lines: one `REVIEWER:` line per packet (`clean`, `findings`, `missing`, `invalid`
or `pending`), each CRITICAL on one line, and counts for INFORMATIONAL. It does Step
9.2's stages 1–3 (invalid lines skipped and counted, an advisory CRITICAL kept CRITICAL,
defects and advice merged apart by identity with every source label) into
`merged.jsonl` and writes `informational.md` for the PR body. Missing or unusable
output exits 3 with `REVIEW_COVERAGE_INCOMPLETE`
([troubleshooting.md](troubleshooting.md#review-coverage-incomplete)). Selection, depth,
the floor and the transitions are unchanged: only what a reviewer reads and what
returns to the parent changed.
## Two checklist rules with ids
Two findings `review/checklist.md` names by rule id so a PR body, a review log
@@ -359,7 +403,8 @@ trailers, appended }`.
## Where this is enforced
- `scripts/resolvers/review-army.ts`: the floor and `NO FINDINGS` in every specialist and Red Team prompt (rendered into `review/sections/review-army.md` and `ship/sections/review-army.md`), and the lead judgment's "On record" line that turns a [ruled class](#rulings-below-the-floor) into a note; in `/ship` every specialist and Red Team prompt it renders carries its diff base as a literal sha the parent writes in (`DIFF_BASE=<diff-base>`: the merge base on pass 1, `RANGE_BASE` from pass 2 on) beside its plan's `DIFF_CMD` excludes, because a reviewer is its own process and never sees the parent's shell variables; the fan-out batches above.
- `scripts/resolvers/review-army.ts`: the floor and `NO FINDINGS` in every specialist and Red Team prompt (rendered into `review/sections/review-army.md` and `ship/sections/review-army.md`), and the lead judgment's "On record" line that turns a [ruled class](#rulings-below-the-floor) into a note; in `/ship` every reviewer reads a [packet](#reviewer-packets) built with its diff base as a literal sha (the merge base on pass 1, `--range <RANGE_BASE>` from pass 2 on) and its plan's `DIFF_CMD` excludes, because a reviewer is its own process and never sees the parent's shell variables; the fan-out batches above.
- `lib/review-prompts.ts`, `lib/review-packet.ts`, `lib/review-packet-collect.ts`, `lib/review-plan-live.ts`, `bin/gstack-review-packet`: the reviewer prompts' one source, packet build (shards, read budget) and collect (`REVIEW_COVERAGE_INCOMPLETE`) (`test/review-packet.test.ts`).
- `ship/sections/review-army.md` Step 9: the plan's `REVIEW_DEPTH`, `GATE_SCAN` and `--depth-floor` on every run, the depth fields of the review-log row, passes, `RANGE_BASE`, classify, defer, render, the cap check before any edit, the Step 11 late-defer row, scratch files under `.gstack/tmp/`, the cap decisions; `ship/sections/adversarial.md` Step 11: the outside voice reads the same range and scopes queued fixes the same way.
- `lib/review-depth.ts`, `bin/gstack-review-plan`: the diff class, the depth (`depthFor`, `DEPTH_RULES`, `depthOfCommitInput`), each dispatch's `exclude` pathspecs and `DIFF_CMD`, the transition table, the numeric-claim scan and each role's effort tier (`test/review-depth.test.ts`, `test/review-plan-cli.test.ts`).
- `lib/review-collect.ts`: `collectCommit` (git objects only, from any checkout) and `collectLive` (the working tree), per-path lines and the base commit's registry (`test/review-collect.test.ts`).
+12
View File
@@ -1909,6 +1909,18 @@ wrote its return with status=refused.
**Fix.** The parent reconciles the refusal and regenerates the handoff at the current tree
(`gstack-ship-budget handoff ...`) or stops.
<a id="review-coverage-incomplete"></a>
### `gstack-review-packet collect: ... (REVIEW_COVERAGE_INCOMPLETE)`
**Meaning.** A reviewer /ship dispatched by packet left no usable result: its output file
(the packet's `out=` path) is missing or empty, or holds neither `NO FINDINGS` nor one valid
finding line. The detail names each such packet as `<name>=missing` or `<name>=invalid`. Exit 3:
that coverage is incomplete, never clean, and a peer's result cannot stand in for it.
**Fix.** Confirm the reviewer stopped, dispatch the same packet again with the same brief,
then rerun `gstack-review-packet collect --dir <dir>`. Step 9.4's decision 1 governs the pass
meanwhile ([review-policy.md](review-policy.md#reviewer-packets)).
## Browser
<a id="browse-runtime-version-skew"></a>