Skip to content

Review reads only the tagged lines of data files the gate scan flags by content (GST-3273) - #4556

Closed
garrytan wants to merge 6 commits into
mainfrom
review-cuts-gate-tagged-data-files
Closed

garrytan wants to merge 6 commits into
mainfrom
review-cuts-gate-tagged-data-files

Conversation

@garrytan

@garrytan garrytan commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Results PRs that commit captured agent sessions can now be reviewed: when the gate scan tags a data file only because a session quotes a lint pragma, an env check or a --no-verify push, readers get those lines with context instead of the whole file.
Why: harness-evals#494 stopped at the 2 MB review limit because 25 such transcripts (11.4 MB) went to readers whole, and the only fix printed was "split the PR".
Nothing to do: code files, files tagged by their path and files whose tag spans lines still go whole, and the gate review still runs.

What changed
  • gstack-review-plan reads which tagged files have every tag on a single added line outside the gate floor (gateScanPaths), and lib/review-exclude.ts excerpts a kept gate-tagged file when it is row data, results or preregistration JSON, a .log or declared data, kept for no other reason, not renamed and not named by code. Its keep reason, the record's gate_tagged list and the review class are unchanged.
  • The excerpt (lib/review-secret-excerpt.ts) adds every line lineTags (new in lib/gate-diff/tags.ts, the floor-free half of tagHunk) tags, under its own "Gate-tagged data excerpts" heading that names the tags; secret-line files render byte for byte as before. A file with no tagged line found, or a long tagged line with no span to show, goes whole.
  • REVIEW_DIFF_TOO_LARGE gains a files= field and its "split the PR" fix names the largest files.
  • Docs: ship-policy.md#gate-tagged-data-excerpts, review-policy.md, troubleshooting.md; changelog fragment.
Tests

test/review-gate-excerpt.test.ts, written first and red on main bd04289 (REVIEW_DIFF_TOO_LARGE at 3,150,647 bytes): twelve synthetic 230 KB sessions with three tagged lines each now fit, every tagged line reaches the excerpt, and a .ts file with the same pragma, a path-tagged snapshot and a log whose tag spans two lines stay whole. A second case checks the over-limit error names its largest files; a unit case covers gateScanPaths. All synthetic data.

Agent notes

Lane GSTA-667 for GStack Minder (GST-3273), from HARN-1 / HARN-98. /ship receipt follows on this PR.

{"head":"c66291ff65486e296c1aac373d7c7878b4e61904","run":"ship-4556","status":"started","review_loop":{"passes":2,"blocking_found":3,"deferred":0,"noted":6,"fixed":3,"scope":"frozen","rounds":2,"dispatches":{"specialist":2,"red-team":2}}}
{"head":"c66291ff65486e296c1aac373d7c7878b4e61904","run":"ship-4556-r3","mark":"stop","tree":"0fa56e6102cf0153ed3d7b3efcd3331cc0d18c24"}
{"head":"f30d8ca5d45dfea983f5f69562921cbc5ed00f3b","run":"ship-4556-r4","status":"started","review_loop":{"passes":1,"blocking_found":1,"deferred":0,"noted":4,"fixed":0,"scope":"frozen","rounds":1,"est_input_tokens":33105,"dispatches":{"specialist-batched":1,"red-team":1}}}
{"head":"f30d8ca5d45dfea983f5f69562921cbc5ed00f3b","run":"ship-4556-r4","mark":"stop","tree":"0cbfbc7ef2a896ebe2d936df174f0e8ac8462095"}
{"head":"8692113e65fa024d7fc93db7747a18f80291c43e","run":"ship-4556-r5","status":"started","review_loop":{"passes":1,"blocking_found":0,"deferred":0,"noted":1,"fixed":0,"scope":"frozen","rounds":1,"dispatches":{"specialist":3,"red-team":1}}}
{"head":"8692113e65fa024d7fc93db7747a18f80291c43e","run":"ship-4556-r5","mark":"stop","tree":"ccfafa37b8f4168bbf19bf9d105ad8b95a071f11"}

Open in Capy

…by content (GST-3273)

Results PRs that commit captured agent sessions can be reviewed: a data file the gate scan tags only by its content goes to readers as its tagged lines in context. Code files, path-tagged files and files whose tag spans lines stay whole, and the over-limit error names its largest files.

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

trunk-io Bot commented Nov 20, 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 3 commits November 20, 2026 15:21
Deterministic replay over 460 main commits plus the harness-evals #494 head: the reader selection moves only for gate-tagged data files, and every tagged and secret line stays in the excerpt.

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

A data file kept for a credential value that also carried a gate-tagged line was excerpted to its tagged lines only, so readers never saw the credential. The excerpt now shows every line secretValueLine reads as a credential value.

Review-Finding: p1/specialist-batched#1 reader=security
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
On a line longer than 400 characters the excerpt showed only windows around other matches, so a credential value could be cut. The excerpt now opens a window over each credential name and the 200 characters its value may start in, the same reach the keep rule uses.

Review-Finding: p2/specialist-batched#1 reader=security
Review-Finding: p2/red-team#1 reader=red-team
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai

capy-ai Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Flaky rerun (one, same head 95a30b6): cso-macos-launcher failed terminal-agent owned lifecycle regression > owned agent starts, is replaced only after exit, and leaves a live sibling alone ("terminal-agent owner identity is unavailable") in run 44770619303. This PR doesn't touch terminal-agent or CSO code, and the same job passed at d42f03d and e01a6d2. The failed jobs were rerun once; a second failure counts as real.

garrytan and others added 2 commits November 20, 2026 17:42
…its file whole (GST-3273)

The plan no longer drops cut data files from the code-reference scan or the kept-file argument bound, so a receipt written without the gate scan content set builds the same selection. A file whose hunk still tags once its one-line tagged lines are taken out stays whole.

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

The gate scan check now runs the hunk-level detectors (removed test declarations, an empty catch across lines) on every line of each listed hunk before anything is taken out, and sends the file whole if either fires; an unreadable scan record cuts nothing. Excerpt files are named excerpt-<sha>.md now that they hold gate-tagged data too.

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

capy-ai Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Closing: superseded by a narrower design. The new PR cuts only data files that pass a strict allowlist (data extensions, no gate-floor path, kept only for the gate tag, every tag a single-line tag) and keeps everything else whole. It carries over this PR's tests and the REVIEW_DIFF_TOO_LARGE largest-files fix. A link follows when it opens.

@capy-ai

capy-ai Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Superseded by #4574, which rebuilds this change on current main as a strict allowlist: only data extensions, only off test/CI/config/snapshot paths, and only single-line tags.

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