Skip to content

v1.91.326.0 feat(ship): reviewers read one packet; the parent reads a compact findings record (GSTA-167) - #3621

Merged
capy-ai[bot] merged 7 commits into
mainfrom
gsta-167-review-packets
Oct 30, 2026
Merged

capy-ai[bot] merged 7 commits into
mainfrom
gsta-167-review-packets

Conversation

@garrytan

@garrytan garrytan commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3621,
  "head": "1eda7b9c9e11a43dac1348492100208b0e108f4e",
  "version": "1.91.324.0",
  "base": "main",
  "gate": {
    "remote-gate": {
      "pass": 23842,
      "fail": 0
    }
  },
  "session_kind": "unattended",
  "head_tree": "b5261b4e0594d75691b7516d23102ffa6cc8e753",
  "product_patch_id": "8528c1caf85c255479bf1d6bdd4c6e3ff09c389e",
  "gstack_version": "1.91.322.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 1232,
    "rules": "9bc0e4d2f74ef6b4",
    "base": "53db038c6ba6f1408e12418a4adaf61c21808607",
    "registry": "53db038c6ba6f1408e12418a4adaf61c21808607",
    "gate_scan": {
      "tagged": 1,
      "head": "1eda7b9c9e11a43dac1348492100208b0e108f4e"
    },
    "reasons": [
      "gate-class",
      "runtime=1232>50"
    ]
  },
  "pregate": "requires-remote cleared @b5261b4e0594 (1 checks, current for 1eda7b9c9e11)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/40958389781",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/40958389781",
    "windows-free-tests.yml/windows-free-shard: https://github.com/garrytan/gstack/actions/runs/40958389794",
    "pregate.json/remote_gate: remote-gate tree=b5261b4e0594 tests=23842"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "docs/ship-budget.md (BUDGET_NEXT line); review-policy, troubleshooting, capy SKILL.md, model-policy, ship-policy current"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 5,
    "deferred": 0,
    "noted": 35,
    "fixed": 10,
    "scope": "frozen",
    "fix_checks": 1,
    "dispatches": {
      "specialist": 16,
      "red-team": 2
    }
  }
}

Part of GSTA-167 / GST-134 (P-1: cut /ship token cost). Pairs with #3620 (budget thresholds and handoff).

Summary

  • One packet per reviewer. gstack-review-packet build runs the plan gstack-review-plan prints (lifted into lib/review-plan-live.ts) and writes one file per DISPATCH: line: the role's instructions and findings contract, its checklists, that reviewer's diff (literal base sha, its exclusions, -U8), a plan excerpt, a read budget and the output path. Steps 7 and 8 audits, the specialists, the Red Team, the fix-check and Step 11's adversarial pass and outside voice all dispatch this way. Packets over 200 KB split by path with no hunk cut and no path dropped; audits are never split.
  • Reads sized to the read tool. Each PACKET: line carries read= line ranges of at most 30,000 bytes and budget_role=; the packet ends with END OF PACKET <name>. Capy's read tool returned about 37,800 characters of a 2,016-line file with no truncation notice (probe: 480 of 2,016 lines), so the brief reads the packet as parallel range reads in turn 1, at most 2 more ranges in turn 2, then one write: about three calls.
  • Budget handoff. Build prints BUDGET_NEXT: dispatch:<roles>, one budget role per packet (audits as specialist, shards as their reviewer), and the prose passes that value to gstack-ship-budget check --next, never packet names.
  • Data files as summaries. .json, .jsonl, .ndjson, .csv and .tsv changes over 400 changed lines (not package or config manifests) reach reviewers as a summary built from the diff alone: changed-line count, top-level keys, first and last 40 changed lines. The testing reviewer and the coverage audit read data under test/ or fixtures/ in full. A feat: add /cfo skill — session cost + AI spend dashboard #34-shaped diff (three ~70 KB wiki JSON files) now gives every role one packet instead of two.
  • The parent reads a compact record. gstack-review-packet collect parses, validates and dedupes, prints at most 60 lines (one per reviewer plus each CRITICAL), and writes merged.jsonl and informational.md. Missing or unusable output exits 3 with REVIEW_COVERAGE_INCOMPLETE. A matrix record counts only from the state-machines reviewer; a CRITICAL line that fails to parse or validate, in any case, makes its reviewer invalid.
  • Manifest integrity. A partial build keeps other reviewers only at the same head, diff base and diff content; a Red Team build (--findings) against a changed tree refuses with STALE_MANIFEST.
  • Single-sourced prompts. lib/review-prompts.ts holds every reviewer prompt and the resolvers import it; /review's generated output is unchanged.
  • Capy dispatch. capy/skill/gstack/SKILL.md: one program builds packets, creates at most 10 subagents per call within free slots, polls with transcript: "none" and returns only collect's output.
  • --base origin/main no longer renders origin/origin/main in audit prompts.

