Skip to content

Let review exclusions handle big results PRs (GST-1967) - #4184

Merged
capy-ai[bot] merged 3 commits into
mainfrom
review-exclusions-handle-big-results-prs
Nov 9, 2026
Merged

capy-ai[bot] merged 3 commits into
mainfrom
review-exclusions-handle-big-results-prs

Conversation

@garrytan

@garrytan garrytan commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Big results PRs whose captured transcripts only mention a credential's name now fit under /ship's review size limit, so data-heavy PRs like harness-evals#333 can be reviewed and shipped again.

Takeaways

  • harness-evals#333 now fits under the review ceiling. The reader's diff goes from 5,458,045 bytes to 1,061,721 (2 MB ceiling). All 20 matching patterns apply, 5,931 files are excluded and none is kept.
  • Files whose lines only name a credential ($AGENT_API_TOKEN, ${OPENAI_API_KEY}, a keychain) stop being kept. Lines that name a credential and carry a value still keep their file: a key value, OPENAI_API_KEY=sk-…, a key inside a JSON string, a key after the name, and a base64 blob.
  • Fixing the 24,000-byte cap alone made Codex CLI doesn't follow symlinks in .agents/skills/ — skills not discovered #333 worse, not better: all 2,610 kept files went to readers as excerpts, 29,782,265 bytes. git diff has no --pathspec-from-file (git 2.55 prints its usage), so the cap fix chunks git calls instead.

What changed

Which lines keep a file. Under review_exclude_paths, a data file stayed in review if any added line named a credential. Captured model prompts name $AGENT_API_TOKEN and keychains all the time, so #333 kept 2,610 trial files. Now secretValueLine (lib/review-exclude.ts) keeps a file only when a line names a credential and carries a value. That means one of two things. Either the credential scan the secrets check runs finds a secret on the line (the same scan and env-read rule as #4157), or a credential-shaped run of 20+ characters mixing upper case, lower case and digits follows the name within 200 characters. Variable references like $X are never counted as values. A key name given a value (OPENAI_API_KEY=, "GH_TOKEN": ) also counts as a name now.

The argument-byte cap. Files kept only for a secret line reach readers as an excerpt file, never through the DIFF_KEEP: command. So they no longer count toward the 24,000-byte bound, and DIFF_KEEP: leaves them out. readSelection reads both the kept files and the excerpt files in git calls of at most 24,000 argument bytes each, so no command passes Windows' limit. Kept files that a reader's command names still count toward the bound.

Why

