Skip to content

fix: prevent ENOBUFS crash and oversized input on large diffs (#11)#61

Open
Psypeal wants to merge 1 commit intoopenai:mainfrom
Psypeal:fix/large-diff-enobufs
Open

fix: prevent ENOBUFS crash and oversized input on large diffs (#11)#61
Psypeal wants to merge 1 commit intoopenai:mainfrom
Psypeal:fix/large-diff-enobufs

Conversation

@Psypeal
Copy link
Copy Markdown

@Psypeal Psypeal commented Mar 31, 2026

Add maxBuffer (50MB) to spawnSync, estimate diff size via --numstat before reading full patches, gracefully fall back to --stat summaries when diffs exceed the review content budget or fail to read, and hard-cap all review output to stay within the Codex API input limit.

)

Add maxBuffer (50MB) to spawnSync, estimate diff size via --numstat before reading full patches, gracefully fall back to --stat summaries when diffs exceed the review content budget or fail to read, and hard-cap all review output to stay within the Codex API input limit.
@Psypeal Psypeal requested a review from a team March 31, 2026 09:55
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b030dcd820

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

content: enforceContentLimit(content)
};
}
const untrackedBody = collectUntrackedBodies(cwd, state.untracked, MAX_REVIEW_CONTENT_CHARS);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve patch output when only untracked content is oversized

In collectWorkingTreeContext, untracked files are collected with the full MAX_REVIEW_CONTENT_CHARS budget before staged/unstaged sections are accounted for, so a repo with many untracked files and a small patch can still exceed the global limit and trigger the later stat-only fallback. That causes the actual patch hunks to be replaced by --stat output even when the diff itself is not large, which drops review-critical detail and mislabels the reason as “full diff too large.”

Useful? React with 👍 / 👎.

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