Repository navigation
bug: Count binary payloads in review size limits #49
Description
Background
The shared reviewer measures the plain git diff output to enforce the 5,000,000-byte automatic-review gate and the 100,000,000-byte total ceiling. Git represents changed binary files with a short "Binary files differ" line in that output. GizClaw/h6infra PR #4 has a 4,147,843-byte plain patch but about 25,256,467 bytes of changed files, including two GLB models; its binary-aware Git patch is 18,621,002 bytes. The current gate automatically starts expensive model review instead of requiring admin approval.
Goal
Measure the complete binary-aware Git patch for both size limits while preserving the text-oriented review listing. A PR containing binary additions or modifications above 5,000,000 patch bytes must require the existing exact-head admin approval command. The 100,000,000-byte ceiling must apply to the same measured representation.
Non-goals
Do not feed binary patch bodies to the language model, change the approval command or permission check, or change either numeric limit.
Code Changes Tree
.github/scripts/pr-review/
├── prepare.mjs # measure and hash the complete binary-aware patch while leaving model-facing file patches text-oriented
└── test.mjs # prove binary changes cross the automatic gate even when plain git diff is small
README.md # state that size limits count Git binary patch payloads as well as text hunks
Design
Use Git's --binary option only for the full merge-base-to-head patch used for total-size checks and effective-diff identity. Keep per-file review listings unchanged so GLB/image bytes do not enter prompts. The existing full-patch read bound and pre-Codex size checks remain in place. The same binary-aware content hash invalidates a completed review if a binary file changes at the same head comparison range.
Test And Acceptance Criteria
Acceptance Criteria
- A binary-heavy PR whose plain patch is below 5,000,000 bytes but whose binary-aware patch exceeds the threshold is blocked before Codex until admin approval for the current head.
- An approved binary-aware patch below 100,000,000 bytes can proceed; a patch above the hard ceiling fails.
- Text-only PR behavior and model-facing diff chunks remain unchanged.
Validation
Run node .github/scripts/pr-review/test.mjs, the other review test scripts, actionlint, and git diff --check. Compare the measured binary-aware patch for GizClaw/h6infra PR #4 with its plain patch, and verify the new PR's exact-head checks.
Activity