"HARN-1's results PR harness-evals#333 couldn't get a /ship receipt." Its docs/benchmarks/*/main/trials/** pattern needed 251,063 argument bytes for its kept files, so the pattern wasn't applied, and splitting the PR doesn't help. With this change the pattern applies and the reader's diff fits under the ceiling. Measured on the real PR tree (base 5c685dfc, head dd42b9e6) through collectCommit, reviewExclude and readSelection.

Build Patterns applied Kept Reader diff bytes
main (b615592) 18 of 44 (main/trials, pilot/trials skipped) 2,610 5,458,045
cap fix only 20 of 44 2,610 (all excerpted) 29,782,265
this PR 20 of 44 0 1,061,721

Of the 21,932 matched lines in the 2,610 files, none carries a value under the new rule.

Blast radius

This changes only which files under a base review_exclude_paths pattern are kept, and how kept files are read, so repositories without that key plan exactly as before (lib/review-exclude.ts read). Pregate's secrets check is unchanged and still scans every added line. Four existing fixtures used name-only lines (curl -H $OPENAI_API_KEY) to stand for a credential line, and each now carries a base64 value so it still tests the keep, excerpt and selection paths it was written for.

Summary

Results PRs with thousands of captured transcripts couldn't get a receipt because every transcript that mentioned an API key's name stayed in review. The first commit adds the value rule and the chunked reads (c54117d), and the second moves the value rule out of the pinned review-risk module (66c98ec). A third commit (19c26dc) rewords the changelog entry so it passes the prose check.

Test Coverage

Coverage: deterministic. Each of the 4 changed runtime files has a changed test naming it (bin/gstack-review-plan, lib/review-exclude.ts, lib/review-targeted.ts, docs/ship-policy.md; map from the /ship audit). No audit reader was needed.
Tests ran: targeted 77
Tests ran: typecheck count unavailable
Tests ran: typecheck-test count unavailable

Pre-Landing Review

Full panel (forced): one batched specialist over all nine checklists, the Red Team, the native adversarial voice, an outside voice on openai/gpt-6.1-sol and the targeted secret reader. No finding fails a test or loses data. Two findings the outside voice marked blocking were kept open under the crew's blocking floor and are listed for a follow-up.

  • [CRITICAL, skipped under the blocking floor] lib/review-exclude.ts:386. A file kept only for a key=value line (no SECRET_LINE match) can't be excerpted, yet it was exempted from the 24,000-byte bound. So settleExcerpt adds it whole to one reader keep command, and 400 such files make a 32.8 to 56 KB command, past Windows' limit. The Red Team, the native voice and the outside voice all found it, and QA captures 003 and 005 replayed it. It fails closed (readers get more, never less). Follow-up: count a file as excerptable only when an added line matches SECRET_LINE, or make the excerpt use secretValueLine.
  • [CRITICAL, skipped under the blocking floor] lib/review-exclude.ts:476. readSelection concatenates every excerpt chunk's raw diff before excerpting, so the 256 MB buffer bounds each git call, not the total. A multi-gigabyte set of excerpt files could exhaust memory before the 2 MB ceiling applies. Follow-up: excerpt each chunk and keep only its output.
  • [INFORMATIONAL, skipped] lib/review-exclude.ts:92. VALUE_TOKEN allows /, so a mixed-case path with a digit within 200 characters after a credential name counts as a value and keeps the file (QA 002 and 004 replayed it). That over-keeps; it never hides a file.
  • [INFORMATIONAL, noted] lib/review-exclude.ts:102. A transcript that names a credential on one line and prints a scanner-HIGH token on the next no longer keeps its file, so readers stop seeing that token. The CI credential scan of added lines still fails HIGH tokens.
  • [Medium, noted] An excerpt can leave out the value line that kept its file, when the token check rather than the scanner found it. This omission is pre-existing.
  • [Low, noted] secretValueLine scans whole lines with no per-line limit, and a contrived 200 KB line took 7.7 s. DIFF_KEEP: now omits excerpt files, so a reader built by hand from DIFF_CMD/DIFF_KEEP sees neither. The change narrows what readers see, which crew rule 15 gates on a no-loss replay.

Outside review: completed (openai/gpt-6.1-sol, VERDICT: FINDINGS).

Review notes

The six noted findings above are below the blocking floor. The two skipped CRITICAL findings are named for the owner. No issue was filed: this unattended run files no GitHub issues.

Exploratory QA

Functional smoke on secretValueLine and secretExcerpt (pure functions, run in place, no writes). Capture 001 passed: name-only lines keep nothing, while KEY=value and a JSON key with a value keep their file. Captures 002 and 004 failed: a path after a credential name counts as a value. Captures 003 and 005 failed: a key=value-only file goes whole instead of being excerpted. The verdict is fail, on the two INFORMATIONAL findings above, which the crew's floor accepts as non-blocking. Limit: no end-to-end gstack-review-dispatch pass over a synthetic results repo was run.

Design Review

No frontend files changed, so design review was skipped.

Eval Results

No eval ran. The selector picked 116 behavioral probes only through derived references (lib/review-exclude.ts, lib/review-targeted.ts and bin/gstack-review-plan feed 252 gate cases); no prompt, template or judge text changed. They were not run under this lane's $30 tree cap. This is a validation gap the Captain can close.

Review bot comments

No review bot comments (one Trunk merge-queue notice, not a review).

Scope Drift

Scope Check: CLEAN. Intent: let review exclusions handle big results PRs (GST-1967). Delivered: the value rule for kept files, excerpt files leaving the keep bound, chunked git reads, the matching docs, and a changelog wording fix.

Plan Completion

Plan completion audit: not run (no plan is bound to this branch and no docs/designs/ file matches).

Verification Results

No plan verification items exist (bug fix, no plan file). Automatic QA is reported above.

TODOS

No TODO items completed in this PR.

Documentation

Status: current — the documentation already matches the change; no edits.

Scope: base e077053..66c98ec (2 commits, 10 files) plus one unstaged changelog.d wording edit; no staged or new files. Change: review exclusions keep a file only for a credential line that carries a value (secretValueLine), secret-line excerpt files leave DIFF_KEEP: and the 24,000-byte keep-command limit, and kept/excerpt reads are split into chunks under that limit.

Documentation health:

  • docs/ship-policy.md — current (secret-line reason, keep-command limit, excerpts section updated in the branch)
  • docs/troubleshooting.md — current (skipped-pattern and still-over guidance updated)
  • docs/review-policy.md — current (reader selection description still accurate)
  • changelog.d/review-exclusions-handle-big-results-prs.md — current (reviewed only)

Coverage debt: secretValueLine (internal) has reference coverage in ship-policy.md; no user-facing gaps. Advisory: the secret-line excerpts paragraph's "results PRs need this" rationale predates GST-1967 and now reads as history. Diagram drift: none.

Test plan

  • bun test test/review-exclude.test.ts test/review-secret-excerpt.test.ts test/review-reader-selection.test.ts test/review-exclude-secret-value.test.ts test/review-packets-removed.test.ts test/module-size-ratchet.test.ts: 77 pass
  • bun run typecheck: exit 0
  • bun run typecheck:test: exit 0
  • CI free suite at 66c98ec (run 42552587766): 41 checks green, carried as the remote gate
Agent notes
  • Bypass tests (test/review-exclude-secret-value.test.ts) were written first and failed before the fix. Six value lines keep their file, and six name-only lines (two copied from Codex CLI doesn't follow symlinks in .agents/skills/ — skills not discovered #333's captures) keep nothing, both for secretValueLine and through gstack-review-plan --json. A 260-file excerpt-only fixture past the 24,000-byte bound now applies its pattern, and under GIT_TRACE every git diff it runs stays under the bound. The same files named by code still skip the pattern.

  • Known narrowing: a data file whose only value is a bare key on a line that names no credential, next to name-only lines, is now excluded. Before, those name lines kept it, by accident. Pregate's credential scan reads every added line and still fails that push.

  • secretLine (lib/review-targeted.ts) had one caller and is gone. The targeted pass's SECRET_LINE classes are unchanged, and lib/review-risk.ts (pinned to its no-loss replay, GST-1350) is untouched: the value rule lives in lib/review-exclude.ts.

  • Review follow-ups (non-blocking under the crew's floor): make the excerpt's hit rule match secretValueLine (fixes the Windows keep-command overflow and the omitted value line together), excerpt per chunk to bound memory, and drop / from VALUE_TOKEN runs that look like paths. Docs audit debt: the secret-line excerpts paragraph's "results PRs need this" rationale now reads as history.

  • Gate edits: none detected (8 listed, 4 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none). The three read hunks add a value to name-only fixture lines so they keep testing the keep path.

  • Refs GST-1967

  • REVIEW_LOOP: passes=1 blocking_found=2 deferred=0 noted=6 fixed=0 scope=frozen ledgers_read=3 dispatches=10

Approvals

No approvals recorded for branch review-exclusions-handle-big-results-prs.
Plan: exempt: bug fix
Plan check: exempt bug fix

{
  "schema_version": 1,
  "pr": 4184,
  "head": "19c26dc9c2c08850e42934f568fc61a5e2737b80",
  "version": "1.98.0.0",
  "base": "main",
  "gate": {
    "targeted": {
      "pass": 77,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "head_tree": "c404b34d9acba564b7930c311ba04bcd4a9a5b0c",
  "product_patch_id": "2f55cb280cfc0611d9df208b48580c67bf3c8210",
  "gstack_version": "1.98.0.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 81,
    "rules": "66e5174161eecc2c",
    "base": "e077053c3cbb9b3539d0e7801b7f5f904e88fed5",
    "registry": "e077053c3cbb9b3539d0e7801b7f5f904e88fed5",
    "gate_scan": {
      "tagged": 0,
      "head": "19c26dc9c2c08850e42934f568fc61a5e2737b80"
    },
    "reasons": [
      "gate-class",
      "risk:secret",
      "risk:security",
      "runtime=81"
    ],
    "risk": [
      "secret",
      "security"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @c404b34d9acb (8 checks, current for 19c26dc9c2c0)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/42556609119/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=c404b34d9acb tests=36646 skipped=89 runs=42556609119/1 profiles=ci-reuse/free-tests heads=19c26dc9c2c0 verified=2026-11-09T03:37:11.502Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/ (ship-policy.md, troubleshooting.md, review-policy.md), README.md, AGENTS.md, CONTRIBUTING.md, CLAUDE.md"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 2,
    "deferred": 0,
    "noted": 6,
    "fixed": 0,
    "scope": "frozen",
    "rounds": 1,
    "ledgers_read": 3,
    "dispatches": {
      "specialist": 9,
      "red-team": 1
    }
  },
  "review_targeted": {
    "classes": [
      "secret"
    ],
    "rules": "8811fd300bf305f0",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "2f55cb280cfc0611d9df208b48580c67bf3c8210",
    "status": "done",
    "findings": 1,
    "raised_by": "targeted"
  }
}

Open in Capy

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

trunk-io Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits November 9, 2026 02:44
… stay at their replayed bytes

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