Skip to content

feat(review): filter unreviewable content from diff context - #1008

Open
guyoron1 wants to merge 32 commits into
fullsend-ai:mainfrom
guyoron1:feat/review-diff-filtering
Open

guyoron1 wants to merge 32 commits into
fullsend-ai:mainfrom
guyoron1:feat/review-diff-filtering

Conversation

@guyoron1

@guyoron1 guyoron1 commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Heyaa : )

Watching review context get assembled, I kept seeing lockfile, minified, sourcemap and @generated hunks ride along into every dimension's prompt. No model can meaningfully assess that content, so on every mixed PR it is pure input cost.

New skills/pr-review/scripts/filter-review-diff.sh: a single awk program over a diff on stdin (gh pr diff, the forges' ### File: per-file shape, or diff --git sections). It strips:

  • lockfile sections (a self-contained list across ecosystems)
  • *.min.js, *.min.css and *.map
  • vendor/, node_modules/ and third_party/ paths
  • generated files: a generated-looking path (protobuf/codegen suffixes, generated/, dist/, build/) that carries @generated, the Go Code generated … DO NOT EDIT. marker or the protoc header in the file's first lines at the PR head, or early in the hunk

The path-shape gate is deliberate: a marker an author plants on ordinary source never hides that file from review. migrations/ paths are exempt from every rule, and path rules match case-insensitively. The filtered diff goes to stdout, byte-identical for untouched sections. A one-line-per-file exclusion summary goes only to $1, never stdout. No PR-controlled byte can forge a section boundary: both forge skills JSON-quote a ### File: path that holds a control character, " or \, and the filter dequotes it.

Wiring:

  • skills/pr-review/SKILL.md gets a new step 2c. It runs after 2b and 2a and filters every diff a model reads: pr-diff.txt, the dependency-scoped pr-full-diff.txt, and the re-review pr-incremental-diff.txt. It fails open, so any failure leaves every diff as fetched.
  • The forge skills' per-file diff commands no longer drop their own short list of generated paths, so step 2c is the one definition of "generated" for both the small-PR and the large-PR path. FILE_COUNT and LINE_COUNT still come from the unfiltered stats: routing must see the true size.
  • Excluded paths stay out of every pr_head MANIFEST and changed-file list a sub-agent gets (steps 3d and 6d), so stripped content can't come back in as a whole file.

Disclosure: each excluded file gets its own info-level excluded-content finding. It follows the provenance-warning precedent, since step 7 forbids footers. So a changed lockfile is still visible, just not reviewed. excluded-content is added to the closed category enum, and post-review treats it as non-dimensional. Disclosures are threshold-exempt at info severity.

An all-excluded PR skips dispatch and the challenger. Step 6e still runs, so injection checks, scope authorization and protected paths still apply. Protected paths are checked against the full changed-file list, excluded files included. Such a PR is never approved. post-review enforces this too: a blocking verdict with only disclosures left is downgraded to comment, and so is an approve whose only findings are disclosures that include excluded-content.

Tests: scripts/filter-review-diff-test.sh is wired into make script-test. It covers byte-identical pass-through (via cmp), each stripping rule, the added-vs-removed @generated distinction, the migration exemption, case-insensitive paths, hostile filenames under both forge framings, the summary format and stdout silence, all-stripped output, and malformed input passing through unchanged. post-review-test.sh covers the disclosure exemption and the downgrades. shellcheck clean.

Non-goals: no config knob.

Refs #1143

@github-actions

Copy link
Copy Markdown

Functional tests did not run

Functional tests run automatically for org/repo members and collaborators on pull requests.

For other contributors, a maintainer must add the ok-to-test label after the latest push.

@guyoron1
guyoron1 marked this pull request as ready for review September 1, 2026 11:47
@guyoron1
guyoron1 requested a review from a team September 1, 2026 11:47
@qodo-code-review

qodo-code-review Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Filter unreviewable content from PR review diff context

✨ Enhancement 🧪 Tests 📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Filters generated, vendored, minified, sourcemap, and lockfile sections before review context
 assembly.
• Preserves migration diffs and unfiltered PR statistics for accurate review routing.
• Discloses exclusions through info findings and adds comprehensive script regression coverage.
Diagram

graph TD
  STATS["Unfiltered Stats"] --> ROUTE["Review Routing"] --> DIFF["Unified Diff"] --> FILTER["Diff Filter"] --> CONTEXT["Review Context"] --> AGENTS["Review Agents"]
  FILTER --> SUMMARY["Exclusion Summary"] --> FINDING["Info Finding"]
Loading
High-Level Assessment

The shared streaming filter is appropriate because it gives small- and large-PR paths one deterministic policy while preserving untouched sections and avoiding full-diff buffering. Prompt-level exclusion lists would drift between paths, while filtering during forge retrieval would complicate migration exemptions and exclusion disclosure.

Files changed (4) +540 / -8

Enhancement (1) +210 / -0
filter-review-diff.shFilter unreviewable unified-diff sections +210/-0

Filter unreviewable unified-diff sections

• Introduces a Bash-compatible streaming awk filter that removes known lockfiles, minified assets, sourcemaps, vendored paths, and sections marked generated within their first five added lines. Migration paths remain exempt, retained sections pass through unchanged, and exclusions are written only to an optional summary file.

skills/pr-review/scripts/filter-review-diff.sh

Tests (1) +279 / -0
filter-review-diff-test.shCover diff filtering rules and safety guarantees +279/-0

Cover diff filtering rules and safety guarantees

• Adds regression fixtures for lockfiles, minified assets, sourcemaps, vendored paths, generated markers, migration exemptions, and mixed diffs. It also verifies byte-identical pass-through, summary formatting and isolation, empty results, malformed input, and successful exit behavior.

scripts/filter-review-diff-test.sh

Documentation (1) +50 / -8
SKILL.mdIntegrate deterministic filtering into review context assembly +50/-8

Integrate deterministic filtering into review context assembly

• Directs both small- and large-PR review paths through the shared filter while retaining unfiltered statistics for routing. Documents exclusion-summary handling and requires an 'excluded-content' informational finding listing every omitted file and reason.

skills/pr-review/SKILL.md

Other (1) +1 / -0
MakefileRun diff-filter regression tests in script-test +1/-0

Run diff-filter regression tests in script-test

• Adds the new shell regression suite to the repository's timed 'script-test' target.

Makefile

@qodo-code-review

qodo-code-review Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Action required

1. High disclosures become nonblocking ✓ Resolved
Description
blocking_count excludes provenance-warning and excluded-content solely by category, even when
such a finding has high or critical severity. A sole high-severity finding in either category can
therefore incorrectly downgrade request-changes or reject to comment.

2. Removed lines become boundaries ✓ Resolved
Description
In GitLab mode, any line matching --- a/... is treated as a new file section, even though a valid
removed diff line can have exactly that text when its original content begins -- a/.... A later
hunk is then classified using the content-derived fake path and can be silently stripped, losing
reviewable diff content and emitting a false exclusion.

3. Threshold exemptions lack tests ✓ Resolved
Description
The new provenance-warning and excluded-content threshold exemptions change production behavior
without a corresponding integration test. Existing severity-filter tests only verify removal and
downgrade behavior, leaving disclosure preservation unconstrained.

View high (7)
4. Disclosure preserves blocking verdict ✓ Resolved
Description
The threshold exemption retains excluded-content and provenance-warning findings, but verdict
downgrade still occurs only when the entire findings array becomes empty. If a threshold removes
every substantive finding while retaining an info-level disclosure, request-changes or reject
remains incorrectly blocking.

5. diff --git path split misparses ✓ Resolved
Description
parse_git_header() uses the last  b/ occurrence as the old/new path separator, so a valid
destination path containing that substring is parsed incorrectly. This can cause excluded content to
remain reviewable or reviewable content to be filtered.

6. Summary retains stale exclusions ✓ Resolved
Description
The summary file is opened only when an exclusion is emitted, so a run with no exclusions can leave
pre-existing contents intact. The consumer then interprets the stale nonempty file as current-run
output and may publish a false excluded-content finding disclosing paths that were not excluded
from the current review.

7. Disclosure suppressed by threshold ✓ Resolved
Description
The required excluded-content disclosure is assigned info severity, but the default review
threshold is low and the agent policy suppresses findings below that threshold from both the body
and structured output. Consequently, normal production reviews will omit the promised disclosure
whenever content is filtered.

8. Excluded source files still loaded ✓ Resolved
Description
The new filtering applies only to diff, while step 2b still fetches full contents for every
non-binary changed file and supplies them as source_files to sub-agents. Lockfiles, generated
files, and vendored sources therefore still consume model context, defeating the filter's primary
token-cost guarantee.

9. Binary vendored diffs bypass filtering ✓ Resolved
Description
Binary or mode-only diffs without ---/+++ markers leave old_path and new_path empty, so the
classifier cannot recognize vendored, minified, sourcemap, or lockfile paths. The newly documented
filtering mechanism therefore does not trigger for every described diff format.

10. Quoted paths evade filtering ✓ Resolved
Description
Path extraction accepts only unquoted --- a/… and +++ b/… headers, so Git-quoted paths leave
path empty and bypass every path-based exclusion. Vendored, minified, sourcemap, or lockfile
sections with characters requiring Git quoting are consequently passed through without disclosure.


Remediation recommended

11. excluded-content mislabels exclusions ✓ Resolved
Description
The required disclosure calls every omitted file “generated/lockfile,” although the filter also
excludes minified, sourcemap, and vendored files. Reviews containing only those exclusions will
publish an inaccurate description of what was omitted.

12. Description overstates marker filtering ✓ Resolved

Resolving commit: 67d63be

Description
The PR description claims any section with @generated in its first five added lines is stripped,
but the classifier only performs that check for generated-looking paths. The new test explicitly
preserves an ordinary source file containing that marker, so the stated behavior does not match the
implementation.

13. Escaped paths cannot match ✓ Resolved
Description
dequote() deliberately preserves Git octal escapes, so a summary can name
vendor/caf\303\251.min.js while the changed-file list identifies the source as
vendor/café.min.js. The orchestrator therefore cannot reliably recognize that path when omitting
excluded full-file contents, allowing filtered files back into model context.

View medium (7)
14. Escapes break summary records ✓ Resolved
Description
dequote() converts Git's \n path escape into a literal newline, so excluding a filename
containing a newline writes multiple physical summary lines for one file. This violates the
one-line-per-file contract and can make the orchestrator disclose or omit the wrong paths.

15. Quoted renames evade filtering ✓ Resolved
Description
Quoted rename to metadata is stored without dequoting and takes precedence over the correctly
parsed diff --git path. Root-level quoted renames into vendor/, or to lockfile/minified names,
therefore fail classification and remain in review context.

16. Provenance exemption is discarded ✓ Resolved
Description
The agent now retains provenance-warning below the configured threshold, but post-review.sh
subsequently removes every below-threshold finding based only on severity. At the default low
threshold, the required info-level provenance disclosure is therefore absent from the published
review.

17. Migration exemption matches substrings ✓ Resolved
Description
The exemption checks arbitrary substrings rather than path components, so paths such as
db/remigrations/package-lock.json bypass lockfile filtering. This retains content that the
documented classifier says should be excluded and suppresses its exclusion disclosure.

18. Malformed sections can disappear ✓ Resolved
Description
A section containing diff --git and a hunk but no parseable path enters pending, where an early
@generated line causes the entire section to be discarded with an empty-path summary. This
violates the script's documented fail-open behavior and can silently remove review context from
truncated or unsupported diff forms.

19. Deletion diffs buffer entirely ✓ Resolved
Description
A pending section is buffered until five added lines are seen, so deletion-only files and files with
fewer than five additions retain their entire diff in memory until the section ends. Large
deletion-heavy inputs therefore defeat the script's claimed bounded lookahead and can materially
increase awk memory usage.

20. Feature lacks linked authorization ✗ Dismissed
Description
This non-trivial feature adds a new filtering mechanism and hundreds of lines of tests without
linking an authorizing issue. The PR description explains the work but does not satisfy the explicit
linked-issue requirement.


Informational

21. Protected paths require human approval ✓ Resolved

Resolving commit: f23ddc5

Description
This PR modifies protected scripts/ and skills/ paths, which must always produce a
protected-path finding and receive human approval. The PR explains the changes, but that
justification does not remove the rule's no-auto-approval requirement.

Grey Divider

Context sources
✅ Compliance rules (platform): 57 rules
✅ Skills: 4 invoked
  code-review
  code-implementation
  pr-review
  docs-review
Review mode: ⚖️ Balanced

Grey Divider

Tip of the day
💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit a749ed8

Results up to commit cb8cc6d ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. Migration exemption matches substrings ✓ Resolved
Description
The exemption checks arbitrary substrings rather than path components, so paths such as
db/remigrations/package-lock.json bypass lockfile filtering. This retains content that the
documented classifier says should be excluded and suppresses its exclusion disclosure.

2. Malformed sections can disappear ✓ Resolved
Description
A section containing diff --git and a hunk but no parseable path enters pending, where an early
@generated line causes the entire section to be discarded with an empty-path summary. This
violates the script's documented fail-open behavior and can silently remove review context from
truncated or unsupported diff forms.

3. Feature lacks linked authorization ✗ Dismissed
Description
This non-trivial feature adds a new filtering mechanism and hundreds of lines of tests without
linking an authorizing issue. The PR description explains the work but does not satisfy the explicit
linked-issue requirement.

View medium (1)
4. Deletion diffs buffer entirely ✓ Resolved
Description
A pending section is buffered until five added lines are seen, so deletion-only files and files with
fewer than five additions retain their entire diff in memory until the section ends. Large
deletion-heavy inputs therefore defeat the script's claimed bounded lookahead and can materially
increase awk memory usage.

Results up to commit 61f404b ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. diff --git path split misparses ✓ Resolved
Description
parse_git_header() uses the last  b/ occurrence as the old/new path separator, so a valid
destination path containing that substring is parsed incorrectly. This can cause excluded content to
remain reviewable or reviewable content to be filtered.


Remediation recommended
2. Escapes break summary records ✓ Resolved
Description
dequote() converts Git's \n path escape into a literal newline, so excluding a filename
containing a newline writes multiple physical summary lines for one file. This violates the
one-line-per-file contract and can make the orchestrator disclose or omit the wrong paths.

3. Quoted renames evade filtering ✓ Resolved
Description
Quoted rename to metadata is stored without dequoting and takes precedence over the correctly
parsed diff --git path. Root-level quoted renames into vendor/, or to lockfile/minified names,
therefore fail classification and remain in review context.

4. Provenance exemption is discarded ✓ Resolved
Description
The agent now retains provenance-warning below the configured threshold, but post-review.sh
subsequently removes every below-threshold finding based only on severity. At the default low
threshold, the required info-level provenance disclosure is therefore absent from the published
review.

Results up to commit cc3f219 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. Threshold exemptions lack tests ✓ Resolved
Description
The new provenance-warning and excluded-content threshold exemptions change production behavior
without a corresponding integration test. Existing severity-filter tests only verify removal and
downgrade behavior, leaving disclosure preservation unconstrained.

2. Disclosure preserves blocking verdict ✓ Resolved
Description
The threshold exemption retains excluded-content and provenance-warning findings, but verdict
downgrade still occurs only when the entire findings array becomes empty. If a threshold removes
every substantive finding while retaining an info-level disclosure, request-changes or reject
remains incorrectly blocking.


Remediation recommended
3. Escaped paths cannot match ✓ Resolved
Description
dequote() deliberately preserves Git octal escapes, so a summary can name
vendor/caf\303\251.min.js while the changed-file list identifies the source as
vendor/café.min.js. The orchestrator therefore cannot reliably recognize that path when omitting
excluded full-file contents, allowing filtered files back into model context.

Results up to commit ccbb0aa ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. High disclosures become nonblocking ✓ Resolved
Description
blocking_count excludes provenance-warning and excluded-content solely by category, even when
such a finding has high or critical severity. A sole high-severity finding in either category can
therefore incorrectly downgrade request-changes or reject to comment.

2. Removed lines become boundaries ✓ Resolved
Description
In GitLab mode, any line matching --- a/... is treated as a new file section, even though a valid
removed diff line can have exactly that text when its original content begins -- a/.... A later
hunk is then classified using the content-derived fake path and can be silently stripped, losing
reviewable diff content and emitting a false exclusion.


Remediation recommended
3. Description overstates marker filtering ✓ Resolved

Resolving commit: 67d63be

Description
The PR description claims any section with @generated in its first five added lines is stripped,
but the classifier only performs that check for generated-looking paths. The new test explicitly
preserves an ordinary source file containing that marker, so the stated behavior does not match the
implementation.

Results up to commit 93c982d ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. excluded-content mislabels exclusions ✓ Resolved
Description
The required disclosure calls every omitted file “generated/lockfile,” although the filter also
excludes minified, sourcemap, and vendored files. Reviews containing only those exclusions will
publish an inaccurate description of what was omitted.

Grey Divider

Qodo Logo

Comment thread skills/pr-review/SKILL.md Resolved
Comment thread skills/pr-review/SKILL.md Resolved
@guyoron1
guyoron1 marked this pull request as draft September 1, 2026 12:15
@guyoron1
guyoron1 marked this pull request as ready for review September 1, 2026 12:59
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit cb8cc6d

@guyoron1

guyoron1 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

/review

@qodo-code-review

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Warning

/review is deprecated. Use /agentic_review instead (removal date not yet scheduled).

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Incomplete Detection

The 100-line buffer cap can finalize a section before its first five added lines are seen. In deletion-heavy diffs, an @generated marker among those first five additions may therefore be missed, contradicting the documented classification rule and allowing generated content into review context.

# phase == "pending": buffering, watching the first 5 added lines only.
# The decision resolves at the 5th added line or the 100th buffered
# line, whichever comes first, so a deletion-only or low-addition
# section never buffers unbounded.
buf[++buf_n] = line
c = substr(line, 1, 1)
if (c == "+") {
  sec_adds++
  if (added_seen < 5) {
    added_seen++
    if (index(line, "@generated") > 0) generated_hit = 1
  }
} else if (c == "-") {
  sec_dels++
}
if (added_seen >= 5 || buf_n >= 100) {
  if (generated_hit) { reason = "generated-marker"; phase = "strip"; buf_n = 0 }
  else { phase = "keep"; flush_buf() }
Summary Loss

Large-PR mode invokes the filter once per file, but each invocation truncates its summary destination. The instructions should require distinct temporary summaries or explicit aggregation; otherwise a shared summary file retains only the final invocation's exclusions, causing incomplete disclosure and excluded files to re-enter source-file context.

- Filter out generated files: pipe each per-file diff through the
  same `skills/pr-review/scripts/filter-review-diff.sh` the small-PR
  path uses above — one deterministic definition of "generated" for
  both paths, instead of a separate prompt-level list here. A file
  whose filtered output is empty is dropped from the concatenation;
  collect its exclusion-summary line the same way the small-PR path
  does.

@guyoron1

guyoron1 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

/agentic_review

Comment thread agents/review.md Resolved
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 61f404b

@guyoron1

guyoron1 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

/agentic_review

Comment thread scripts/post-review.sh Resolved
Comment thread scripts/post-review.sh Resolved
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit cc3f219

@waynesun09 waynesun09 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review sweep at head cc3f2196. Seven findings posted inline (1 CRITICAL, 6 MEDIUM), none overlapping the existing review threads:

  • CRITICAL — scripts/post-review.sh was edited directly; post-review.src.sh was not, so make check-bundle fails and a rebuild silently removes the new threshold exemption.
  • MEDIUM — an author-controlled @generated line removes a whole file from review on non-protected paths.
  • MEDIUM — Go/protoc canonical generated markers and context-line markers are not detected; the fixture only passes because of an extra @generated line.
  • MEDIUM — unquoted paths containing spaces carry a trailing tab on ---/+++ and are never classified.
  • MEDIUM — the filter is a silent no-op on GitLab-shaped input, with no disclosure.
  • MEDIUM — the cited route-review-model.sh / is_lock() in fullsend does not exist.
  • MEDIUM — SKILL.md step 2 now contradicts bucket 3 ("after filtering").

One further item (large-PR per-file invocations truncating a shared exclusion-summary file) is already raised in the Reviewer Guide comment under "Summary Loss", so it is not repeated here.

Review-only; not requesting changes.

Comment thread scripts/post-review.sh Outdated
# them here would undo the exemption the agent honors.
jq --argjson rank "$threshold_rank" '
.findings |= [.[] | select(
.category == "provenance-warning" or .category == "excluded-content" or

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[CRITICAL] post-review.sh edited directly; post-review.src.sh not updated (make check-bundle fails)

scripts/post-review.sh is a generated bundle (header: "GENERATED from post-review.src.sh — DO NOT EDIT. Run: make script-build"). Round 2 added the .category == "provenance-warning" or .category == "excluded-content" exemption here (lines 552-557), but scripts/post-review.src.sh (around lines 142-150) was not touched: git log dc7c805..HEAD -- scripts/post-review.src.sh is empty and neither category string appears in the src file.

Verified at head cc3f2196: make check-bundle exits 1 with Bundled script stale: scripts/post-review.sh (run make script-build), and a forced make script-build regenerates post-review.sh with the exemption and its comment removed. CI has not caught this because the script-test workflow runs on 61f404b2 and cc3f2196 both ended in action_required (never executed); the only successful run was on cb8cc6dd, before the exemption existed.

Once the bundle is rebuilt, excluded-content / provenance-warning info findings are dropped again at the default low threshold — exactly the behaviour agents/review.md:66-68 and SKILL.md step 7 now promise is exempt.

Suggested fix: Apply the jq exemption (and its comment) to scripts/post-review.src.sh, run make script-build, and commit both files together. While there, update the mirrored filter_findings_json in scripts/post-review-test.sh (around line 144, commented "keep in sync") and add cases showing provenance-warning / excluded-content survive at threshold=low while a plain info finding is dropped.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ccbb0aa — good catch. The exemption now lives in post-review.src.sh and the bundle is regenerated via make script-build; make check-bundle exits 0.

sec_adds++
if (added_seen < 5) {
added_seen++
if (index(line, "@generated") > 0) generated_hit = 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] Author-controlled @generated marker hides an entire file from automated review

Rule 3 (line 310, documented at lines 28-30) strips a whole section whenever the literal @generated appears in any of the first 5 added lines. That string is untrusted PR content: a contributor adds one // @generated comment line at the top of an ordinary source file and the section is removed from every sub-agent's diff, and step 2b (SKILL.md:178-183) then also omits its full contents. The only trace is an info-level excluded-content finding listing the path with reason generated-marker.

Verified mitigation: the protected-path check in post-review.src.sh:184-262 runs on forge_get_pr_files() (the API file list, not the diff), so changes under the default REVIEW_PROTECTED_PATHS (scripts/, .github/, skills/, agents/, harness/, ...) still force approve→comment. The bypass is therefore fully effective only on non-protected paths — but those are precisely the paths the bot is allowed to approve unassisted, which is the new exposure this PR introduces (previously small PRs were never filtered at all).

Suggested fix: Bound the marker rule: apply it only when the path also looks generated (e.g. *.pb.go, *_gen.go, *.generated.*, gen/ or generated/ components), or require the marker to appear as the first added line of a new file (--- /dev/null), and/or have the excluded-content disclosure call out generated-marker exclusions on non-generated-looking paths at a higher severity so a human notices. Document the accepted-risk boundary in the script header either way.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ccbb0aa — content-marker stripping is now gated on generated-looking paths (protoc/codegen suffixes, generated|dist|build components); a planted @generated on ordinary source keeps the section, no disclosure line. Negative test added.

if (added_seen < 5) {
added_seen++
if (index(line, "@generated") > 0) generated_hit = 1
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] Generated-file detection misses Go/protoc canonical markers and context-line markers; fixture masks the gap

SKILL.md dropped protobuf from the large-PR exclusion list and states the script is now the one definition of "generated", but the only content rule is index(line, "@generated") on added lines. protoc-gen-go emits // Code generated by protoc-gen-go. DO NOT EDIT. (the golang.org/s/generatedcode convention), and protoc's Python generator emits # Generated by the protocol buffer compiler. DO NOT EDIT! — neither contains @generated.

Verified at head: a .pb.go section whose first added lines are // Code generated by protoc-gen-go. DO NOT EDIT. / // versions: / package gen passes through unfiltered with an empty summary. The GENERATED_ADDED fixture (scripts/filter-review-diff-test.sh:96-103) contains that real Go marker but only passes because a separate +// @generated line was added beneath it.

Separately, regenerating an existing generated file leaves the header as unchanged context ( prefix), which the check never inspects (lines 305-311 only look at + lines), so the common regenerate-and-commit case is never caught either.

Suggested fix: Extend the marker check to the Go convention (^\+// Code generated .* DO NOT EDIT\.$) and protoc's Generated by the protocol buffer compiler, consider inspecting the first few context lines of the first hunk as well, and add fixtures that contain only those markers. Alternatively restore protobuf to the SKILL.md list and drop the "one definition of generated" claim.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ccbb0aa — has_generated_marker() adds the anchored Go marker and the protoc header, checked on added and context lines within the bounded window; removed-only still never strips. .pb.go context-line test added.

}
if (line ~ /^\+\+\+ /) {
p = substr(line, 5)
if (p != "/dev/null" && substr(p, 1, 2) == "b/") new_path = substr(p, 3)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] Paths containing spaces are never classified: git tab-terminates ---/+++ and +++ overrides the header path

For any unquoted path containing a space, git appends a TAB to the --- a/... and +++ b/... lines. Lines 263 and 269 take substr(p, 3) verbatim, so new_path ends in \t, and section_path() (line 158) prefers new_path over the correctly parsed hdr_new from round 1's header fallback — so the fallback never helps here. Every $-anchored rule then misses.

Verified with a real git diff at head: lib x/foo.min.js and pkg dir/package-lock.json both pass through unfiltered and the summary file is 0 bytes.

This is distinct from the existing thread at line 265 (git-quoted paths, fixed in round 1) and from test 15 (the b/ split in the diff --git line): the defect is the trailing tab on the unquoted ---/+++ lines of those same files.

Suggested fix: Strip a trailing tab in both branches (sub(/\t$/, "", p) before the a/ / b/ prefix check at lines 263 and 269), and add a fixture generated from real git output for a space-bearing lockfile/minified path.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ccbb0aa — path extraction strips from the first tab, so tab-terminated headers for spacey paths classify; regression tests use real git-shaped fixtures for both your examples.

line = $0

if (!in_diff) {
if (line ~ /^diff --git /) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] Filter is a silent no-op on GitLab input (no diff --git sections) with no disclosure

The parser only opens a section on ^diff --git (line 230); everything else is printed verbatim. skills/pr-review/gitlab/SKILL.md provides no unified-diff command — only the MR /changes API (per-file .diff hunk text) and repository/compare .diffs[], neither of which carries diff --git lines (the sibling skills/fix-review/gitlab/SKILL.md:36 synthesises only --- a/X / +++ b/Y headers).

Verified at head: a GitLab-shaped section (--- a/package-lock.json / +++ b/package-lock.json / hunk) passes through unfiltered with an empty summary.

The GitLab skill's lack of a unified-diff source is pre-existing; what this PR adds is that SKILL.md now presents the filter and its excluded-content disclosure as forge-neutral, while on GitLab nothing is filtered and nothing is disclosed.

Suggested fix: Cheapest fix: state explicitly in SKILL.md step 2 that the filter applies to the GitHub unified diff only. Otherwise either have the GitLab skill emit a diff --git a/<old_path> b/<new_path> line per .changes[] entry before the hunk text, or accept ^--- a/ as a section boundary when no diff --git has been seen, and add a GitLab-shaped fixture to the test file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ccbb0aa — sections now also open at ^--- a/ (and quoted/dev-null variants) when no diff --git header exists, so GitLab MR-shaped diffs filter; fail-open preserved. Two-section GitLab fixture test added.

# 1. EXEMPT (always kept, beats every rule below): path has a
# "migrations" or "migrate" directory component.
# 2. STRIP: path matches the dependency-lockfile list (mirrors the
# is_lock() regex in fullsend's .github/scripts/route-review-model.sh

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] Cited fullsend .github/scripts/route-review-model.sh / is_lock() does not exist

The header (lines 23-25), the classifier comment (lines 173-174: "mirrors is_lock() in fullsends .github/scripts/route-review-model.sh (lines 65-84 there)... kept in sync by hand"), and the PR description all cite a file that could not be found. Verified: the fullsend-ai/fullsend main tree (7495cdc5) has no path matching route-review*; its .github/scripts listing contains only check-fix-eligibility(-test).sh, install-openshell.sh, install-podman.sh, openshell-version.sh; git grep is_lock origin/main in that repo returns nothing; and this repo has no such file either.

The "kept in sync by hand" promise therefore points at nothing, and the lockfile list is narrower than common practice (no Pipfile.lock, uv.lock, bun.lockb, packages.lock.json, mix.lock, pubspec.lock, Package.resolved, flake.lock).

Suggested fix: Remove the cross-repo citation (or replace it with a permalink to the real location if one exists elsewhere), state that the list is self-contained here, fix the "fullsends" typo, and consider extending the lockfile list.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ccbb0aa — the citation was stale, removed; the lockfile list is described as self-contained.

Comment thread skills/pr-review/SKILL.md Outdated
deletions) — paginate if the forge API requires it
- Compute `FILE_COUNT` and `LINE_COUNT` from the response

`FILE_COUNT` and `LINE_COUNT` are computed once, here, from this

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] Step 2 contradicts itself: new "never recomputed after filtering" rule vs bucket 3 "FILE_COUNT>200 after filtering"

The new paragraph at lines 120-123 states FILE_COUNT / LINE_COUNT are computed once from the unfiltered stats response and that nothing recomputes them from post-filter output; the PR body repeats this ("routing must see the true size"). But the retained bucket 3 at line 162 still reads "FILE_COUNT>200 after filtering, LINE_COUNT>10K: emit failure".

As written an orchestrator has two incompatible instructions for the token-limit gate: with the unfiltered rule, a 250-lockfile PR fails with token-limit before the filter runs; with the bucket-3 text, it must compute a post-filter count the new paragraph forbids. The bucket-3 wording is pre-existing, but the contradiction is introduced by this PR's new paragraph.

Suggested fix: Drop "after filtering" from bucket 3 (matching the stated unfiltered-count intent), or define precisely which count bucket 3 uses and reconcile the line-120 paragraph with it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ccbb0aa — bucket 3 now names the same unfiltered counts computed in step 2, never post-filter numbers.

@guyoron1

guyoron1 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

/agentic_review

Comment thread scripts/post-review.sh Resolved
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit ccbb0aa

@guyoron1

guyoron1 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

/agentic_review

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 5ef1681

@guyoron1
guyoron1 force-pushed the feat/review-diff-filtering branch 2 times, most recently from ed79218 to 93c982d Compare September 2, 2026 16:13
@guyoron1

guyoron1 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

/agentic_review

Comment thread skills/pr-review/SKILL.md Resolved
The pre-hunk header phase has been capped at 100 lines since e388990,
but the script's own contract only described the cap on the pending
phase. State that both phases are bounded and fail open past the cap.

Signed-off-by: guy oron <goron@redhat.com>
An all-excluded PR (whose only findings are exempt info-level
excluded-content / provenance-warning disclosures) kept its `approve`
action through the `blocking_count -eq 0` branch, which only rewrote
request-changes / reject. `approve` then mapped to `ready-for-merge` —
approving content no model actually read.

Downgrade `approve` to `comment` when the only remaining findings are
disclosures, so the label logic maps it to requires-manual-review.
Rebuild the generated bundle and add an approve + disclosure-only case
to post-review-test.sh beside the existing downgrade tests.

Signed-off-by: guy oron <goron@redhat.com>
In gitlab_mode, `is_gl_candidate()` treated a `--- a/` line seen while
the section was still in the header phase as another header line rather
than a boundary. A header-only section (rename-only, mode-only or empty
diff, no `@@`) followed by a stripped section was swallowed whole:
set_old_path overwrote the path and the kept lines vanished with no
disclosure, misattributed to the next section.

Treat a `--- a/` line in the header phase as a boundary once both
old_path and new_path are already set, so finalize flushes the
header-only section first. Add a test asserting the first section's
lines survive byte-identical while the lockfile is still stripped.

Signed-off-by: guy oron <goron@redhat.com>
Three review findings on the diff-filtering change:

- Step 2c ran the filter as `${CLAUDE_CONFIG_DIR}/.../filter-...sh`,
  which is exported only by the Claude runtime; on pi/codex the path
  expanded empty, the call exited 127 and logged FILTER FAILED on every
  review. Resolve the skills root over CLAUDE_CONFIG_DIR,
  PI_CODING_AGENT_DIR and CODEX_HOME, taking the first whose checkout
  has the script. The mv stays gated: an unresolved script skips the
  command, so no empty diff is ever moved into place.

- Excluded paths were dropped from `pr_head` but still listed in
  `changed_files`, so a sub-agent iterating that list could Read a
  lockfile or vendored tree off disk. Subtract the excluded paths from
  `changed_files` too, matching `pr_head`.

- The skillsaw context-budget ceiling for this skill had been raised
  16050 -> 16815 -> 17579 for this PR's own growth, which
  CONTRIBUTING.md forbids. Shrink the skill back under 16050 instead:
  drop the step 2c prose that restated the script header (classification
  rules, arg contract, accepted risk) down to a pointer, and tighten
  verbose explanations elsewhere. Revert the baseline ceiling to 16050.

Also state in step 7 that an all-excluded PR emits `comment`, never
`approve`, documenting the enforcement added to post-review.

Signed-off-by: guy oron <goron@redhat.com>
@guyoron1
guyoron1 force-pushed the feat/review-diff-filtering branch from f23ddc5 to 67d63be Compare September 12, 2026 07:47
# Conflicts:
#	skills/pr-review/SKILL.md

@waynesun09 waynesun09 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review sweep at head 952678f8. Two findings checked against the existing threads for overlap; both posted inline (1 HIGH, 1 MEDIUM).

# follows it is header-less and starts straight at @@. Diff content
# lines begin with +, -, space or \, so a bare "### File: " at column
# 0 is always a section boundary, never content.
if (line ~ /^### File: /) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Newline in a filename forges a ### File: section boundary and hides that file's diff under a phantom path

Both forge skills (now in this PR's diff) build the per-file diff stream by interpolating the forge-supplied path raw: skills/pr-review/github/SKILL.md:45 ("### File: \(.filename)\n\(.patch // ...)") and skills/pr-review/gitlab/SKILL.md:53 ("### File: \(.new_path)\n\(.diff)"). process() at line 377 then treats every ^### File: line as an unconditional section boundary; the comment at 372-376 justifies this because diff content lines start with +, -, space or \, but never considers bytes inside the path itself.

Reproduced at head 952678f:

printf '[{"filename":"safe.txt\n### File: package-lock.json","patch":"@@ -1,3 +1,4 @@\n line1\n+eval(atob(\"bad\"))\n+another\n line3"}]' \
  | jq -r '.[] | "### File: \(.filename)\n\(.patch // "(no patch)")"' \
  | filter-review-diff.sh summary

emits only ### File: safe.txt on stdout (the whole patch is gone) and writes package-lock.json +2/-0 lockfile to the summary.

Impact chain: the diff of the author's own file disappears from every sub-agent's input; the step-7 excluded-content disclosure (SKILL.md:1329-1337) names a phantom path that is not in the PR; and the pr_head/changed_files omission (SKILL.md:679-689) keys on that phantom, so the real file's exclusion is never recorded anywhere a reviewer would see it. The author also picks the reason (vendor/x -> vendored, bundle.min.js -> minified). This defeats the header's guarantee (lines 47-48) that an author cannot hide an ordinary file from review; the "Residual risk" paragraph (50-55) covers only planted markers on generated-looking paths, not this.

Premise: the forge stores and returns a newline-bearing filename raw in the files/changes JSON (git permits such names; the repro covers the pipeline from the JSON onward).

Not a duplicate: thread 3959164256 was about ### File: not being recognised at all (its fix in 7a08cd6 introduced this boundary); thread 3911565289 was about summary-record format on git-quoted paths in the diff --git shape, where git's own quoting already prevents injection (verified: a diff --git "a/safe.txt\n### File: ..." section passes through kept).

Suggested fix: Make the framing non-injectable. One option that reuses what is already in the script: have both jq filters emit the path git-quoted when it carries control/quote/backslash bytes (e.g. "### File: \(.filename | if test("[\\x00-\\x1f\"\\\\]") then @json else . end)"), and extend the ### File: branch at line 381 to run the same quote_end()/dequote() path that header_path() uses (dequote keeps \n literal, which preserves the one-line summary contract). Alternatively reject any .filename/.new_path containing control characters at the jq stage and emit a tool-failure. Add regression fixtures in scripts/filter-review-diff-test.sh for a filename with an embedded newline in the ### File: shape, for both the GitHub and GitLab framing.

# generated — still need the bounded content-marker check before a
# final call can be made.
function classify_path( lp) {
if (path ~ /(^|\/)(migrations|migrate)\//) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] Migrations exemption (and the vendor rule) match case-sensitively while lockfile/minified/sourcemap match on the lowercased path, so the always-keep exemption can be lost

classify_path() tests the migrations exemption against raw path (line 282, path ~ /(^|\/)(migrations|migrate)\//) before lp = tolower(path) is computed at 286; the vendored rule at 298 also matches raw path. The lockfile (289), minified (292), sourcemap (295) and generated-looking (307) rules all match lp.

Reproduced at head 952678f: a DB/MIGRATIONS/package-lock.json section is stripped (DB/MIGRATIONS/package-lock.json +1/-0 lockfile in the summary) while the identical db/migrations/package-lock.json section is kept.

This contradicts the header comment at line 30 ("EXEMPT (always kept, beats every rule below)") and the PR's own test 29 comment at scripts/filter-review-diff-test.sh:802 ("Path rules are case-insensitive across the board"), which was added by the fix (13dbd27) for thread 3959164307 but whose loop covers only Cargo.lock / Bundle.MIN.JS / styles.MAP. Distinct from that resolved thread: it concerns two other rules (282, 298), and the failure direction for the exemption is the opposite — losing the exemption hides content from review rather than over-including it. Capitalised Migrations/ is a real convention (EF Core), so the case mismatch is reachable outside contrived input.

Suggested fix: Move lp = tolower(path) above the exemption check and match both the migrations exemption (282) and the vendor/node_modules/third_party rule (298) against lp, so the "across the board" claim holds. Extend test 29's loop with a mixed-case migrations case (e.g. Src/Migrations/package-lock.json expected kept, empty summary) and a mixed-case vendored dir (e.g. Vendor/lib.go expected stripped as vendored).

Conflict in skills/pr-review/SKILL.md "Formatting rules": this branch
had tightened the five existing bullets to stay under the context-budget
ceiling, and main added a new "No freeform verification sections"
bullet to the same block. Kept this branch's tightened bullets and
inserted main's new bullet verbatim, in the position main gave it
(before "No footer").

.skillsaw-baseline.json takes main's regenerated file unchanged: the
merged pr-review skill measures 16,732 tokens, under main's 16,784
ceiling.

Signed-off-by: guy oron <goron@redhat.com>
…on boundary

Both forge skills wrote the per-file diff as "### File: <path>" with the
forge-supplied path interpolated raw, and the filter treats every
"^### File: " line as a section boundary. A file named
"safe.txt\n### File: package-lock.json" therefore ended its own section
right after the header: its whole patch was stripped and the exclusion
summary disclosed a phantom package-lock.json, with a reason the author
picks (lockfile, vendored, minified). The real file's exclusion was
recorded nowhere.

Make the framing non-injectable and teach the parser the quoting:

- github/ and gitlab/ SKILL.md emit the path JSON-quoted whenever @JSON
  would alter it, i.e. it holds a control character (DEL included), a
  double quote or a backslash:
    select((@JSON | .[1:-1]) == .) // @JSON
  Deliberately regex-free: a "[\\x00-\\x1f\"\\\\]" class depends on the
  regex dialect and leaves DEL raw, and the \uHHHH spelling is not
  understood by jq's Oniguruma syntax at all (on jq 1.7.1 it degrades to
  a 0-u range that quotes every path). Ordinary and non-ASCII paths stay
  raw, so summary paths still match the changed-file list byte-for-byte.
  Written with select and // rather than if/then/else so the quoted
  program uses only constructs the neighbouring snippets already put
  through the sandbox command scanner (fullsend-ai#1190).
- filter-review-diff.sh runs the "### File:" path through the same
  quote_end()/dequote() code as git-quoted headers, via rename_path(),
  renamed bare_path() now that it serves both. dequote() keeps \n, \r
  and \u001b literal, so the summary stays one line per record.
  bare_path() is strict: an unterminated quote, or bytes after the
  closing quote, yield no path and the section fails open instead of
  being classified by a quoted prefix.
- The header comments now state the invariant the disclosure relies on
  (no PR-controlled byte can forge a section boundary, so every stripped
  section is named under its own path) and why it holds for diff content
  and for paths in the "diff --git" and "### File:" shapes. They also
  record the one shape that cannot promise it: in the header-less
  "--- a/X" form a removed "-- a/X" line plus an added "++ b/X" line is
  byte-identical to a boundary. No pr-review producer writes that form,
  and once a real header has opened the stream a ---/+++ pair is never
  taken for a boundary.

Test 30 drives the real jq programs, extracted from both forge skills,
over six hostile names per forge: the reported repro is kept under one
quoted header with no phantom record; newline and carriage-return names
on minified/vendored files get exactly one one-line record; a name
wrapped in double quotes does not dequote into vendor/; backslash and
non-ASCII names round-trip byte-exact. 14 of the new assertions fail
without the fix. It also pins that such a forged ---/+++ pair stays
content inside "### File:" and "diff --git" sections, and that trailing
bytes after a quoted path fail open.

Audited the other raw path interpolations: these two lines are the only
"### File:" producers and this script is the only parser of that
framing. GitLab frames by new_path alone, so old_path cannot inject.

Signed-off-by: guy oron <goron@redhat.com>
…itively

classify_path() tested the migrations exemption against the raw path
before computing lp = tolower(path), and the vendored rule also matched
the raw path, while the lockfile, minified, sourcemap and
generated-looking rules matched lp. So DB/MIGRATIONS/package-lock.json
and Src/Migrations/package-lock.json (EF Core's real convention) lost
the always-keep exemption and were stripped as lockfiles, hiding
content from review, while Vendor/, Node_Modules/ and THIRD_PARTY/
dodged the vendored rule.

Compute lp first and match every rule in classify_path() against it.
Audited all six: these were the only two on the raw path. The summary
still records the path as written, and the PR-head marker lookup still
opens the case-exact path. Whole-component matching is unchanged
(REmigrations/ is not exempt, Vendored/ is not vendored). The header
comment now says every path rule, the exemption included, matches the
lowercased path.

Test 29 ("case-insensitive across the board") covered only the
lockfile, minified and sourcemap rules. Its loop now also takes
Vendor/lib.go (stripped as vendored), Src/Migrations/package-lock.json
(kept, passes through, empty summary) and Api/Service.PB.GO with an
@generated line, so all six rules are pinned. The vendored and
migrations cases fail without the fix.

Signed-off-by: guy oron <goron@redhat.com>
@guyoron1

Copy link
Copy Markdown
Contributor Author

@waynesun09 — thanks, both addressed. New head 6405f31.

  • HIGH — a newline in a filename forges a ### File: boundary (a9a478d): reproduced with your command, and on the GitLab .new_path framing too.
    • Producers: both forge skills now write the path JSON-quoted whenever @json would alter it (a control character incl. DEL, a double quote or a backslash): "### File: \(.filename | select((@json | .[1:-1]) == .) // @json)\n…", same for .new_path. select/// rather than if/then/else so the quoted program uses only constructs the neighbouring snippets already put through the sandbox scanner (skills: documented shell snippets are blocked by the sandbox command scanner (time check, GitLab MR-head fetch) #1190). Regex-free on purpose: on jq 1.7.1 a \uHHHH class isn't understood by the regex engine (a class written as A matches the characters u, 0, 4, 1, not A) and ends up quoting every path, and a \x00-\x1f class leaves DEL raw. Ordinary and non-ASCII paths stay raw, so summary paths still match the changed-file list byte-for-byte.
    • Parser: the ### File: branch now takes the same quote_end()/dequote() path as git-quoted headers (rename_path(), renamed bare_path() as it serves both), so escaped newlines, carriage returns and other control escapes stay literal and the summary keeps one line per record. It is strict too: an unterminated quote, or bytes after the closing quote, fail the section open rather than classify it by a quoted prefix.
    • Comments: the header now states the invariant (no PR-controlled byte forges a boundary, so every stripped section is named under its own path) and why it holds, and records the one shape that can't promise it: header-less --- a/X, where a removed -- a/X line plus an added ++ b/X line is byte-identical to a boundary. No pr-review producer writes that shape, and such a pair stays content inside ### File: and diff --git sections (now pinned by a test).
    • Other producers audited: those two lines are the only ### File: writers and this script the only parser of that framing; GitLab frames by new_path alone, so old_path can't inject. The remaining raw interpolations (the "removed \(.filename)" manifest lines, the new_path and CHANGED_FILES listings) are main's code outside this diff and are read by the model, not by a parser, so I left them; they can be a follow-up.
    • Tests: test 30 drives the real jq programs, extracted from both skills, over six hostile names per forge: your repro is kept under one quoted header with no phantom record; newline and CR names on minified/vendored files get exactly one one-line record; a name wrapped in double quotes doesn't dequote into vendor/; backslash and non-ASCII names round-trip. 14 of its assertions fail without the fix. I also swept every C0 byte, DEL, the double quote, the backslash and the Unicode separators U+0085, U+2028 and U+2029 through both framings (those separators aren't line breaks to jq or awk): one header per file throughout, output byte-identical under BSD awk and mawk 1.3.4.
  • MEDIUM — migrations exemption and vendor rule match case-sensitively (6405f31): reproduced (DB/MIGRATIONS/package-lock.json and Src/Migrations/package-lock.json stripped as lockfiles; Vendor/, Node_Modules/, THIRD_PARTY/ kept).
    • lp = tolower(path) now comes first and every rule in classify_path() matches lp; I audited all six and these were the only two on the raw path. The summary still records the path as written, the PR-head marker lookup still opens the case-exact path, and whole-component matching is unchanged (REmigrations/ is not exempt). The header comment says so.
    • Test 29's loop now also takes Vendor/lib.go (stripped, vendored), Src/Migrations/package-lock.json (passes through, empty summary) and Api/Service.PB.GO with an @generated line, so all six rules are pinned; the vendored and migrations cases fail without the fix.

Merged upstream main: one conflict, in SKILL.md's formatting rules — kept this PR's tightened bullets and took main's new "No freeform verification sections" bullet verbatim. The baseline is main's, unchanged: the skill measures 16,732 against main's 16,784 ceiling. The filter suite (156 assertions, under bash 3.2 too), check-bundle, lint (0 errors, 0 warnings) and shellcheck are green; the rest of make script-test matches main.

@guyoron1
guyoron1 force-pushed the feat/review-diff-filtering branch from 6405f31 to 17d3aaf Compare September 24, 2026 07:46

@waynesun09 waynesun09 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review sweep at head 17d3aaf. Two findings checked against the existing threads for overlap. One is posted inline (MEDIUM). The other (MEDIUM) is below because its line falls outside the diff hunks for that file.


skills/pr-review/SKILL.md (near line 1039, outside the diff hunks): [MEDIUM] Challenger context still gets the full, unfiltered MANIFEST, which bypasses the pr-excluded.txt omission

Checked at head 17d3aaf. Step 3d now leaves paths named in /sandbox/workspace/pr-excluded.txt out of both pr_head (line 679) and changed_files (line 687). The stated reason is that "content stripped from the diff must not re-enter model context as a whole file".

Step 6d's challenger context package (Part 3, lines 1038-1042) still reads ### PR head files / <same section as step 4, with the full MANIFEST> and ### Changed files / <file list>. Neither line subtracts excluded paths. Step 2b has already written every changed blob to /sandbox/workspace/pr-head/, and nothing deletes it. So whenever the 6a-6c finding set is non-empty, the challenger is handed the paths of excluded lockfiles, vendored files and generated files and can Read them. That undoes the omission, and it makes the step-7 disclosure text "no model read its contents" untrue.

This gap is separate from the resolved changed_files thread at SKILL.md:679, which only covered the step 3d dimension packages. Impact is on token cost and on the accuracy of the disclosure. It is not a hole in a security boundary.

Suggested fix: In step 6d Part 3, replace "with the full MANIFEST" with the full MANIFEST minus the paths in /sandbox/workspace/pr-excluded.txt, and apply the same omission to the challenger's Changed files list, so the rule matches step 3d.


Review-only; not requesting changes.

Comment thread skills/pr-review/SKILL.md Outdated
failure mode is never a lost diff. When the script cannot be resolved
the guarded command is skipped, so the `mv` never clobbers a good diff.

The echoes above route the two empty-diff cases: an all-excluded PR

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] An all-excluded PR skips the step 6e PR-level checks (protected paths, scope authorization, PR-body injection)

Checked at head 17d3aaf. These lines say "an all-excluded PR (non-empty summary) skips steps 3–6 and goes to step 7 with the disclosures as its findings". Step 6e (lines 1100-1180) contains orchestrator-only checks that do not depend on having reviewable diff content: PR body/commit-message injection inspection, scope authorization against the linked issue, and the protected-path finding. Step 6e says the agent "MUST emit" that finding whenever a protected file is modified.

Consider a PR whose changed files are all stripped, for example a vendored or generated file under a protected prefix, or a lockfile-only PR with no linked authorization. It reaches step 7 with no protected-path or scope finding.

The damage is limited. Step 7 (lines 1348-1351) forces action: comment for all-excluded PRs, and post-review.sh downgrades protected-path approvals on its own, so the PR cannot be auto-approved. The findings humans rely on to see why the PR needs attention are still missing.

Suggested fix: Change the routing so an all-excluded PR skips only steps 3-6d (sub-agent dispatch and challenger) and still runs step 6e (injection inspection, metadata verification, scope authorization, protected paths) before step 7. Update this sentence and the ALL EXCLUDED echo at line 220 to say so.

Signed-off-by: Guy Oron <goron@redhat.com>
Signed-off-by: Guy Oron <goron@redhat.com>
Signed-off-by: Guy Oron <goron@redhat.com>
…l diff too

Signed-off-by: Guy Oron <goron@redhat.com>
…inding

Signed-off-by: Guy Oron <goron@redhat.com>
@guyoron1
guyoron1 requested a review from a team as a code owner November 15, 2026 00:21
@guyoron1

Copy link
Copy Markdown
Contributor Author

@waynesun09 thanks, both addressed. New head 841751c.

  • MEDIUM: challenger context still gets the full MANIFEST (c3461c8): step 6d Part 3 now passes the full MANIFEST and the full PR file list minus the step 2c exclusions, the same rule as step 3d. The step 2c note now names both places (3d, 6d).
  • MEDIUM: an all-excluded PR skips the step 6e checks (91cf16d): ALL EXCLUDED now skips steps 3–6d only (dispatch and challenger). Step 6e (injection, metadata, scope authorization, protected paths) still runs with the disclosures as the adjudicated set, then step 7. Two follow-on fixes in the same commit:
    • The protected-path check now walks step 2's changed-file list, excluded files included. It used to walk "each file in the PR diff", so a vendored or generated file under a protected prefix was missed on mixed PRs as well as all-excluded ones.
    • Step 7 no longer forces comment on an all-excluded PR: it is never approve, and it is request-changes when a 6e rule requires that.
  • Two more gaps I found while bringing main in:
    • The scoped full diff and the re-review incremental diff bypassed the filter (f37deed): main's dependency scoping (pr-full-diff.txt, which security reviewers read) and the re-review compare (pr-incremental-diff.txt) are diffs a model reads, and step 2c only filtered pr-diff.txt. Step 2c now runs after 2a and filters all three. The widest diff present writes the exclusion summary. Nothing is replaced unless every run succeeded, so a failure leaves all of them unfiltered and the summary empty.
    • A provenance-warning alone turned an approve into a comment (841751c): the disclosure-only approve downgrade counted provenance-warning as a disclosure. Before this PR the default low threshold dropped that info finding and the approve stood. The downgrade now needs an excluded-content finding. There is a unit case and a script-level case.

Merged upstream main. Main changed code this PR touches, so the merge does more than resolve conflicts:

  • finding.category is now a closed enum. excluded-content is added to the schema, to post-review's non_dimensional_category (otherwise any review with an exclusion would lose its findings ledger) and to its dimension-drop exemptions, and to the lists in agents/review.md, docs/review.md and re-review.md. validate-output-schema-test.sh's sync checks pass.
  • In the severity filter, the threshold exemption now also covers the new THRESHOLD_HIDDEN_IDS count and the re-review "filtered to zero" flag. PR-wide disclosures use main's N/A file convention, so the <pr> sentinel is gone.
  • I re-applied the SKILL.md wiring onto main's rewritten skill and tightened it to stay under main's existing context-budget ceiling. The baseline is unchanged.

Checks: the filter suite, validate-output-schema-test.sh, make check-bundle and make lint (0 errors, 0 warnings) pass, and shellcheck is clean at warning level. post-review-test.sh passes apart from 5 fixture checks that need the jsonschema package, which wasn't installed locally.

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ⚠️ Cancelled · Started 12:24 AM UTC · Completed 12:40 AM UTC

Commit: 841751c · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.45

This review was superseded by a newer commit. Check the current pull request HEAD's review status before merging.

skill-env-reachability-test reads uppercase words in code blocks as env vars, so FILTER FAILED and ALL EXCLUDED failed it. They are now sentence case. The step's orchestrator-side script lookup goes under the existing fullsend-ai#1672 known gap, as it is for pr-review/github.

Signed-off-by: Guy Oron <goron@redhat.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 12:42 AM UTC · Completed 12:55 AM UTC

Commit: a749ed8 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $3.51

@fullsend-ai-review fullsend-ai-review Bot added the risk/elevated PR risk: elevated label Nov 15, 2026
@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: elevated (3/5)

Details

Elevated risk due to a large diff touching 11 protected paths across core review skills and scripts without a feature flag, compounded by high recent churn and author contention in touched files.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

High

  • [fail-open] skills/pr-review/scripts/filter-review-diff.sh:335 — Generated-content classification trusts two independently PR-controlled inputs: the filename and a generated marker in the PR-head file or patch. Neither proves the change was generated. For example, adding // @generated to src/auth_generated.go hides arbitrary authorization changes from every dimension reviewer and the challenger, and step 3d also removes its whole-file manifest entry. The migration exemption is checked, but there is no security-sensitive-path exemption or trusted regeneration verification. The info-level exclusion disclosure names the file but not the hidden change. The post-review approve downgrade only runs when blocking_count is 0, so an approve that also carries a below-threshold finding keeps auto-approval with the hidden content.
    Remediation: Keep security-sensitive source and configuration changes in security review regardless of generated classification. For other executable generated content, require trusted regeneration verification or enforce human review when its contents are excluded; do not treat a submitter-supplied path and marker as sufficient evidence.

Review

Findings

Medium

  • [logic-error] skills/pr-review/SKILL.md:245 — The all-excluded shortcut checks only pr-diff.txt, which is the own-commit diff after dependency scoping. For a scoped PR whose own changes are only a lockfile, filtering empties that file while pr-full-diff.txt can still contain reviewable dependency code. The instruction then skips every sub-agent, including security reviewers. That contradicts references/dependency-scope.md, which requires security inspection of the full PR; step 6e does not perform that inspection.
    Remediation: Only skip all dispatch when every applicable review diff is empty. When the scoped own-commit diff is empty but pr-full-diff.txt still contains reviewable changes, retain the full-diff security-review dispatch. Add a regression test for a scoped PR containing dependency source changes plus an own-commit lockfile-only change.

  • [fail-open] scripts/post-review.src.sh:700 — The exclusion-related approval downgrade is not preserved through the re-review promotion gate. With a valid prior ledger containing no remaining blockers, an incoming request-changes result with an excluded-content disclosure and a below-threshold low finding sets REREVIEW_FILTERED_TO_ZERO=true and records request-changes as the original action. The block at this line downgrades it to comment but sets neither DOWNGRADED nor another exclusion hold. rereview_action_can_promote then accepts the comment, and the later re-review branch changes it back to approve when protected-path and risk checks pass. The direct approve-plus-disclosure case is checked, but this promotion path can still approve the same unreviewed content. The same logic is bundled into scripts/post-review.sh.
    Remediation: Record an exclusion-related manual-review hold and apply it to every subsequent approval/promotion path, or repeat the exclusion eligibility check after final verdict recalculation. Rebuild the bundle with make script-build. Add a real-script regression test combining a verified prior ledger, excluded-content disclosure, below-threshold finding, and incoming request-changes verdict.

  • [protected-path] agents/review.md — This PR modifies protected governance/infrastructure paths: agents/review.md, scripts/post-review.sh, scripts/post-review.src.sh, scripts/post-review-test.sh, scripts/filter-review-diff-test.sh, scripts/skill-env-reachability-test.sh, skills/pr-review/SKILL.md, skills/pr-review/github/SKILL.md, skills/pr-review/gitlab/SKILL.md, skills/pr-review/references/re-review.md, skills/pr-review/scripts/filter-review-diff.sh. The PR links issue pr-review: filter lockfiles, generated, vendored and minified content from the review diff #1143 and explains the rationale, but human approval is always required for protected-path changes, regardless of context. These changes also alter what content review sub-agents see and how post-review verdicts are downgraded.


Labels: PR changes the review agent pipeline (diff filter, post-review, pr-review skill).


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the review comment for full details.

# _pb2.py*), codegen suffixes (.gen.go, _generated.*), and
# generated/, dist/, build/ path components. Anything else is kept
# without a content check.
if (lp ~ /\.pb\.go$|\.gen\.go$|_pb2\.py|_generated\.|(^|\/)(generated|dist|build)\//) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[high] fail-open

Generated-content classification trusts two independently PR-controlled inputs: the filename and a generated marker in the PR-head file or patch. Neither proves the change was generated. For example, adding // @generated to src/auth_generated.go hides arbitrary authorization changes from every dimension reviewer and the challenger, and step 3d also removes its whole-file manifest entry. The migration exemption is checked, but there is no security-sensitive-path exemption or trusted regeneration verification. The info-level exclusion disclosure names the file but not the hidden change. The post-review approve downgrade only runs when blocking_count is 0, so an approve that also carries a below-threshold finding keeps auto-approval with the hidden content.

Suggested fix: Keep security-sensitive source and configuration changes in security review regardless of generated classification. For other executable generated content, require trusted regeneration verification or enforce human review when its contents are excluded; do not treat a submitter-supplied path and marker as sufficient evidence.

Comment thread skills/pr-review/SKILL.md
: > "$S"; echo "Filter failed — diffs left as fetched; review them unfiltered"
fi
if ! test -s "$W/pr-diff.txt"; then
if test -s "$S"; then echo "All excluded — skip steps 3–6d; run 6e onward, then step 7"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[medium] logic-error

The all-excluded shortcut checks only pr-diff.txt, which is the own-commit diff after dependency scoping. For a scoped PR whose own changes are only a lockfile, filtering empties that file while pr-full-diff.txt can still contain reviewable dependency code. The instruction then skips every sub-agent, including security reviewers. That contradicts references/dependency-scope.md, which requires security inspection of the full PR; step 6e does not perform that inspection.

Suggested fix: Only skip all dispatch when every applicable review diff is empty. When the scoped own-commit diff is empty but pr-full-diff.txt still contains reviewable changes, retain the full-diff security-review dispatch. Add a regression test for a scoped PR containing dependency source changes plus an own-commit lockfile-only change.

if [ "${original_action}" = "request-changes" ] || [ "${original_action}" = "reject" ]; then
echo "No blocking findings after severity filter — downgrading '${original_action}' to 'comment'"
jq 'if (.findings | length) == 0 then del(.findings) else . end | .action = "comment"' "${RESULT_FILE}" > "${DOWNGRADE_RESULT}"
elif [ "${original_action}" = "approve" ] && jq -e 'any(.findings[]?; .category == "excluded-content")' "${RESULT_FILE}" >/dev/null; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[medium] fail-open

The exclusion-related approval downgrade is not preserved through the re-review promotion gate. With a valid prior ledger containing no remaining blockers, an incoming request-changes result with an excluded-content disclosure and a below-threshold low finding sets REREVIEW_FILTERED_TO_ZERO=true and records request-changes as the original action. The block at this line downgrades it to comment but sets neither DOWNGRADED nor another exclusion hold. rereview_action_can_promote then accepts the comment, and the later re-review branch changes it back to approve when protected-path and risk checks pass. The direct approve-plus-disclosure case is checked, but this promotion path can still approve the same unreviewed content. The same logic is bundled into scripts/post-review.sh.

Suggested fix: Record an exclusion-related manual-review hold and apply it to every subsequent approval/promotion path, or repeat the exclusion eligibility check after final verdict recalculation. Rebuild the bundle with make script-build. Add a real-script regression test combining a verified prior ledger, excluded-content disclosure, below-threshold finding, and incoming request-changes verdict.

@waynesun09 waynesun09 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review sweep at head a749ed8. I checked two findings against the existing threads for overlap. Both are new, and both are posted inline (MEDIUM).

if [ "${original_action}" = "request-changes" ] || [ "${original_action}" = "reject" ]; then
echo "No blocking findings after severity filter — downgrading '${original_action}' to 'comment'"
jq 'if (.findings | length) == 0 then del(.findings) else . end | .action = "comment"' "${RESULT_FILE}" > "${DOWNGRADE_RESULT}"
elif [ "${original_action}" = "approve" ] && jq -e 'any(.findings[]?; .category == "excluded-content")' "${RESULT_FILE}" >/dev/null; then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] The approve downgrade fires on every clean mixed PR that touches a lockfile, not only on all-excluded PRs, and whether it fires depends on unrelated kept findings

Checked at head a749ed8. This elif [ "${original_action}" = "approve" ] && jq -e 'any(.findings[]?; .category == "excluded-content")' branch runs whenever blocking_count (line 649) is 0. SKILL.md step 7 (line 1386) adds one excluded-content disclosure for each excluded file on every PR, mixed PRs included. So these PRs go from approve to comment (requires-manual-review):

  • a clean go.mod + go.sum bump
  • a source change plus a regenerated package-lock.json

The code comment says the downgrade is meant for the all-excluded PR. SKILL.md line 1390 and #1143 only ask that an all-excluded PR is never approved.

The rule is also applied unevenly. The same mixed PR keeps its approve once any kept finding that is not a disclosure makes blocking_count 1. So whether excluded content gets auto-approved depends on an unrelated finding.

The PR body does say that approve with only disclosures is downgraded. But no test covers the mixed clean case: the tests cover only all-excluded PRs. The existing threads don't cover this either. One earlier thread asked for the all-excluded downgrade. The review bot's line-335 finding mentions only the bypass through a kept finding, and its line-700 finding is about re-review promotion.

Suggestion: Decide the intended rule and apply it the same way everywhere:

  1. Key the downgrade on a real all-excluded signal, such as a marker set by step 2c, or a comparison of the excluded-content files with the changed-file list. Add a mixed clean PR test that expects approve.
  2. Or, if any excluded content must mean manual review, downgrade an approve whenever an excluded-content disclosure is present, whatever blocking_count is.

With either option, update the code comment and docs/review.md to match. Add a test for approve + excluded-content + one kept low finding.

}
# Well-known dependency lockfiles across ecosystems (npm, yarn, pnpm,
# Go, Rust, Ruby, Python, PHP).
if (lp ~ /(^|\/)(package-lock\.json|yarn\.lock|pnpm-lock\.yaml|npm-shrinkwrap\.json|go\.sum|cargo\.lock|gemfile\.lock|poetry\.lock|composer\.lock)$/) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] Lockfiles, vendored code, minified files and any *.map file are now stripped on every PR path, with no security fallback

Checked at head a749ed8. Lines 317-327 strip these based on the path alone:

  • lockfiles
  • *.min.js and *.min.css
  • any *.map
  • anything under vendor/, node_modules/ or third_party/

Before this PR, the small-PR path reviewed the full diff. Step 3d/6d also removes these paths from the MANIFEST and from changed_files, so the security sub-agent can't open them either.

Some supply-chain changes can still be spotted in this content:

  • a package-lock.json resolved/integrity entry that points at a tarball outside the registry
  • a go.sum change with no matching go.mod change
  • a backdoor in Go vendor/, which go build compiles

Hand-written JS can also be hidden by naming it *.min.js. The \.map$ rule strips any .map file (for example assets/world.map), not only sourcemaps.

The residual-risk note in the header (lines 52-58) covers only the generated-marker rule. If the result is approve and any kept finding that is not a disclosure is present, post-review keeps the approve. So this content can be auto-approved without anyone reading it. Existing threads cover trust in the generated marker and the filename, but not the lockfile, vendored and sourcemap rules.

Suggestion: Pick one:

  1. Keep these sections out of the dimension prompts, but still give the security dimension the lockfile and vendored diffs, or a short deterministic summary (changed resolved hosts, go.sum lines with no matching go.mod change).
  2. Or record the reduced coverage as an accepted trade-off in the residual-risk header and in docs/review.md.

With either option, narrow *.map to *.js.map/*.css.map, or require a sourcemap JSON shape.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants