Skip to content

Handle oversized WASM host responses without misleading fetch errors #16

Closed

Description

@kayahk

Problem

The WASM SDK uses a fixed 1 MiB mallocBuffer for host-managed allocations. A fetch response's JSON-encoded envelope must fit in the space remaining after the invocation request and prior host allocations. On allocation failure the host yields an empty response, and the SDK reports plugin: fetch: empty response from host; provider code can misreport this as network unreachability.

This is not hypothetical: a read-only GitHub REST kubernetes/kubernetes issue-list page with per_page=100 was 1,168,331 bytes; the SDK fetch envelope was 1,238,310 bytes. A scratch WASM harness using the pinned SDK reproduced the failed allocation and empty-fetch error; a small control succeeded. With a 41-byte request, an envelope of 1,048,535 bytes succeeded and 1,048,536 failed.

Requested outcome

  • Handle large host fetches and outgoing results without silently exhausting a shared allocation arena; retain explicit resource limits.
  • Return a clear actionable size-limit error rather than an empty response or misleading network error when a response cannot be delivered.
  • Cover request-plus-host-allocation boundaries and oversized responses in tests using the actual WASM runtime and host path.
  • Audit sibling host allocation calls for the same failure mode and keep existing plugin compatibility.

The proposed GitHub issue-list implementation (Paca-AI/paca-plugin-github#33) temporarily uses one issue per page to reduce exposure, but this is not a universal fix: one response can still be oversized, and prior allocations consume arena space. Companion SDK contract PR: #15.

Activity

  1. pikann commented on Nov 3, 2026

    @pikann
    Contributor

    Hi @kayahk ,

    Thanks for catching this! I'll push a fix soon

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions