An AI SDK Stop button on Vercel needs server-side cancellation wiring

A Stop button that freezes the text in your chat UI does not, by itself, prove that the server-side model request was canceled. For AI SDK routes deployed on Vercel, the important decision is whether you have wired cancellation through the server—not just exposed stop() in the browser.

The AI SDK “Stopping Streams” documentation, captured September 13, 2026, describes the required chain:

stop() → client HTTP request aborted → runtime aborts req.signal → route forwards it as abortSignal → model request canceled.

That is a documented integration contract, not a report of a tested deployment.

Check three server-side requirements

The documentation says Vercel request cancellation is Node.js-only and must be enabled for each function that needs it. Audit these three items together:

Check What to look for
Runtime The function uses the Node.js runtime.
Function configuration The relevant function has supportsCancellation: true in vercel.json.
Signal forwarding The AI SDK Core call receives abortSignal: req.signal.

The source’s vercel.json example is:

{
  "functions": {
    "app/api/chat/route.ts": {
      "supportsCancellation": true
    }
  }
}

app/api/chat/route.ts is the example function path, not a universal key to paste into every project. Match the configuration to the function serving your streaming request. Inside that route, the source passes abortSignal: req.signal to streamText; enabling the function setting is not a substitute for forwarding the signal.

The documented failure mode is useful for debugging: without supportsCancellation, the client-side stream still stops, but server-side generation may continue. A browser-only check can therefore give you false confidence. Treat visible silence and propagated cancellation as different observations.

Decide between abort and resume

Before adding cancellation plumbing, check whether the chat uses resume: true. The documentation explicitly says stream abort is incompatible with stream resumption in useChat: abort breaks the resumption mechanism, so choose one or the other.

That makes this a behavior choice, not merely a button implementation detail. If stopping the in-flight request is your intended behavior, review the resume setting alongside the route configuration rather than treating both features as independently switchable.

Cleanup comes after the cancellation path

The source provides onAbort for abort-specific cleanup, including saving partial results; its steps value contains completed steps before the abort. For UI message streams, the example uses onEnd with isAborted and supplies consumeStream through consumeSseStream to createUIMessageStreamResponse for proper abort handling.

Those hooks help handle an interrupted stream. They do not replace runtime propagation or abortSignal forwarding.

My suggested verification sequence is to audit the three server requirements, check the resume setting, then exercise both an interrupted request and a normally completed one. Record browser disconnection and server abort handling separately. If provider-side cancellation evidence is available, inspect that separately too; do not infer it from the last visible token.

The boundary matters: this documentation does not establish cancellation latency, guaranteed cessation of computation or billing, or compatibility across every model provider. Use it to wire and verify the request lifecycle—not to promise that clicking Stop immediately ends all upstream work or charges.

I would add a persistence check to the cancellation runbook: does an interrupted answer remain distinguishable from a completed answer after a reload? Correct signal forwarding does not, by itself, answer that application-level question.

The Stopping Streams documentation describes onAbort as an abort-specific cleanup hook, with steps containing completed steps before the abort. For UI message streams, it exposes isAborted in onEnd. Those are useful inputs for deciding how to save an interrupted result; neither is a promise that the saved record contains every token the browser displayed.

My proposed acceptance test would be:

  • Give each test generation an application-owned identifier, and record its termination outcome separately from whether saving succeeded. Keep prompts and response bodies out of diagnostic logs.
  • Stop a response mid-stream, then reload the saved conversation. Check that any retained partial answer is marked interrupted, rather than silently presented as a completed answer.
  • Run a normal completion as the control. Then exercise Stop close to completion and check that the stored outcome is unambiguous. This is a boundary test, not a claim about callback ordering.

I would withhold the persistence change if a failed cleanup write is reported as successfully saved, or if an interrupted result becomes indistinguishable from a completed one. Investigate that storage boundary separately from signal propagation. These are proposed application checks—not deployment results, and not evidence that provider computation or billing has stopped.