Skip to content

fix(hooks): cache large WebFetch responses without argv limits - #771

Merged
addyosmani merged 2 commits into
addyosmani:mainfrom
ayobamiseun:fix/cache-large-responses
Nov 24, 2026
Merged

addyosmani merged 2 commits into
addyosmani:mainfrom
ayobamiseun:fix/cache-large-responses

Conversation

@ayobamiseun

@ayobamiseun ayobamiseun commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Caching a 2 MiB WebFetch response fails with Argument list too long because its body is passed to jq --arg. Pipe the body into jq -Rs and retain the existing cache fields and atomic replacement. Use Bash slicing for debug previews so large inputs do not trigger broken-pipe warnings on Linux (caught by the new regression in CI).

The regression sends a 2 MiB response containing Unicode, quotes, backslashes and newlines through the real post hook with stubbed curl. It checks exact stored content, the validator, empty stderr and temporary-file cleanup. It reproduces the failure before the fix; all 35 cache assertions pass afterward.

Overlap check: #524 refactors helpers and #294 adds hook hardening; neither fixes response serialization. Their cache-hook changes each apply cleanly on top of this fix, and all 35 cache assertions pass with each applied (#524's additional 9 helper assertions also pass). Both PRs have pre-existing merge conflicts with main in unrelated files; this adds no cache-hook conflict. The companion fixes merge cleanly together.

Combined validation: 337 Node tests, all hook suites, repository validators and 150 deterministic eval checks pass. Tested locally on macOS; no network requests in hook tests. AI-assisted with Codex.

@addyosmani addyosmani left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

praise: real failure, the right fix (stdin instead of argv), and a 2 MiB test with nasty characters. Thanks.

@addyosmani
addyosmani merged commit c8418b7 into addyosmani:main Nov 24, 2026
7 checks passed
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.

2 participants