Skip to content

fix(review): skip the first-pass standalone Red Team on gate and large diffs (GSTA-167 PR A, Round 7 no-loss) - #3702

Closed
garrytan wants to merge 7 commits into
mainfrom
gsta-167-first-pass-red-team
Closed

garrytan wants to merge 7 commits into
mainfrom
gsta-167-first-pass-red-team

Conversation

@garrytan

@garrytan garrytan commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3702,
  "head": "c5036a6681e6ec2afdbc8634e55322344bf5befc",
  "version": "1.91.372.0",
  "base": "main",
  "gate": {
    "focused": {
      "pass": 357,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "head_tree": "7ac6e90eb9a7c8e84ef355631721e0e815b49ea0",
  "product_patch_id": "fca0aa479dce458cce2897ff6132874d06a6a781",
  "gstack_version": "1.91.372.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 86,
    "rules": "150435b0a543019a",
    "base": "2d1b55d7621df1a71e02037c79b63b7ee2fdc64f",
    "registry": "2d1b55d7621df1a71e02037c79b63b7ee2fdc64f",
    "gate_scan": {
      "tagged": 0,
      "head": "c5036a6681e6ec2afdbc8634e55322344bf5befc"
    },
    "reasons": [
      "gate-class",
      "runtime=86>50"
    ]
  },
  "pregate": "requires-remote cleared @7ac6e90eb9a7 (1 checks, current for c5036a6681e6)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/41238053430",
    "windows-free-tests.yml/windows-free-shard: https://github.com/garrytan/gstack/actions/runs/41238053503",
    "pregate.json/remote_gate: remote-gate tree=7ac6e90eb9a7 tests=8380"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/, README.md, CHANGELOG.md, changelog.d/ (audited docs/review-policy.md, the changelog.d fragment, lib/review-depth.ts)"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 5,
    "fixed": 2,
    "scope": "frozen",
    "fix_checks": 3,
    "dispatches": {
      "specialist": 2,
      "red-team": 2
    }
  },
  "carry": {
    "from": "7d8eda991c9e6e16fa090e8972bf68acff567acb",
    "reason": "base merge + test-only change + release metadata",
    "product_patch_id": "fca0aa479dce458cce2897ff6132874d06a6a781",
    "changed_paths": [
      "metadata:CHANGELOG.md",
      "metadata:VERSION",
      "metadata:agents-digest/gstack-AGENTS.md",
      "product:bin/gstack-base-red",
      "product:bin/gstack-doctor-components.sh",
      "product:bin/gstack-eval-plan",
      "product:bin/gstack-pregate",
      "product:bin/gstack-review-dispatch",
      "product:bin/gstack-ship-receipt",
      "product:captain/templates/brief.md",
      "product:capy/skill/gstack/SKILL.md",
      "product:docs/TESTING_INTERNALS.md",
      "product:docs/captain.md",
      "product:docs/cso-release-qualification.md",
      "product:docs/pregate.md",
      "product:docs/review-policy.md",
      "product:docs/ship-policy.md",
      "product:docs/troubleshooting.md",
      "product:docs/unattended.md",
      "product:eval-plan/SKILL.md",
      "product:eval-plan/SKILL.md.tmpl",
      "product:lib/base-red.ts",
      "product:lib/capy-review-pass.js",
      "product:lib/cso/images/build-inputs.json",
      "product:lib/eval-plan.ts",
      "product:lib/headless-artifacts.ts",
      "product:lib/pregate/config.ts",
      "product:lib/pregate/index.ts",
      "product:lib/result-codes-eval.ts",
      "product:lib/result-codes-release.ts",
      "product:lib/result-codes.ts",
      "product:lib/review-brief.ts",
      "product:lib/review-ledger.ts",
      "product:lib/review-pass.ts",
      "product:lib/run-evidence.ts",
      "product:lib/ship-policy.ts",
      "product:lib/ship-receipt.ts",
      "metadata:package.json",
      "product:scripts/cso-image-matrix.ts",
      "product:scripts/pr-dependencies.ts",
      "product:scripts/ubicloud/pregate-remote.sh",
      "product:scripts/ubicloud/ubi-runner.sh",
      "product:ship/sections/pr-body.md",
      "product:ship/sections/pr-body.md.tmpl",
      "product:ship/sections/tests.md",
      "product:ship/sections/tests.md.tmpl",
      "test:test/base-red.test.ts",
      "test:test/cso-distribution.test.ts",
      "test:test/egress-receipt-wiring.test.ts",
      "test:test/eval-models.test.ts"
    ],
    "merge_commits": 1,
    "range_diff": "1:  7824a2031 = 1:  7824a2031 fix(review): drop the standalone Red Team on a change's first full pass (GSTA-167 PR A, no-loss replay V7)\n2:  8aa1bb859 = 2:  8aa1bb859 fix: pre-landing review fixes\n3:  db1405e8b = 3:  db1405e8b fix: pre-landing review fixes (Step 11: key the first-pass cut on the step history too; CRITICAL-path wording; repin lib/review-depth.ts under no-loss replay V7)\n4:  072ef1d5d = 4:  072ef1d5d review-depth: key the first-pass Red Team cut to the branch review log (GSTA-167 option a)\n5:  7d8eda991 = 5:  7d8eda991 review-plan: a malformed review-log row keeps the first-pass Red Team (GSTA-167 fail closed)\n-:  --------- > 6:  c5036a668 test(review-pass): the GST-482 worktree-brief case runs the Red Team through --critical-found (GSTA-167)",
    "covers": [
      "pre-landing review",
      "adversarial review",
      "gate integrity",
      "documentation audit"
    ],
    "reruns": [
      "CI at head (gstack-ship-queue ready requires it); test and helper code changed since the reviewed head runs there unreviewed"
    ],
    "ancestry": "linear",
    "trees": [
      "7337d179204ea268e35efeb455b54a8092ed3afb"
    ]
  }
}

What changed

First full pass on a gate-class diff: main dispatches the standalone Red Team; this branch skips it and says why (Round 7 no-loss)

First full pass on a gate-class diff: main dispatches the standalone Red Team; this branch skips it and says why (Round 7 no-loss).

Text before/after
$ gstack-review-plan --base main   # first full pass, gate class, 251 runtime lines (main)
REVIEW_DEPTH: full runtime_lines=251 rules=150435b0a543019a reasons=gate-class,runtime=251>50 codes=none
DISPATCH: specialist batched effort=medium checklists=testing,security,state-machines
DISPATCH: red-team red-team effort=full
DISPATCH: adversarial-native adversarial effort=full
DISPATCH: outside-voice outside-voice effort=host
$ gstack-review-plan --base main   # first full pass, gate class, 251 runtime lines (this branch)
REVIEW_DEPTH: full runtime_lines=251 rules=e9281c6c3758ea0f reasons=gate-class,runtime=251>50 codes=none
DISPATCH: specialist batched effort=medium checklists=testing,security,state-machines
DISPATCH: adversarial-native adversarial effort=full
DISPATCH: outside-voice outside-voice effort=host
SKIP: red-team (first full pass; Round 7 no-loss)

Why

Garry asked for "95% of the outcome with 50% of the tokens", and the crew rule says a reviewer cut merges only after its preregistered no-loss replay passes. That replay (GSTA-167 Round 7, handoffs/GSTA-167/noloss7-results.md) removed the standalone Red Team from first full passes and still found 32 of the 41 panel blockers against 33, a one-sided non-inferiority p of 0.00074 at a margin of 4. So /ship now skips that reader on a branch's first full pass at gate class or past 200 runtime lines, and keeps it everywhere the replay did not measure. A branch counts as new only when its review log has no earlier review row, so a /ship restarted after a stop keeps the Red Team (GSTA-167 option a).

Blast radius

Only planReview in lib/review-depth.ts and its caller bin/gstack-review-plan change (the caller now reads the branch review log through reviewPaths from lib/ship-budget.ts), and only the first-full-pass gate-class and >200-line terms; every other dispatch is byte-identical to main (render hashes of all seven brief roles match main 44eeeb3, and the targeted-reader superset check allows exactly the first-pass Red Team to drop on its four first-pass full fixtures). The DEPTH_RULES hash moves (150435b0a543019a to e9281c6c3758ea0f); nothing compares it against stored receipts, it is only recorded (script ran: the focused suites and the remote free tier pass).

Approvals

Date Asked Exact words Outcome Covers Still pending
2026-10-31 Approve the GSTA-167 reviewer-tokens plan (autoplan-20261031135232 gate_rev 2): drop first-pass Red Team as PR A, gated on V7 “rec, recorded, split, $90” (Garry (via GStack Minder)) approved PR A may be opened if V7 passes, and merges after its own /ship none