Selection, depth rules, the blocking floor, gate-class adversarial and fix-check are unchanged.

Documentation

Status: updated — one factual line added to docs/ship-budget.md; no blockers.

Scope. Candidate gsta167-docs-1793308916 (edit mode): branch gsta-167-review-packets, base 53db038c, head 1d460c6e; 31 committed files plus the unstaged CHANGELOG.md entry; nothing staged or untracked. The branch adds bin/gstack-review-packet (build/collect), lib/review-packet.ts, lib/review-packet-collect.ts, lib/review-prompts.ts, lib/review-plan-live.ts, the REVIEW_COVERAGE_INCOMPLETE result code, and rewrites /ship's reviewer dispatch (ship section templates, resolvers, the Capy skill paragraph). Banned-terms check: none (the repo keeps no list).

Documentation health:

  • docs/ship-budget.md — Updated (Dispatches: --next comes from gstack-review-packet build's BUDGET_NEXT: line, one role per packet; audits reserve as specialist, shards as their reviewer's role; links to review-policy.md#reviewer-packets)
  • docs/review-policy.md — Current (the new "Reviewer packets" section and "Where this is enforced" entry match the binary's help, budgetRole and collect's exit 3)
  • docs/troubleshooting.md — Current (new review-coverage-incomplete anchor matches lib/result-codes-budget.ts and bin/gstack-doctor-components.sh)
  • capy/skill/gstack/SKILL.md — Current (the reviewer-dispatch paragraph matches review-policy.md)
  • docs/model-policy.md — Current (gstack-review-plan still names each dispatch's effort; packets carry it as effort=)
  • docs/ship-policy.md — Current
  • CHANGELOG.md — Not audited for voice (Step 5 is outside a ship-owned audit); its "41 tests" claim matches a local run (41 of 41 green)
  • README.md, AGENTS.md, docs/skills.md, docs/PROJECT_STRUCTURE.md, CLAUDE.md, CONTRIBUTING.md — Current: none of them lists the review helpers (gstack-review-plan is absent too), so the new binary needs no line there

Coverage:

  • gstack-review-packet build / collect: reference (review-policy.md, ship-budget.md, the binary's --help), explanation (review-policy.md), how-to (troubleshooting.md for the exit-3 path; capy/skill/gstack/SKILL.md for Capy dispatch). No tutorial is expected for an internal /ship helper.
  • REVIEW_COVERAGE_INCOMPLETE: reference and fix in troubleshooting.md.
  • lib/review-prompts.ts (one source for reviewer prompts): reference in review-policy.md only, which is enough for an internal module.

Debt. None critical. Diagram drift: none (no diagram names the review machinery). One note for the parent, not a docs gap: review-policy.md's "Gate paths for the machinery itself" list matches lib/review-depth.ts, and neither includes the new packet files, so an edit to them classifies as code, not gate.

Dogfood on this PR's own /ship

Step Packets Bytes Reviewers Root counter
7 coverage audit 2 (sharded: defect, fixed) 236,551 2 not attributable (siblings running)
9, first pass: specialists + Red Team 11 + 1 1,236,550 + 161,547 12 271.67M to 324.27M (+52.6M, siblings running)
11, first pass: adversarial + outside voice 3 359,520 3 not split out
9 and 11, second pass (fix range, read= brief) 6 + 1 + 2 598,134 + 70,715 + 166,028 9 444.16M to 456.13M (+12.0M, siblings idle)
fix-check 1 26,854 1 464.90M to 468.98M

The second pass read the fix range and the first the whole diff, so the per-reviewer drop is not like for like. Step 8 did not run (no plan binding).

Why

A Capy call costs the ~100k host floor plus context, so a reviewer costs calls times context. GSTA-152 measured ~2.7M per pass-1 specialist that explores the repo, against 0.23-0.51M with a lean brief.

Blast radius

ship/ and review/ prose (generated), scripts/resolvers/{review-army,fix-check,outside-voice-steps,defensive-review}.ts, new lib/review-{packet,packet-collect,plan-live,prompts}.ts and bin/gstack-review-packet, docs/review-policy.md, docs/ship-budget.md, capy/skill/gstack/SKILL.md. Three tests that pinned the old /ship dispatch prose now check where the contract lives (packet or lib).

Tests

test/review-packet.test.ts (41). Each fix above has a test that failed before it (the replay batch failed 19 tests at f0f938d; the pass-2 fixes failed at dd5bf54). Local focused runs: review-packet 41, defensive-review-framing 5, parity-suite 2, ship-workflow-clarity 38, review-plan-cli 21, module-size-ratchet 6, skill-validation 340; typecheck clean. Remote pregate at 1eda7b9: 23,842 tests, 0 failed, $0.08.

Gate edits: tests this PR wrote were adjusted with their fixes: the audit-prompt test expects git diff main for a fixture with no origin remote; the matrix test.each row declares the state-machines checklist; defensive-review-framing names ADVERSARIAL_NATIVE where the native prompt no longer sits "below"; the partial-build test now expects a Red Team refusal. No pre-existing test was weakened.

Review-record notes

  • The review-log rows for the second full pass (review and both adversarial attempts) and for the fix-check took their start tokens at 1d460c6 after those reviewers had read. The fix-check read exactly that tree. The second pass read dd5bf54; the difference is the fix-check's range. The rows do not attest that the second pass read 1d460c6.
  • The receipt's specialist dispatch total also counts the adversarial pass and the outside voice, because my review-log rows listed them under specialists. The actual reviewers: 6 specialists in each full pass (the first pass ran its 6 as 11 shard packets), the Red Team once per pass, the native adversarial pass once per pass, and the outside voice as 2 shards in the first pass and 1 packet in the second.

Sibling trial merges

#3620 (ede6c52): merges cleanly; generated docs stay fresh; review-packet, parity, ship-budget* and ship-workflow-clarity pass. #3596 is in the base (53db038).

Follow-ups (not in this PR)

  • lib/review-depth.ts gate paths do not list the packet files, so edits to them classify as code, not gate (docs audit note).
  • gstack-review-plan --base main prints DEPTH_ERROR: scope_error … no_base and drops security and performance; --base origin/main works. Pre-existing on main.

Review notes

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

  • INFORMATIONAL lib/review-packet-collect.ts:68 parseOutside has two untested branches that change the gate: an outside voice that classifies as findings but uses no [Severity] path:line — ... lines gets a synthetic CRITICAL (P0/P1) or INFORMATIONAL finding pointing at the out file, and a NO_FINDINGS reply reads clean. The only outside-voice collect tests cover line-format findings and a refusal, so a regression that drops the fallback would let unformatted P0 output be collected as clean.
  • INFORMATIONAL bin/gstack-review-packet:96 The Red Team packet's inputs are built in the bin without tests: the specialist count N comes from the previous manifest's specialist reviewers (sharded reviewers deduplicated by reviewer), and merged.jsonl lines that fail JSON.parse or carry a non-array sources are dropped silently, so the Red Team is told fewer findings exist. The existing Red Team test checks only that one well-formed finding appears.
  • INFORMATIONAL test/review-packet.test.ts The /ship Red Team flow (Step 9.1 build+collect, then build --only red-team --findings into the same $_PK, then collect again needing pending=0) is never exercised end to end. The Red Team test only checks the manifest still lists testing; it never writes specialist outputs before the partial red-team build, so a regression where the partial build clears other reviewers' .out files or leaves the deferred entry pending (Step 9.4's pending=0 gate never clears) would pass every test.
  • INFORMATIONAL test/review-packet.test.ts ship/sections/test-coverage.md now hands the Step 7 audit its parent inputs (framework/bootstrap decision, permitted paths, passes) only through --context .gstack/tmp/audit-context.txt, which lib/review-packet.ts renders as a ## Parent context block. No test passes --context, so dropping or mis-reading that block would silently strip the audit's permissions and caps with every test green; the prose-flag test checks only that the flag name is documented.
  • INFORMATIONAL scripts/resolvers/outside-voice-steps.ts:132 The isShip branch tells the reader that the adversarial packet carries 'the defensive framing, the prompt below, the diff ...', but in ship mode no prompt follows: the ternary renders DEFENSIVE_REVIEW_FRAMING and ADVERSARIAL_NATIVE only in the non-ship branch, so the generated ship/sections/adversarial.md refers to a prompt that is not there.
  • INFORMATIONAL bin/gstack-review-packet:89 --generation and --passes-used are applied by string-replacing the literal placeholders '<allowed|audit-only>' and 'passes used: ' in the prompt fence read from ship/sections/.md. If the template wording changes, the replace silently does nothing and the audit packet keeps the placeholder, with no error or test pinning the coupling.
  • INFORMATIONAL lib/review-packet-collect.ts:146 collect reserves a magic 'tail = 6' lines only for CRITICAL rows. REVIEWER:, pending and AUDIT: lines are unbounded once more than 25 results are non-clean (the shown filter only drops clean ones), so the final lines.slice(0, COLLECT_MAX_LINES) can cut off the COLLECT: summary and the REVIEW_COVERAGE_INCOMPLETE result line. The exit code still reports it, but the printed record loses the line that names the missing packets.
  • INFORMATIONAL scripts/resolvers/review-army.ts:101 diffBase()'s ship branch ('DIFF_BASE=') is now dead: its only callers (line 136 in generateSpecialistDispatch and line 350 in generateRedTeam) run only for /review, since /ship returns generatePacketDispatch early and the ship Red Team branch builds a packet. The docstring above it still describes /ship writing the sha into each dispatched prompt, which packets now do via --range.
  • INFORMATIONAL ship/sections/adversarial.md:101 The new packet paragraph says the adversarial packet carries 'the prompt below', but this diff deleted the native subagent prompt that used to follow; the next prompt below is the Codex outside-voice prompt, so a reader is pointed at the wrong text. The native prompt now lives only in lib/review-prompts.ts (ADVERSARIAL_NATIVE).
  • INFORMATIONAL lib/review-prompts.ts:15 FIXTURE_PATHSPECS uses bare 'test' (git's default fnmatch without FNM_PATHNAME), so reviewerDiff strips every path containing the substring 'test' from the security, Red Team and adversarial packets, not just tests: e.g. attestation/latest/contest-named source, and in this very diff ship/sections/test-coverage.md(.tmpl) prose landed in the summary-only stat. Before, those reviewers could run git themselves; the packet's read budget now forbids git commands and caps reads at 5 x 200 lines, so security-relevant source with 'test' in its path gets no full adversarial read and nothing flags the gap.
  • INFORMATIONAL lib/review-packet.ts:222 draftFor calls reviewerDiff once per DISPATCH line, so a standard/full plan with ~8-10 reviewers reruns the whole-branch git diff -U8, git diff --stat, git ls-files --others, and one git diff --no-index subprocess per untracked file (line 85) for every reviewer, although most reviewers share the same (exclude, summary) inputs. On a large branch with many untracked files, build time and process spawns scale as reviewers × (3 + untracked) instead of once.
  • INFORMATIONAL lib/review-packet.ts:183 When a reviewer shards, writePackets re-runs shardChunks over every chunk on each step of a loop that grows the budget by 5% until it reaches the cap (it can take dozens of iterations). shardChunks recomputes Buffer.byteLength(cur) on every add (line 105) for a buffer of up to ~200 KB, so each call costs O(chunks × shard bytes). A diff with thousands of small files therefore rescans hundreds of MB per iteration, and builds on exactly the large diffs that need sharding become slow.
  • INFORMATIONAL [ADVISORY] lib/review-packet.ts:163 PacketDraft.tail is always [] (draftFor line 221 and auditDraft line 241 both set tail: []) and render spreads it at line 168; no producer ever fills it
  • INFORMATIONAL [ADVISORY] scripts/resolvers/review-army.ts:101 diffBase() keeps a /ship branch ('DIFF_BASE=') and a /ship docstring that nothing reaches now: its only callers are the /review specialist prompt (after the new ship early return at line 106) and the non-ship Red Team branch (line 350)
  • INFORMATIONAL lib/review-packet.ts:253 A partial build keeps earlier reviewers' entries and their old .out files, so the fixed fix-check directory can feed stale results into collect. Every fix-check builds into the same .gstack/tmp/review-packets-fc with --only fix-check,outside-voice, which sets partial=true. Line 253 keeps every prior entry that this build did not rebuild, and writePackets only clears the out files of packets it rewrites. Suppose a later pass's plan does not list outside-voice, but an earlier fix-check did. Collect then reads the earlier fix-check's outside-voice output as current coverage while the manifest header shows the new head and diff_base. A stale CRITICAL sends the pass to decision 2, and a stale missing or invalid result makes REVIEW_COVERAGE_INCOMPLETE that no dispatch in this pass can clear.
  • INFORMATIONAL lib/review-packet.ts:252 Both audits build into one directory without --only, and that wipes the other audit's files. Step 7 (test-coverage.md.tmpl:17) and Step 8 (plan-completion.md) both use --out-dir .gstack/tmp/review-packets-audit. Because neither build passes --only, line 252 deletes every prior entry's .out and packet file and rewrites the manifest with only the new audit. So the plan-completion build deletes the test-coverage audit's result file. If Step 7's child is still writing, or a later step or a Steps 6-8 repeat rereads that out= path, the audit reads as missing.
  • INFORMATIONAL bin/gstack-review-packet:94 Relative input paths resolve against two different directories. --out-dir (line 71) and --plan-file are resolved before livePlan, which calls process.chdir(root). --findings (94), --fix-list, --tests, --callers (111) and --context (84) are read after the chdir, so they resolve against the repository root. Run from a subdirectory, build --only red-team --findings "$_PK/merged.jsonl" reads a different path than the $_PK that build wrote and collect resolves (collect has no chdir). The red-team build then fails as unreadable, or picks up another tree's merged.jsonl.
  • INFORMATIONAL ship/sections/plan-completion.md:58 Step 7 (test-coverage, ship/sections/test-coverage.md:19) and Step 8 (plan-completion) both build into .gstack/tmp/review-packets-audit without --only, so the second build runs non-partial writeManifest, which rm's the first audit's out file and its packet file and replaces the manifest. If the two audits are dispatched together, or if the Step 7 out is reread after Step 8 builds, the first reader loses its packet or result and falls to the audit-failure path.
  • INFORMATIONAL lib/review-packet-collect.ts:148 complete counts only missing or invalid results, so a pending (deferred, never built) red-team still exits 0. Only prose ('Step 9.4 needs a collect with pending=0') blocks it, so a parent that gates on the exit code, as REVIEW_COVERAGE_INCOMPLETE suggests, skips the Red Team silently.
  • INFORMATIONAL bin/gstack-review-packet:119 The red-team follow-up build is told to reuse 'the Step 9.1 build's flags', which are fixed before any specialist CRITICAL exists, so --critical-found is absent. If planReview lists red-team on code class only under --critical-found, the rebuilt plan has no red-team dispatch and the --only red-team build writes zero packets but still exits 0 with PACKETS: n=0. The Red Team never runs and nothing flags it. Unverified: it depends on review-depth.ts, which is outside this diff.
  • INFORMATIONAL lib/review-packet-collect.ts:79 mergeFindings merges by identity even when both findings come from the same reviewer, and identity falls back to path:category when line is missing or is a string. Distinct findings in one file (common for adversarial findings without a line) collapse into one, and only the higher-confidence summary and fix survive. A reviewer that copies the contract's literal fingerprint 'path:line:category' collapses all of its findings. The dropped defect never reaches merged.jsonl or Fix-First.
  • INFORMATIONAL lib/review-packet-collect.ts:51 A JSON line with severity CRITICAL that fails validFinding (a specialist or red-team finding without a numeric confidence, category or specialist) is counted as invalid_lines and dropped. If any other line is valid the reviewer reads status=findings, collect exits 0, and the blocking finding disappears.
  • INFORMATIONAL lib/review-prompts.ts:15 In git's default pathspec matching, 'test' matches any path containing 'test', including latest-, attest/attestation and ship/sections/test-coverage.md(.tmpl). The security specialist, Red Team and adversarial packets therefore see those product and gate files only as a stat, and the packet read budget forbids git commands, so the reviewer cannot recover them. This review got test-coverage.md's gate prose changes as a stat only.
  • INFORMATIONAL lib/review-packet.ts:180 When a packet's fixed part (inlined checklists, 8 KB plan, and a full --stat repeated in every shard) reaches the 200 KB cap, budget clamps to 1. Every hunk then becomes its own oversize shard, so a wide diff (thousands of files) can produce thousands of reviewer packets and subagents, each still over the cap.
  • INFORMATIONAL lib/review-packet.ts readRanges lets a single line longer than READ_CHUNK_BYTES become its own range over the read budget. That is the exact silent-truncation case read= exists to prevent: a minified one-line JSON or a long generated line under DATA_SUMMARY_LINES (400 changed lines) rides the diff whole. The read= test only builds short export const lines, so this branch is neither tested nor surfaced to the reviewer.
  • INFORMATIONAL lib/review-packet.ts:86 The JSDoc for reviewerDiff ("The reviewer's DIFF_CMD at -U8 ... split per file; fixtures go to a stat in summary mode") was left in place when DATA_FILE, MANIFEST_FILE, topLevelKeys and dataSummary were inserted below it, so it now attaches to const DATA_FILE, and reviewerDiff (which gained a keepData parameter and data summaries) has no doc comment. Editors and hover docs show the wrong text on both symbols.
  • INFORMATIONAL lib/review-packet.ts:305 writeManifest now reads the manifest into old at the top, but the cleanup loop calls readManifest(dir) a second time and names its loop variable old, which shadows the outer old manifest. The loop's old is a PacketEntry while the outer one is a Manifest, so a later edit inside the loop that means the manifest silently gets the entry.
  • INFORMATIONAL lib/review-packet.ts:125 reviewerDiff now replaces any .json/.jsonl/.ndjson/.csv/.tsv chunk with more than 400 changed lines by a DATA SUMMARY (top-level keys plus the first and last 40 changed lines) for every role, the security specialist, Red Team and adversarial pass included. MANIFEST_FILE exempts only package/tsconfig/*.config.json, so JSON that carries executable or permission configuration (.claude/settings.json hooks and permissions, .mcp.json server commands, a hooks.json, a policy/allowlist file) is hidden from the security reviewers once a change to it is large enough. That opens a review blind spot: an inserted command or a widened permission in the middle of a big change never reaches a reviewer, who can only ask the parent for a line range they have no reason to ask for.
  • INFORMATIONAL lib/review-packet.ts:92 topLevelKeys reads the whole data file and, for .jsonl/.ndjson/.csv/.tsv, splits the entire text just to use its first line; dataSummary calls it once per reviewer packet (draftFor/auditDraft each run reviewerDiff), so a large summarized data file is read and, for .json, fully JSON.parse'd once per reviewer in a build. Bounded and only on the >400-changed-line path, so not blocking.
  • INFORMATIONAL lib/review-prompts.ts:87 The new packetBrief requires the file-reading tool and forbids cat for every host, and review-army.ts and outside-voice-steps.ts render it into the Claude Code Agent-tool brief as well. Claude Code's Read tool truncates any line longer than 2000 characters, so a packet line past that length (a long prose line in a SKILL.md or docs diff, or a minified or generated line) reaches a Claude Code reviewer cut short, and the brief now rules out the only other way to read it. readRanges limits bytes per range, not characters per line.
  • INFORMATIONAL lib/review-packet.ts:87 DATA SUMMARY hides everything but the first and last 40 changed lines of any .json/.jsonl/.csv past 400 changed lines from the security specialist, Red Team and adversarial pass. MANIFEST_FILE spares package-lock.json and config manifests but not lockfile-like or policy JSON such as npm-shrinkwrap.json, *.schema.json, .claude/settings.json hooks, or allowlist/quarantine JSON outside test/, so a swapped resolved URL or an added allowlist entry in the middle of a large change reaches no reviewer.
  • INFORMATIONAL lib/review-packet.ts:227 Step 7/8 audit packets are no longer sharded or capped, so a large branch's audit packet grows without bound; read= ranges split the reads, but the audit model still has to hold the whole diff in context. Past the reviewer's window (about 800 KB of diff) the audit cannot complete, where before it was split at 200 KB.
  • INFORMATIONAL lib/review-packet.ts:217 A single diff line longer than the read tool's approximately 37,800-character limit still becomes one oversized read range: the overflow branch flushes preceding lines but never splits or rejects the long line. A minified JSON addition or long source-string literal therefore gets silently truncated despite consuming every advertised range, and collect can accept a clean review of incomplete input. Provide a bounded representation or fail closed when a line cannot fit.
  • INFORMATIONAL lib/review-packet-collect.ts:48 Fix 3 fails closed on benign prose: the case-insensitive /\bCRITICAL\b/i on any unparseable line means a clean reviewer that writes 'NO FINDINGS' plus a stray line like 'Nothing critical here.' (or a valid finding plus such prose) now gets status=invalid and collect exits 3 with REVIEW_COVERAGE_INCOMPLETE. Before this fix the same output read clean with invalid_lines=1. It costs a re-dispatch and doesn't drop findings; restricting the unparseable-line match to an uppercase CRITICAL token, or to lines that look like a JSON object or a severity tag, would keep the Red Team case and drop the false trips.
  • INFORMATIONAL lib/review-packet.ts:93 Fix 1 regresses the summary for data files modified in place. topLevelKeys now parses only the changed '+' lines, so a large existing .json edited mid-file gives a fragment and prints 'top-level keys: (not parsed)', where it used to list the real keys. For a .csv/.tsv whose header row is unchanged, 'columns:' prints the first changed data row as if it were the header and mislabels it. New and deleted files still summarize correctly, which is the only shape the tests cover. Labeling the line as 'first changed line' when the chunk is not a whole-file add or delete would avoid the misleading label.

Open in Capy

@trunk-io

trunk-io Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits October 29, 2026 20:13
…t findings record (GSTA-167)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…; a test holds the packet boundary equal to it

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@garrytan
garrytan force-pushed the gsta-167-review-packets branch from 53bede3 to 1a558de Compare October 29, 2026 20:29
garrytan and others added 4 commits October 29, 2026 20:42
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…s, read= ranges, data summaries, no stale partial manifest

- --base origin/main no longer renders origin/origin/main (resolveBaseRef shared by build and audits)
- PACKET lines carry budget_role and read= ranges under 30,000 bytes; build prints BUDGET_NEXT for gstack-ship-budget --next
- each packet ends with END OF PACKET; the brief reads it with the read tool in parallel ranges, about 3 calls
- .json/.jsonl/.ndjson/.csv/.tsv additions past 400 changed lines reach reviewers as a DATA SUMMARY
- a partial build keeps other reviewers only at the same head, base and diff content
- collect: a matrix counts only from a state-machines reviewer; a CRITICAL line failing validation is invalid

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…, a stale Red Team build refuses, any-case CRITICAL lines

- topLevelKeys takes keys and columns from the diff's own lines, never the working tree, which a symlink can point at a private file (outside voice CRITICAL)
- a --findings build whose head, diff base or content differs from the manifest refuses with STALE_MANIFEST instead of dropping the specialists' coverage (adversarial + Red Team)
- collect: a CRITICAL line in any case, or one that fails to parse, makes its reviewer invalid (Red Team)
- docs and the misplaced Value header in the review-packet tests

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…es BUDGET_NEXT as the --next value

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

Copy link
Copy Markdown
Contributor

E2E Evals: ✅ PASS

[test:paid] VERDICT GREEN — lane gate/pr, attempt 1
  rule 27/27 · behavior 0/0 · judge 4/4 · quarantined 0 (0 failing the lane)
  SKIPPED 0 · INFRA 0 · INCOMPLETE 0 · unattributed 0 · ACTION REQUIRED 0
  wall 5m44s · cost $12.31 known + 2 of 31 trial(s) cost unknown

30 executed, 0 reused rule/judge records | 0 manual accepted (unscored; no score-cache credit) | $12.31 rule/judge cost | reconcile exit: 0

Profile: pr / mode pr; selected behaviors: 27, judges: 4. Deferred to scheduled/release coverage: 73 behaviors and 0 changed prompt files. Deferred checks did not run and receive no PR-pass credit.

Rule and judge shards
Shard Automated result Manual/unscored Executed Reused Status Cost
llm-judge/skill-llm-eval 4/4 0 4 0 ✅ $0.24
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-current 1/1 0 1 0 ✅ $1.11
e2e/skill-e2e-coverage-audit 1/1 0 1 0 ✅ $0.19
e2e-qa-workflow/skill-e2e-qa-workflow--qa-bootstrap 1/1 0 1 0 ✅ $0.09
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-timeout-unsettled 1/1 0 1 0 ✅ $0.17
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-recovery 1/1 0 1 0 ✅ $0.39
e2e/skill-e2e-test-value 1/1 0 1 0 ✅ $0.2
e2e/skill-e2e-plan--plan-review-report 1/1 0 1 0 ✅ $0.7
e2e-qa-callers/skill-e2e-qa-callers--ship-exploratory-unavailable 1/1 0 1 0 ✅ $0.81
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-stale-before 1/1 0 1 0 ✅ $0.4
e2e-qa-callers/skill-e2e-qa-callers--review-exploratory-small-cli 1/1 0 1 0 ✅ $0.76
e2e-qa-callers/skill-e2e-qa-callers--ship-exploratory-plan-checks 1/1 0 1 0 ✅ $0.91
e2e-qa-callers/skill-e2e-qa-callers--ship-exploratory-late-input 1/1 0 1 0 ✅ $1.08
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-late-result 1/1 0 1 0 ✅ $0.35
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-missing-asset 1/1 0 1 0 ✅ $0.37
e2e/skill-e2e-ship-hook-refresh 1/1 0 1 0 ✅ $0.1
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-launch-failure 1/1 0 1 0 ✅ $0.16
e2e/skill-e2e-ship-hook-consent 2/2 0 2 0 ✅ $0.25
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-missing-marker 1/1 0 1 0 ✅ $0.17
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-store 1/1 0 1 0 ✅ $0.84
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-completion 1/1 0 1 0 ✅ $0.95
e2e/skill-e2e-workflow 2/2 0 2 0 ✅ $0.25
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-failure 1/1 0 1 0 ✅ $0.57
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-stale-after 1/1 0 1 0 ✅ $0.4
e2e-qa-callers/skill-e2e-qa-callers--ship-exploratory-small-cli 1/1 0 1 0 ✅ $0.85
Fail-closed reconciliation
e2e-ship-docsync.test.ts#ship-docsync-completion
  slice 1  passed            135s  test/skill-e2e-ship-docsync.test.ts#ship-docsync-store
  slice 2  passed            154s  test/skill-e2e-ship-docsync.test.ts#ship-docsync-current
  slice 2  passed            141s  test/skill-llm-eval.test.ts
  slice 2  passed             30s  test/skill-e2e-coverage-audit.test.ts
  slice 2  passed             22s  test/skill-e2e-qa-workflow.test.ts#qa-bootstrap
  slice 3  passed             43s  test/skill-e2e-workflow.test.ts
  slice 3  passed             96s  test/skill-e2e-ship-docsync.test.ts#ship-docsync-failure
  slice 3  passed             77s  test/skill-e2e-ship-docsync.test.ts#ship-docsync-stale-after
  slice 3  passed            107s  test/skill-e2e-qa-callers.test.ts#ship-exploratory-small-cli
  slice 4  passed            119s  test/skill-e2e-qa-callers.test.ts#ship-exploratory-late-input
  slice 4  passed            111s  test/skill-e2e-qa-callers.test.ts#review-exploratory-small-cli
  slice 4  passed            114s  test/skill-e2e-qa-callers.test.ts#ship-exploratory-plan-checks
  slice 4  passed             77s  test/skill-e2e-ship-docsync.test.ts#ship-docsync-stale-before
  slice 5  passed             47s  test/skill-e2e-test-value.test.ts
  slice 5  passed            150s  test/skill-e2e-plan.test.ts#plan-review-report
  slice 5  passed             84s  test/skill-e2e-qa-callers.test.ts#ship-exploratory-unavailable
  slice 5  passed             72s  test/skill-e2e-ship-docsync.test.ts#ship-docsync-recovery
  slice 5  passed             29s  test/skill-e2e-ship-docsync.test.ts#ship-docsync-timeout-unsettled
  slice 6  passed             65s  test/skill-e2e-ship-docsync.test.ts#ship-docsync-late-result
  slice 6  passed             29s  test/skill-e2e-plan-ceo-plan-mode.test.ts
  slice 6  passed             60s  test/skill-e2e-ship-docsync.test.ts#ship-docsync-missing-asset
  slice 6  passed             27s  test/skill-e2e-ship-docsync.test.ts#ship-docsync-missing-marker
  slice 6  passed             27s  test/skill-e2e-ship-docsync.test.ts#ship-docsync-launch-failure
  slice 6  passed             36s  test/skill-e2e-ship-hook-consent.test.ts
  slice 6  passed             29s  test/skill-e2e-ship-hook-refresh.test.ts
[test:paid] collector final outcomes: 30 executed, 0 reused; 30 passed, 0 failed, 0 manual accepted (unscored; no score-cache credit) (30 attempt records from 25 collectors; every record counts)
[test:paid] deselected testcases, zero credit (185):
[test:paid]    159  sibling case of a case shard (its own shard runs it)
[test:paid]     25  outside the run's case selection
[test:paid]      1  periodic-tier case (this lane runs gate)
[test:paid] VERDICT GREEN — lane gate/pr, attempt 1
  rule 27/27 · behavior 0/0 · judge 4/4 · quarantined 0 (0 failing the lane)
  SKIPPED 0 · INFRA 0 · INCOMPLETE 0 · unattributed 0 · ACTION REQUIRED 0
  wall 5m44s · cost $12.31 known + 2 of 31 trial(s) cost unknown
[test:paid] exercised-path map (shadow, non-blocking): 5 MAP_GAP line(s) over 27 executed case(s) with recorded commands
  MAP_GAP plan-review-report bin/gstack-plan-reality: non-blocking for this PR; the next census refresh widens the map (docs/TESTING_INTERNALS.md#exercised-path-map)
  MAP_GAP plan-review-report browse/dist/browse: non-blocking for this PR; the next census refresh widens the map (docs/TESTING_INTERNALS.md#exercised-path-map)
  MAP_GAP ship-exploratory-late-input bin/gstack-review-plan: non-blocking for this PR; the next census refresh widens the map (docs/TESTING_INTERNALS.md#exercised-path-map)
  MAP_GAP ship-exploratory-plan-checks bin/gstack-review-plan: non-blocking for this PR; the next census refresh widens the map (docs/TESTING_INTERNALS.md#exercised-path-map)
  MAP_GAP ship-exploratory-small-cli bin/gstack-review-plan: non-blocking for this PR; the next census refresh widens the map (docs/TESTING_INTERNALS.md#exercised-path-map)
[test:paid] report: every planned shard accounted and passed

Sliced lane: planner → duration-packed executors → fail-closed report. Behavior cases run a pre-registered 3-trial panel (PASS at 2/3 with no contract violation); a PASS 2/3 is shown with its failed trial, never as a clean pass. Reused results retain their original provenance and expiry.

Dispatched narrow screen (gstack-ship-queue ready --screen) of merge commit 7380bb95f1bd1e7f5f41abce8cae42d6cbaa51f8.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@github-actions github-actions Bot changed the title feat(ship): reviewers read one packet; the parent reads a compact findings record (GSTA-167) v1.91.326.0 feat(ship): reviewers read one packet; the parent reads a compact findings record (GSTA-167) Oct 30, 2026
@capy-ai
capy-ai Bot merged commit 5358a3b into main Oct 30, 2026
62 checks passed
capy-ai Bot added a commit that referenced this pull request Oct 30, 2026
…s round 3) (#3638)

* revert(review): restore pre-#3621 reviewer briefs (GSTA-167 no-loss round 3)

Reverts the reviewer-packet parts of 5358a3b (#3621, v1.91.326.0) and
ce3a093 (#3636, v1.91.330.0). No-loss round 3
(handoffs/GSTA-167/noloss3-results.md) found the packet reviewers caught 10 of
the 19 blockers the dcd62c3 reviewers find.

Every non-stamp file is back to dcd62c3's bytes; the later main commits
959c8a6, 9184ffd and de53aef touch none of these files and are kept. Stamp
files (VERSION, package.json, agents-digest) stay at main; CHANGELOG gains an
[Unreleased] entry.

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

* test: keep the reverted reviewer-packet files gone and unreferenced (GSTA-167)

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

* docs(changelog): name the reviewer-packet guard test

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

* fix: pre-landing review fixes

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

* chore: stamp 1.91.331.0

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

---------

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