Skip to content

fix(scripts): read gh replies over 1 MiB in release:notes and the sweeps - #5410

Merged
cliffhall merged 1 commit into
v2/mainfrom
v2/fix/5339-release-notes-maxbuffer
Oct 29, 2026
Merged

cliffhall merged 1 commit into
v2/mainfrom
v2/fix/5339-release-notes-maxbuffer

Conversation

@cliffhall

Copy link
Copy Markdown
Member

Closes #5339

Description

run() in scripts/release-notes.mjs called spawnSync without a maxBuffer, so Node's 1 MiB default applied. The GraphQL query that lists src/ at v2.2.0's merge commit returns 1,087,532 bytes, which made npm run release:notes throw spawnSync gh ENOBUFS before producing any notes. run() now passes maxBuffer: MAX_BUFFER (256 MiB, exported). That is far beyond any reply the script reads, and it still caps a runaway one.

scripts/lib/sweep.mjs's gh(), as the issue asked: I fixed it the same way (GH_MAX_BUFFER, 256 MiB). Its largest reply is the Dependabot alert listing (--paginate --slurp, every open alert). That listing is 0 bytes today because no alerts are open. But one page of 99 of this repo's fixed alerts measured 702,259 bytes, about 7 KB per alert, so roughly 150 open alerts would overflow 1 MiB and abort dependabot-alerts. That is a plausible backlog after a quiet spell. The other gh() replies (the issue listing of up to 500 sweep issues with their bodies, and a comment thread through --slurp) grow the same way, but more slowly.

Server Details

  • Server: none (repository-wide). Release and sweep tooling under scripts/.
  • Changes: scripts/release-notes.mjs (run()), scripts/lib/sweep.mjs (gh()), and their tests.

Motivation and Context

See #5339. The src/ tree only grows, so every release after v2.2.0 would fail the same way without this fix.

How Has This Been Tested?

No client-observable surface (scripts only), so the evidence is a targeted probe.

Before/after on the real overflowing call. packagesAt(spawnSync, "60200eb7…") is the expr=<sha>:src query the issue names, run against GitHub:

== origin/v2/main scripts/release-notes.mjs
error: spawnSync gh ENOBUFS
== this branch
packages: 7 @modelcontextprotocol/server-everything@2.1.0, @modelcontextprotocol/server-filesystem@2.1.0, @modelcontextprotocol/server-memory@2.0.1, @modelcontextprotocol/server-sequential-thinking@2.0.0, mcp-server-fetch@2026.10.28, mcp-server-git@2026.10.28, mcp-server-time@2026.10.28

(The issue's full --milestone v2.2.0 command now stops earlier, on the script's own "tag v2.2.0 already exists" check, because v2.2.0 has shipped. So the probe calls the overflowing lookup directly.)

Tests. Each file gets two new tests. They drive the real spawnSync, with gh swapped for a node -e that writes 2 MiB of stdout, so the options run()/gh() pass decide the outcome:

  • release-notes.test.mjs: a reply over 1 MiB gets through filesOf (all 131,072 lines), and a genuine spawn error (a missing binary, ENOENT) is still rethrown.
  • lib/sweep.test.mjs: the same pair for gh().

Planted defect: with the two maxBuffer lines deleted, both over-1 MiB tests fail with spawnSync … ENOBUFS (67 pass, 2 fail). With the fix, 69 pass, 0 fail.

npm run local:gate: exit 0.

Breaking Changes

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation (not applicable: release and sweep scripts, no protocol surface)
  • My changes follow MCP security best practices (not applicable: no server change. The buffer is still bounded, at 256 MiB)
  • I have updated the server's README accordingly (not applicable: no server change)
  • I have added a changeset (npm run changeset) if this changes what a TypeScript server publishes (not applicable: scripts only)
  • I have tested this with an LLM client (not applicable: no client-observable surface; targeted probe above)
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling (a spawn error is still rethrown; tested)
  • I have documented all environment variables and configuration options (not applicable: none added)

🤖 Generated with Claude Code

run() in scripts/release-notes.mjs called spawnSync with Node's default
1 MiB maxBuffer, so the src/ tree query at v2.2.0's merge commit
(1,087,532 bytes) aborted the run with ENOBUFS. Pass a 256 MiB
maxBuffer. scripts/lib/sweep.mjs's gh() gets the same: the Dependabot
alert listing is about 7 KB per alert, so ~150 open alerts would
overflow it.

Tests drive the real spawnSync with a >1 MiB reply, and check a genuine
spawn error is still rethrown.

Closes #5339

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
@cliffhall cliffhall added the v2 label Oct 29, 2026
@changeset-bot

changeset-bot Bot commented Oct 29, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e6f2240

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the change to support larger GitHub CLI replies while retaining a bounded buffer.

No open issues 🎉

What changed in this PR

Fixes #5339 by allowing release-note generation and dependency sweeps to read GitHub CLI replies larger than Node’s default 1 MiB buffer, while retaining a bounded limit.

Changes:

  • Sets an explicit 256 MiB buffer limit in both subprocess helpers.
  • Adds regression tests using real subprocesses to verify large replies succeed and genuine spawn errors are still rethrown.
File Description
scripts/​release-notes.test.mjs Tests large file-list replies and spawn-error propagation.
scripts/​release-notes.mjs Applies the exported 256 MiB limit to subprocess output.
scripts/​lib/​sweep.test.mjs Tests large CLI replies and spawn-error propagation.
scripts/​lib/​sweep.mjs Applies the exported 256 MiB limit to the shared gh() helper.

Review effort: Balanced

@cliffhall

Copy link
Copy Markdown
Member Author

Copilot round 1: clean ("Approval recommended", no findings, no inline comments, no suppressed comments). No reply threads were needed. The loop has converged on its first clean round, with no confirming round per pr-flow.

@cliffhall
cliffhall merged commit 7e12ca3 into v2/main Oct 29, 2026
41 checks passed
@cliffhall
cliffhall deleted the v2/fix/5339-release-notes-maxbuffer branch October 29, 2026 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

release:notes: a gh reply over 1 MiB aborts the run with spawnSync ENOBUFS

2 participants