Source: gstack-approvals record for gsta-167-first-pass-red-team (display only; not an approval citation).

Summary

The first full review pass of a /ship run no longer dispatches the standalone Red Team on gate-class diffs (a classifier error or --depth-floor full included) or code diffs past 200 runtime lines. The plan prints SKIP: red-team (first full pass; Round 7 no-loss). The Red Team still runs on a small diff raised to standard, whenever --critical-found is given, on every post-fix full pass and on the scoped pass. A repeat plan that leaves out --pass also keeps it, because the cut also requires no earlier step (h.last === 'none'). The cut also requires that the branch's review log hold no diff-review row: a /ship restarted after a stop on a branch an earlier run reviewed keeps the Red Team, and so does a run whose log can't be read or holds a line that isn't valid JSON. gstack-review-plan --json reports this as reviewed_before. The Red Team prose in review-army.md is unchanged: lib/review-brief.ts extracts it on every render, and post-fix and scoped passes still use it. docs/review-policy.md records the rule, its evidence, the light-versus-standard inversion this leaves and the follow-up arm light needs.

Test Coverage

All new code paths have test coverage (Coverage: deterministic; each changed runtime file has a changed test naming it).
Failing-first: the four cut cases and the DEPTH_RULES move failed on main 44eeeb3 while the five kept-path guards held; the pass-count guard case failed before its fix. The review-records tests (a restart with records keeps the Red Team, no records takes the cut, an unreadable log keeps it) failed at db1405e, where the thirteen existing cases still held. The malformed-log case (a log of only malformed rows keeps the Red Team; an empty log still takes the cut) failed at 072ef1d.
Tests ran: focused 357 (15 files at 7d8eda9), 0 failed; the wider 57-file lane at 072ef1d had no failures
Tests ran: remote free tier (Ubicloud, tree 7337d17) 8324, 0 failed

Pre-Landing Review

Pass 1 (installed main's plan, which dispatched the Red Team on this gate diff): specialists no findings; Red Team two informational doc findings, fixed on pass 1 (8aa1bb8); one fix-check, one informational noted (depth table wording, fixed with the Step 11 batch). Step 11: native adversarial (Opus 5.5 high) raised two FIXABLE items, Blocks: no, which the label rule rates CRITICAL: a repeat plan without --pass dropped the post-fix Red Team, and the docs overstated the CRITICAL path. Both fixed in db1405e with a failing-first test. Outside voice (gpt-6.1-sol medium): no findings, recommendation accept. Pass 2 (post-fix, full, Red Team dispatched): specialists no findings; Red Team one informational, noted below. Re-READY after the Captain's option a (072ef1d): one fix-check (Opus 5.5 high) over db1405e..072ef1d found one informational item, noted below; the gate scan tagged nothing. Main merge (Rule 19 grant, 995f80b) and the GST-482 test fix (c5036a6): one fix-check (Opus 5.5 high) found nothing; it confirmed that every rendered role gets the worktree tail, so the cut drops no brief GST-482 needs. Fail-closed follow-up (7d8eda9): one fix-check (Opus 5.5 high) over 072ef1d..7d8eda9 found two informational items, noted below; the gate scan tagged nothing.

REVIEW_LOOP: passes=2 blocking_found=0 deferred=0 noted=5 fixed=2 scope=frozen fix_checks=3 dispatches=4

Gate edits: none detected (18 listed, 13 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)

Assertion changes made on purpose (listed as gate edits):

  • test/review-depth.test.ts: eight existing tests that expected a first-pass Red Team (gate class and hit-rate gating, efforts, --all-specialists, GSTA-131 coverage, the six fail-closed matrix cases, the captured gate fixture, the standard 400-line plan) now assert none on pass 1 and assert it on a post-fix history.
  • test/review-pass.test.ts: four pass-program tests (x1p1, x2p1, x5p1, x12p1) move to a post-fix pass so "stops before the Red Team" and the resume checks still exercise a Red Team.
  • test/review-targeted.test.ts: the dispatch-superset check allows exactly red-team red-team effort=full to drop on its four first-pass full fixtures; the MAIN table stays as recorded at 8be7f21.
  • test/review-packets-removed.test.ts: lib/review-depth.ts repinned under the new no-loss replay id V7 (now 709e8248, after option a only narrowed the cut); the V7 description now says "the first full pass of a branch with no earlier review record".
  • bin/gstack-review-plan: the first-pass cut now depends on the branch review log, and an unreadable log keeps the Red Team. DEPTH_RULES stays e9281c6c3758ea0f.
  • Added: test/review-depth.test.ts (reviewedBefore keeps the Red Team) and test/review-plan-cli.test.ts (through the real gstack-review-log).
  • test/review-pass.test.ts (after merging main with v1.91.379.0 fix: review readers work in the checkout /ship ships (GST-482) #3701, GST-482): the case "a reader that works in the checkout its brief names passes, and every brief names the worktree" is a first full-depth pass with no review log, so this PR's cut left two readers and its > 2 guard failed (train 72). With the cut disabled, the same tree creates three readers and passes, so the count stood only for "the Red Team stage renders too". The case now passes --critical-found so the Red Team stage still renders, keeps > 2, adds the exact list of three reader titles, and still checks that every brief ends with the worktree tail.

Outside review: gpt-6.1-sol medium, completed, no findings.

Review notes

  • Resolved (pass 2 Red Team, informational): a fresh /ship after a stop used to reset the pass count and lose the Red Team. The owner chose option a: the cut now keys to the branch review log, so that path keeps the Red Team.
  • Noted (re-READY fix-check, informational): the help text says "from an earlier run", but the lookup counts any diff-review row on the branch. One path (review-army decision 1 re-planning pass 1 after the 9.4 row) gets an extra Red Team; that only adds review.
  • Resolved (trail review, then the owner's fail-closed ruling): a review-log line that isn't valid JSON now keeps the Red Team, the same as an unreadable log (7d8eda9).
  • Noted (fail-closed fix-check, informational): --json reports reviewed_before: true for a log with a malformed line, while the docs keep null for an unreadable log. The Red Team decision is the same either way.
  • Noted (fail-closed fix-check, informational): the --help text names an unreadable log but not a malformed line; the docs and changelog carry both.
  • Noted (Step 11, investigate): the replay's one loss (3527 B1, a gate-bypass) is accepted under the preregistered margin; a classifier error now gets less pass-1 review, consistent with gate class.

Exploratory QA

Smoke, report-only, on the branch's bin/gstack-review-plan in a scratch repository: gate diff pass 1 prints SKIP: red-team (first full pass; Round 7 no-loss); --critical-found and a post-fix history dispatch it; a light diff keeps the batched red-team checklist; --depth-floor standard on a small diff dispatches it; --depth-floor full runs as gate class and skips it (documented). All checks passed.

Design Review

No frontend files changed — design review skipped.

Eval Results

bun run eval:select selects every dependent gate case through lib/review-depth.ts (260 cases); none ran in this lane. The train gate (gstack/full-gate) runs them. The behavior change itself is certified by the preregistered Round 7 no-loss replay.

Plan Completion

Plan completion audit: not run (no plan is bound to this branch and no docs/designs/ file matches). The plan is handoffs/GSTA-167/reviewer-tokens-plan.md section 4 step 2 in the GStack Minder drive.

TODOS

No TODO items completed in this PR.

Documentation

Status: current. The docs already describe the GSTA-167 first-pass Red Team cut accurately, so no edits were made.

Scope: 10 files changed in 5 commits (44eeeb3..7d8eda9; option a updated docs/review-policy.md and the changelog fragment for the review-log condition), with no staged, unstaged or untracked changes. The public surface change is RED_TEAM_FIRST_PASS (false) in lib/review-depth.ts, which drops the standalone Red Team on an invocation's first full pass at gate class or past 200 runtime lines and moves the DEPTH_RULES hash. No skill, command, flag or env var changed.

Documentation health:

  • docs/review-policy.md: current (new first-pass section, depth table rows and Behavior changes bullet match the code)
  • changelog.d/gsta-167-first-pass-red-team.md: current (accurate; not edited by this audit)
  • ship/sections/review-army.md.tmpl, ship/DRIVER.md.tmpl, docs/model-policy.md: current (no restated Red Team trigger)
  • README.md, CONTRIBUTING.md, AGENTS.md: not affected

Coverage debt: RED_TEAM_FIRST_PASS and the first-pass rule have reference and explanation coverage in docs/review-policy.md (rule, evidence and the light-versus-standard inversion). No how-to or tutorial is needed for an internal review-depth constant. No critical gaps.

Diagram drift: none; the changed area has no diagrams.

Test plan

  • focused lane (bun test on 57 review/ship files plus parity, module-size, bun-entry and spawnSync tripwire): 15 files, 357 pass, 0 fail at 7d8eda9 (the wider 57-file lane at 072ef1d had no failures)
  • remote pregate (UBI_OWNER=gsta167 gstack-pregate --stage tests --remote --spend-cap 2 --timeout 2700 --allow-repo-commands --base main): 8324 tests, 0 failed, $0.07, VM destroyed (left=0)
  • bun run typecheck, bun run typecheck:test (814 known, none new), gen:skill-docs fresh, parity-suite and skill-size guards: pass

Attention

Reviewed by openai/gpt-6.1-sol (trail rows 61–70, merge 995f80b, test change c5036a6). No floor-level issue. The reviewer confirmed the GST-482 diagnosis and found the test change no weaker.

  • Row 64: the timing claim for gstack-ship-receipt.test.ts had no recorded run output. Row 72 supersedes it. On an idle machine, the write case hit its 5s limit once on this branch (5020 ms, then 18/0) and once on origin/main 2d1b55d (5019 ms), so it's a timing flake shared with main, not caused by this PR.
  • Row 67: the pregate spend was written as "/bin/bash.08" because the shell expanded $0. The amount is $0.08. Row 73 supersedes it.

…ss (GSTA-167 PR A, no-loss replay V7)

Round 7 arm V7 (handoffs/GSTA-167/noloss7-results.md): 32 of 41 blockers vs 33, p_NI 0.00074.
Repins lib/review-depth.ts under replay V7; DEPTH_RULES moves.

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

trunk-io Bot commented Oct 31, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

garrytan and others added 2 commits October 31, 2026 16:06
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… step history too; CRITICAL-path wording; repin lib/review-depth.ts under no-loss replay V7)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai capy-ai Bot changed the title fix(review): drop the standalone Red Team on a change's first full pass (GSTA-167 PR A) fix(review): skip the first-pass standalone Red Team on gate and large diffs (GSTA-167 PR A, Round 7 no-loss) Oct 31, 2026
@capy-ai
capy-ai Bot marked this pull request as ready for review October 31, 2026 16:53
garrytan and others added 4 commits October 31, 2026 17:23
…g (GSTA-167 option a)

A restarted /ship reset fullPasses and last, so it dropped the Red Team on
a branch an earlier run had already reviewed. gstack-review-plan now reads
the branch review log (lib/ship-budget reviewPaths, DIFF_REVIEWS rows) and
keeps the Red Team when a row exists or the log is unreadable.

Repins lib/review-depth.ts under replay V7 (the cut only narrows).
DEPTH_RULES unchanged (e9281c6c3758ea0f).

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… (GSTA-167 fail closed)

A readable log whose rows do not parse counted as no record, so it took
the first-pass cut. It now keeps the Red Team like an unreadable log;
a missing or empty log still takes the cut. lib/review-depth.ts and
DEPTH_RULES (e9281c6c3758ea0f) unchanged, so no repin.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…through --critical-found (GSTA-167)

On a first pass at full depth with no review log, PR A cuts the standalone
Red Team, so the case created two readers and its '> 2' guard failed. The
count only stood for 'the Red Team stage renders too'. --critical-found
keeps that stage in the fixture, and the case now names all three readers;
every brief must still end with the worktree tail.

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

capy-ai Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Closing this as superseded by R51, #3820 (589ff24, v1.92.45.0). R51's depth table runs the Red Team every time at full depth, and this PR's cut skips it on a branch's first full pass, so the two can't both hold. Merging main into this branch now conflicts in the review-depth code, docs and tests.

The Round 7 no-loss result stays on record as evidence for a future proposal: V7 passed with R finding 33 of 41 panel blockers and V7 finding 32 (one-sided non-inferiority p = 0.00074, margin 4 of 41). It was measured on the trigger as it stood before R51 (gate class, or more than 200 runtime lines). The full write-up is at handoffs/GSTA-167/noloss7-results.md in the GStack Minder drive.

The branch gsta-167-first-pass-red-team stays in place at c5036a6.

@capy-ai capy-ai Bot closed this Nov 1, 2026
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