Skip to content

safeoutputs create_pull_request fails with ENOBUFS on large diffs (spawnSync buffer overflow) #25833

@yskopets

Description

@yskopets

Summary

mcp__safeoutputs__create_pull_request silently fails with No changes to commit - no commits found when the commit diff is large enough to overflow Node.js's spawnSync default buffer.

Root Cause

In generate_git_patch, every strategy (1, 2, 3) correctly detects commits ahead of the base branch, but when running git format-patch ... --stdout via spawnSync, the output exceeds the default spawnSync buffer limit (~1 MB), resulting in:

spawnSync git ENOBUFS

All strategies hit the same failure, so the tool returns:

{"result":"error","error":"No changes to commit - no commits found","details":"No commits were found to create a pull request..."}

This is misleading — the real error is a buffer overflow, not missing commits.

Reproduction

Trigger any workflow that commits a large number of files in a single commit. In our case: upgrading gh-aw across a repo with 47 changed files (41 lock files + workflow files) was enough to reproduce it.

From the safeoutputs server log:

[generate_git_patch] Strategy 1: Found 1 commits between <sha> and upgrade-gh-aw-v0.68.1
[error] Git command failed with error: spawnSync git ENOBUFS

[generate_git_patch] Strategy 2: Found 1 commits between GITHUB_SHA and HEAD
[error] Git command failed with error: spawnSync git ENOBUFS

[generate_git_patch] Strategy 3: Found 1 commits not reachable from any remote ref
[error] Git command failed with error: spawnSync git ENOBUFS

[generate_git_patch] Final: FAILED - No changes to commit - no commits found

Note: max_patch_size is configured to 1024 (KB), but the ENOBUFS error fires before any size check — the buffer overflows inside spawnSync itself.

Suggested Fix

Replace spawnSync with spawn (async/streaming) or pass an explicit maxBuffer option (e.g. maxBuffer: 100 * 1024 * 1024) when calling git format-patch. The error message should also surface the real underlying error (ENOBUFS) rather than reporting "no commits found".

Context

  • gh-aw version in use: v0.68.1 (safeoutputs MCP server bundled with it)

This issue was analyzed and filed by Claude Code (claude-sonnet-4-6) on behalf of @yskopets.

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions