Skip to content

v1.92.37.0 fix: review briefs check template slots before pasting reviewer text (GST-797) - #3797

Merged
capy-ai[bot] merged 7 commits into
mainfrom
capy/review-briefs-check-template
Nov 1, 2026
Merged

capy-ai[bot] merged 7 commits into
mainfrom
capy/review-briefs-check-template

Conversation

@garrytan

@garrytan garrytan commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3797,
  "head": "b98def03d051fc6b81b55c461298a2269712ba09",
  "version": "1.92.29.0",
  "base": "main",
  "gate": {
    "focused": {
      "pass": 338,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "thread": "jam_01M68A3Q3474STK2VM8MSCTFGE",
  "head_tree": "037935ee0983e13bdf67ee2ccf3be59359624f19",
  "product_patch_id": "0fcf001800347a75eb47e54fbc10ffcc11ccdbee",
  "gstack_version": "1.92.30.0",
  "review_depth": {
    "depth": "light",
    "class": "code",
    "runtime_lines": 23,
    "rules": "150435b0a543019a",
    "base": "83ae96e086dede0235aa80139d93249f40b215e4",
    "registry": "83ae96e086dede0235aa80139d93249f40b215e4",
    "gate_scan": {
      "tagged": 0,
      "head": "b98def03d051fc6b81b55c461298a2269712ba09"
    },
    "reasons": [
      "runtime=23<=50"
    ]
  },
  "pregate": "requires-remote cleared @037935ee0983 (1 checks, current for b98def03d051)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/41319566684",
    "windows-free-tests.yml/windows-free-shard: https://github.com/garrytan/gstack/actions/runs/41319566665",
    "pregate.json/remote_gate: remote-gate tree=037935ee0983 tests=3396"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "README.md, AGENTS.md, CLAUDE.md, CONTRIBUTING.md, docs/, changelog.d/"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 2,
    "deferred": 0,
    "noted": 0,
    "fixed": 2,
    "scope": "frozen",
    "fix_checks": 3,
    "dispatches": {
      "specialist": 1,
      "red-team": 1
    }
  }
}

What changed

renderBrief (lib/review-brief.ts) now holds reviewer-written findings and learnings out of the render, behind a per-render token, while it fills the template's own slots and checks for unfilled ones. Then it puts them back exactly as written. A finding that quotes origin/<base>, <diff-base> or <exclude> now renders as written. Before, it failed with BRIEF_RENDER_FAILED: red-team: unfilled placeholder <base>, or its <diff-base> was silently rewritten to the diff-base sha. A slot the template itself leaves unfilled still fails.

Rendering the Red Team brief with a finding that quotes origin/<base>: main refuses, this branch renders it verbatim (image capture failed on this machine, so the text version follows: PR_SHOTS_RENDER_FAILED).

Before/after as text: Rendering the Red Team brief with a finding that quotes origin/base: main refuses, this branch renders it verbatim
--- Before · before.txt · captured output
+++ After · after.txt · captured output
 $ gstack-review-dispatch render --role red-team --findings-file findings.txt --specialists 2 ...
+BRIEF: reader=red-team sha256=58140116878750997c4096ac160a75c97fc2d74288799b5c1ddcfd7051d5d15b bytes=2320 file=<run>/shot-after/red-team.prompt.md
+exit=0
+
+$ grep -c "origin/<base> HEAD" <run>/shot-after/red-team.prompt.md
+1
-BRIEF_RENDER_FAILED: red-team: unfilled placeholder <base>
-exit=1
 

Why

#3795 (GST-774, base resolution) stopped /ship's Red Team because a specialist finding quoted the code's origin/<base>. The adversarial pass and the outside voice wait on the Red Team, so they stopped too. GStack Minder chose to fix the renderer rather than drop a reviewer on gate code (GST-797): "Decision: B. I'm not dropping a reviewer on gate code. Open the renderer fix as its own small PR now".

Proof

  • Failing first: test/review-dispatch.test.ts uses the CLI to render a red-team findings file and a specialist learnings file that quote all three slots. On main it failed with BRIEF_RENDER_FAILED: red-team: unfilled placeholder <exclude>, <base>.
  • Negative control: a section that really leaves <base> or <exclude> open still throws.
  • Byte identity: test/review-packets-removed.test.ts pins all six briefs byte for byte, and it passes unchanged. A comparison against main's renderer over 350 renders found no byte differences except on the quoted-slot inputs, which is intended. Those renders covered 7 roles and blank, multi-line and $-pattern inputs.

Open in Capy

Blast radius

renderBrief has two callers, bin/gstack-review-dispatch render and lib/review-pass.ts, and both take its output unchanged. A brief whose findings and learnings quote no slot name keeps the same bytes: test/review-packets-removed.test.ts pins all six briefs and passes unchanged, and a script compared this renderer with main's over 350 renders (7 roles; blank, multi-line and $-pattern inputs) at 873f69b with 0 byte differences (log: ~/.capy/work/gst797-bytes.log on the lane machine). The token carries a random nonce per render, so no diff or hunk text can name it (test: "reviewer text is put back only where the render held it").

Approvals

Date Asked Exact words Outcome Covers Still pending
2026-11-01 #3795's Red Team stopped on BRIEF_RENDER_FAILED: fix the brief renderer (B) or drop a reviewer on gate code “Decision: B. I'm not dropping a reviewer on gate code. Open the renderer fix as its own small PR now” (GStack Minder (Captain)) approved GST-797: the renderer fix as its own PR none

