Skip to content

Add a core streaming-response capability for node/vercel, refused on aws #659

Closed

Description

@jimhoyd

Context

Split out of #626 (MCP transport/spec parity). Investigation (see comment on #626) found that @jimhoyd/urlcode-mcp's remaining gap — the Streamable HTTP transport's optional GET/SSE stream for server-initiated messages, plus Mcp-Session-Id session resumption — cannot land as a package-only change: HandlerResult (the generic extension response type every runtime target implements) is a single buffered {status, headers, body?} every host awaits in full. There is no streaming seam anywhere in prepareResponse/writeResponse, and no session/connection registry in core for resumption to build on.

Findings on feasibility per target

  • packages/core/src/server.ts and vercel.ts both sit on real node:http ServerResponse objects — chunked/long-lived writes are architecturally reachable, but need their own admission/timeout treatment (the current requestTimeoutMs/maxInFlightRequests are tuned for short buffered requests, not long-lived streams).
  • packages/core/src/aws.ts is a genuine structural blocker: classic Lambda payload-format-2.0 (one JSON event in, one Promise<LambdaResponse> object out). Real Lambda response streaming needs awslambda.streamifyResponse() with an entirely different handler signature (Function URLs + RESPONSE_STREAM) — not an incremental change.
  • Cloudflare is out of scope entirely: packages/core/src/extensions.ts's prepareExtensions hard-asserts extension targets can only be node/aws/vercel — Workers don't run RuntimeExtensions at all today, so this was never reachable there regardless of streaming.

Suggested split

  1. This issue: a core-only PR adding an additive streaming capability, consumed only by server.ts/vercel.ts, explicitly refused (not silently ignored) on aws, reported through capabilities.ts's existing native/delegated/refused vocabulary, with its own RIM-* card in docs/RUNTIME-IMPLEMENTATION.md.
  2. Follow-up, packages/mcp-only: consume the new capability for the GET/SSE stream plus a bounded Mcp-Session-Id registry with Last-Event-ID replay, proven with real reconnect-after-restart tests. (Tracked as the remainder of [Request]: full MCP transport/spec parity for @jimhoyd/urlcode-mcp (streaming, batching, pagination, resources/prompts) #626.)

Not a commitment

Per the ai-first/evidence-gathering pattern this repo uses elsewhere: this issue records the investigation so the design isn't re-derived from scratch next time, not a decision to implement. A maintainer should confirm the split above (or propose a different one) before either PR is attempted.

Activity

  1. added
    enhancement
    needs-decision
    on Sep 24, 2026
  2. jimhoyd commented on Sep 24, 2026

    @jimhoyd
    CollaboratorAuthor

    Decision (owner, 2026-09-24): parked. No current tool needs progress or log streaming. Reopen the decision when a real tool does; the first step would then be SSE replies to POST for progress/logging on node (vercel delegated, aws refused).

  3. removed
    needs-decision
    on Sep 24, 2026
  4. jimhoyd commented on Sep 26, 2026

    @jimhoyd
    CollaboratorAuthor

    Decision (owner, 2026-09-26): un-parked. Build streaming generically, with the MCP use in the same pull request.

    • Core: a generic, additive streaming response capability. It is usable by extensions and by trusted function routes.
      • sandbox: true routes are refused; the isolated worker keeps returning whole buffered answers, unchanged.
      • node is native. vercel runs on node http and is supported the same way.
      • aws, cloudflare and static targets refuse it before serving, never silently buffering. This is reported through capabilities.ts's native/delegated/refused vocabulary.
      • Streams get their own limits (idle timeout, maximum duration, concurrent streams, bytes), separate from the short-request admission limits. A client disconnect cancels the producer, and shutdown drains streams.
      • There will be a new RIM-* card plus docs and tests.
    • MCP (same pull request):
      • SSE replies to POST for notifications/progress, and the optional GET/SSE server stream.
      • A bounded Mcp-Session-Id registry with Last-Event-ID replay.
      • Tested with real disconnect and reconnect.
      • Refused on aws.

    Generated by Claude Code

  5. added
    in-progress
    on Sep 26, 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

    enhancementin-progress

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions