OpenClaw handles the expired Streamable HTTP session in its own code

Kind: nuance · Status: current · Last verified: 2026-08-26 · Clients: openclaw, opencode · Revisions: 2025-11-25

The detection is a four-part predicate over the SDK's own error type:

return (
  session.transportType === "streamable-http" &&
  session.transport instanceof OpenClawStreamableHTTPClientTransport &&
  session.transport.sessionId !== undefined &&
  error instanceof StreamableHTTPError &&
  error.code === 404
);

The comment above the call site states the rule the recovery follows: reinitialize a fresh client, and never replay a possibly mutating call. So the session is recycled and the in-flight tool call still fails. The same function is imported and used by the node host at src/node-host/mcp.ts:592, so both surfaces behave the same way.

What makes this worth recording is the comparison. opencode carries a bun patch against SDK 1.29.0 adding session recovery inside the transport. OpenClaw reaches the same requirement and solves it outside the SDK, without patching: patches/ is empty and there is no patchedDependencies block.

Two independent clients on the same official TypeScript SDK both found stock 404 handling insufficient and each built a workaround. That is better evidence for the upstream report than opencode alone, and it also shows the workaround does not require a patch — which is the argument for the SDK carrying it.

The two workarounds are not equivalent. opencode's patch recovers inside the transport, so a call can survive. OpenClaw's recycles the session and lets the call fail, deliberately, because it will not replay a request that may have mutated state. A server author cannot assume either behaviour.

Sources