You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Review prompt construction currently embeds the full local diff or PR diff into the prompt without a total size cap. Large local diffs or PRs can exceed provider input limits, make reviews unreliable, or waste tokens.
The upstream Codex issue included spawnSync ENOBUFS; this repo avoids that exact sync-buffer failure by using async spawn, but the provider input-size problem still applies.
Local evidence
plugins/opencode/scripts/lib/prompts.mjs:
buildReviewPrompt() calls getDiff(...) or getPrDiff(...).
buildReviewContext() emits the entire diff as:
<diff>
${diff}
</diff>
There is no per-file cap, total cap, binary patch guard, or fallback path.
Expected behavior
Large reviews should fail gracefully or degrade into a bounded review context instead of blindly sending unlimited diff text.
Suggested fix
Add review-context budget handling:
Enforce a configurable total character/token budget for <diff>.
Enforce per-file caps and skip obvious binary/generated blobs.
Include changed-file list and stats even when truncating the diff.
Mark truncation clearly in the prompt so OpenCode knows the review is partial.
For very large reviews, consider a separate mode that asks OpenCode to inspect the repo/diff itself with bounded file reads instead of embedding the entire diff.
Upstream references
Derived from openai/codex-plugin-cc#11 and #69. Related local feature direction: #21 for path/folder review context with size caps.
Consolidating #40 here. The canonical scope is bounded review context for standard and adversarial reviews, including avoiding full inline diffs when the diff or PR is too large.
Fixed by PR #51 commit e196f88 (backed by prompts.mjs and git.mjs fixes in 892493c) — buildReviewPrompt bounds diff reads at maxBytes+1 via runCommand({maxOutputBytes}), falls back to diff_stat+changed_files when thresholds exceeded.
Activity
[-]Review prompts embed full diffs/PR diffs without size caps[/-][+]Bound review/adversarial diff context size[/+]JohnnyVicious commentedon Apr 12, 2026
Consolidating #40 here. The canonical scope is bounded review context for standard and adversarial reviews, including avoiding full inline diffs when the diff or PR is too large.
JohnnyVicious commentedon Apr 12, 2026
Fixed by PR #51 commit e196f88 (backed by prompts.mjs and git.mjs fixes in 892493c) — buildReviewPrompt bounds diff reads at maxBytes+1 via runCommand({maxOutputBytes}), falls back to diff_stat+changed_files when thresholds exceeded.