Repository navigation
fix(patchy): a tier 2 file write over the cap is refused as too_large at any size - #689
Merged
Merged
Conversation
Owner
Author
|
GPT 6.1 Sol (xhigh, one pass) reviewed
|
… at any size workerd limits serialized RPC arguments to 32 MiB, so a file body over that never reached the loader's 20 MiB check: the RPC threw inside the guest and a handler saw a generic Error instead of the too_large refusal. The guest's callback routine now gives the loader's refusal itself for a body over GuestProtocol.callbackFileLimit, before the RPC. The refusal body moves to GuestProtocol.callbackFileTooLarge so the loader, supervisor and guest share it. The loader, supervisor and gateway still enforce the cap. Closes #605 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ed the RPC Both sizes in the caught comparison stopped in the guest, so it never checked the guest's refusal against a reply from the loader. The test's host now refuses as the supervisor does, so a small put's refusal crosses the RPC. Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood
force-pushed
the
fix/605-guest-file-cap
branch
from
October 15, 2026 19:45
146b342 to
47a02f5
Compare
allisonmahmood
added a commit
that referenced
this pull request
Oct 16, 2026
…u when they fail (#720) Release 13's What's new entry, written from `c9b8fc4`, ahead of deploying it. `patchy` and `CURRENT_RELEASE` move to `0.13.0`, so CLIs and patch repos installed before this deploy are told to upgrade. | Change | PRs | | --- | --- | | New: Home puts the patches you use first | #713, #716, #719 | | New: Every patch in one list | #715 | | Improved: Each patch's page leads with Open | #717 | | New: See when your tools are failing | #718 | | Fixed: Everyone has a name | #687 | | Improved: Your company's look is easier to get right | #697, #696, #703, #688 | | Improved: Forms follow your look's error states | #691, #692 | | Improved: Clearer answers when a publish goes wrong | #686, #685, #689 | | Fixed: Your agent's Patchy commands are steadier | #695, #704, #680, #681 | | Behind the scenes: stricter checks on static pages and tools' database requests; malformed requests are logged | #682, #693, #683 | | Behind the scenes: usage numbers count every publish, sharing change and restore | #698, #699, #700, #690 | | Test and tooling only, no line | #705, #702, #701, #694, #684, #607 | Made by Claude Opus 5.5 in Claude Code, running in T3 Code. Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A tier 2 action that put a file over 32 MiB got a generic error instead of
too_large. workerd limits serialized RPC arguments to 32 MiB, so the body never reached the loader's 20 MiB check: the RPC threw inside the guest, a handler that caught it saw a plainError("Serialized RPC arguments or return values are limited to 32MiB…"), and an uncaught one repliedhandler_failed.The guest's shared callback routine now refuses a body over
GuestProtocol.callbackFileLimitbefore the RPC, with the loader's own refusal, through the existing refusal registration. That coversUint8Array,ArrayBufferandBlobinputs, measured after conversion to bytes. The refusal body moves toGuestProtocol.callbackFileTooLarge, so the loader, supervisor and guest give the same one by construction. The loader, supervisor and gateway still enforce the cap; the guest's check only improves the error.A new Engine test runs through real workerd. A 32 MiB + 1
Uint8Arrayput and a 40 MiBBlobput each reply with exactly the loader's refusal, and neither reaches the host. A handler that catches the 32 MiB + 1 refusal sees the samePatchyErroras one that catches the same refusal returned through the loader's RPC; the test's host refuses a small put the way the supervisor does. Without the guest change, the test fails withhandler_failed. The existing cap test still covers 20971520 bytes stored and 20971521 refused.Tested by hand
pnpm dev up team, then a tier 2 patch underpatchy devwhose action puts N bytes as aUint8ArrayorBlob, with and without catching. Before → after, as the handler and the viewer saw it:Uint8Array, caughtError: "Serialized RPC arguments or return values are limited to 32MiB, but the size of this value was: 34603184 bytes."PatchyErrortoo_large,scope: "viewer",limitId: "tier2.callbacks.fileBytes",value: 20971520,operation: "files.put", 2 ms in the handlerBlob, caughtError(41943215 bytes)too_largerefusal, 65 ms in the handlerUint8ArrayUint8Array, caughttoo_largeas aboveFor the uncaught puts, the server's invocation record showed
callbacks: 0anddurationMs: 17: the body never reached the host and nothing waited on a deadline.Not changed: an uncaught over-cap put still reaches the viewer as
handler_failedThis was true before the change at every size over the cap, including 20971521 bytes. The host relays a guest's
source: "patchy"refusal only if the host itself issued it to that attempt (packages/runtime/src/Invocation.ts), and it never sees the loader's or the guest's local file refusal. So the issue's "the viewer correctly getstoo_large" between 20 and 32 MiB holds for the guest's reply, which the acceptance tests check through workerd, but not for the viewer. Letting the host trust this one static refusal from a guest changes its trust rule, so it needs its own decision rather than riding along here.Surfaces
@patchy/api/guest) gainscallbackFileTooLarge; nothing public, sodocs/API.mdis unchanged.docs/API.md,docs/product.mdand thepatchy-server,patchy-filesandpatchy-shared-storesskills already say an over-cap file istoo_large; this makes that true at every size.Closes #605
Made by Claude Opus 5.5 in Claude Code, running in T3 Code.