Summary

A reviewer quoting the code it reviews shouldn't stop the review. The renderer checked for unfilled slots after the reviewers' text was already pasted in, so quoted slot names looked like holes in the template. Now the check sees only the template, and reviewer text goes in last, untouched. The adversarial pass then found that the first version's put-back token had a fixed value, so a diff carrying those bytes could pull the project's learnings into the outside voice's brief. That's fixed with a per-render nonce.

Test Coverage

All new code paths have test coverage. Coverage: deterministic (each of 1 changed runtime files has a changed test naming it; no audit reader).

  • Failing first: test/review-dispatch.test.ts "findings and learnings that quote slot names render verbatim" renders, through the CLI, a red-team findings file and a specialist learnings file that quote all three slots. On main it failed with BRIEF_RENDER_FAILED: red-team: unfilled placeholder <exclude>, <base>.
  • Negative control: "a slot the section really leaves open still refuses the render": a section that really leaves <base> or <exclude> open still throws BriefError, with quoted findings present or not.
  • Token injection: "reviewer text is put back only where the render held it": an outside-voice diff and a fix-check hunk carrying the old fixed token pass through unchanged, and the learnings don't leak. Before the nonce fix it failed: the brief contained SECRET-LEARN.

Tests ran: focused 338

Pre-Landing Review

Two findings, both fixed:

  • lib/review-brief.ts:97 (adversarial-native, pass 1; collected CRITICAL, reviewer wrote Severity: Low, Blocks: no): the put-back replaced a fixed NUL token anywhere in the brief, so a .gitattributes-crafted diff could splice learnings into the outside voice's brief or crash its render with a TypeError. Fixed with a per-render randomUUID() token and exact split/join; reproduced first, and a regression test was added.
  • changelog.d fragment (adversarial-native, pass 2 range): it published a render count without naming its run. Removed from the fragment; the count and its source are in Blast radius above.

The specialist reader (testing, security, state-machines, red-team checklists), the exploratory QA smoke (3 probes, no defects), the pass 2 red-team reader and three fix-checks found nothing. Every brief printed BRIEF_SENT match, and gstack-review-dispatch verify is clean on every ledger.

REVIEW_LOOP: passes=2 blocking_found=2 deferred=0 noted=0 fixed=2 scope=frozen fix_checks=3 dispatches=2
Gate edits: none detected (1 listed, 0 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)
Outside review: not dispatched (the review plan skips the outside voice for a code-class diff with no numeric claims).

Exploratory QA

Smoke passed, no defects (3 of 12 probes): the red-team CLI render with findings that quote origin/<base>, <diff-base>, $& and $1; the specialist CLI render with padded learnings quoting <exclude>, <diff-base> and {STACK}; and bun test test/review-dispatch.test.ts. No plan checks (no plan is bound to this branch). Browser checks: not applicable (library and CLI change).

Eval Results

evals: none run for this PR. The selector maps lib/review-brief.ts to every dependent gate case (264), but the rendered prompt bytes are unchanged for every input that doesn't quote a slot name, so no prompt that evals read moved. The train's full gate covers the rest.

TODOS

No TODO items completed in this PR.

Documentation

Status: updated. One factual edit to the reference for /ship's verbatim brief rendering, matching the GST-797 fix.

Scope: base 8cef24c to head 854adb2 (3 committed files: lib/review-brief.ts, test/review-dispatch.test.ts, changelog.d/capy-review-briefs-check-template.md); no staged, unstaged or new files. I checked the docs that cover review dispatch (docs/review-policy.md), the changelog fragment and its README, and the top-level instruction docs.

Documentation health:

  • docs/review-policy.md: Updated (Verbatim dispatch, item 1: an unfilled slot also refuses the render, except for fix-check and the outside voice; findings and learnings go in after that check and reach the reader as written, so a quoted origin/<base> neither fails the render nor gets filled, GST-797)
  • changelog.d/capy-review-briefs-check-template.md: Current (fragment left untouched)
  • changelog.d/README.md: Current
  • AGENTS.md: Current

Coverage: all shipped features have adequate documentation. The change fixes internal render behavior and adds no new public surface; the reference now states the contract. No architecture diagram drift.

Debt: docs/review-policy.md is reachable only through other docs, not directly from README.md or CLAUDE.md (this predates the PR).

Test plan

  • bun test on review-dispatch, review-packets-removed, review-dispatch-origin-base, review-pass, review-targeted, ship-budget-reader-drift, ship-driver, prose-voice-floor, spawnsync-timeout-tripwire, module-size-ratchet, parity-suite, review-depth, review-loop-budget-wording, autoplan-token-efficiency: 338 pass, 0 fail (ship lane focused)
  • bun run typecheck: 0 errors
  • Remote pregate on Ubicloud at the frozen head (see receipt)

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

trunk-io Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 6 commits November 1, 2026 14:43
…7 adversarial)

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>
…sourced count

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…t quote no slot name

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

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot marked this pull request as ready for review November 1, 2026 15:35
@github-actions github-actions Bot changed the title fix: review briefs check template slots before pasting reviewer text (GST-797) v1.92.37.0 fix: review briefs check template slots before pasting reviewer text (GST-797) Nov 1, 2026
@capy-ai
capy-ai Bot merged commit 1ea8692 into main Nov 1, 2026
62 checks passed
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