Skip to content

Link WebSocket holds: the HTTP hold check decodes its body copy outside the inbound budget (fix before the gate opens) #8608

Closed

Description

@lidge-jun

From the fresh final review of #8593 at b3367cc (approved with this nit). It cannot be reached while the link WebSocket release gate is closed, and must be fixed before the gate opens.

The hold check for a tool result returned over HTTP decodes its copy of the request body in src/server/index/link-listener.ts (the observer added in 8663249). It uses the same ratio cap as the real request path, but two bounds differ:

  • Size limit. It calls decodeRequestBody without maxBytes, so the 256 MiB default applies, while the handler uses the resolved inbound limit (1 to 512 MiB).
  • Budget and timing. The decode runs as soon as the copy is buffered, before the handler decides whether to accept, and it is never reserved from the inbound body budget. When the budget refuses with 503, cancelling the handler's half of the tee does not stop the copy's half: the copy still reads and synchronously decodes up to 256 MiB and then throws it away.

Trigger: gate open (a code change), switch on, and a releasable hold for the link; a hostile Child can create such a hold by cutting its own socket while a tool call is pending. About 1.3 MiB of zstd per request then decodes to 256 MiB per concurrent request, outside the budget #8594 added. With a raised inbound limit, an identity body between 256 and 512 MiB that the handler accepted no longer releases its hold (safe direction, but a regression from reading it as JSON).

Smallest fix: decode inside the continuation only after the request was accepted, and pass the same resolved inbound limit. Add a test where the budget refuses the request and the copy is not decoded.

Activity

  1. added
    bug
    on Nov 12, 2026
  2. added
    streaming
    on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugstreaming

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions