Skip to content

A late interrupt submission failure accesses a reset InterruptManager #1218

Closed

Description

@kolaworld

TanStack AI version

0.48.0

Framework/Library version

@tanstack/ai-client: 0.26.0 | @tanstack/ai-svelte: 0.18.3

Describe the bug and the steps to reproduce it

An interrupt resume submission can settle after the InterruptManager has been reset or hydrated for another run.

When the obsolete submission fails, its asynchronous failure handler mutates the current manager and can replace the original error with:

InterruptManager is not hydrated.

submitBatch() starts performSubmission() without awaiting it. If the manager is reset while options.submit() is pending, the rejection still enters handleSubmissionFailure().

The uncorrelated transport and protocol-error branches call addRootError(). addRootError() requires live hydration, although reset() has already cleared it.

Because performSubmission() was launched with void, this becomes an unhandled promise rejection and masks the submission error that caused it.

Any submission failure can expose this bug when the manager is reset or rehydrated before failure handling completes.

Expected behavior

InterruptManager should retain a fresh operation object for each submission attempt. performSubmission() should compare its captured operation with the active one before handling a failure and again in finally.

reset() and hydrate() should invalidate the active operation. If a captured operation is no longer active, it should settle without changing errors, item states, retry state, resuming or published state.

This follows an established client pattern. GenerationClient only clears loading state when the captured controller still owns the operation, while ChatClient applies the same identity check to subscription cleanup and connection cleanup.

The stale completion should not replace the original submission failure with a secondary InterruptManager is not hydrated rejection.

performSubmission() can remain internally asynchronous and fire-and-forget.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://stackblitz.com/edit/vitejs-vite-gegvgtdh?file=src%2Fmain.ts

Do you intend to try to help solve this bug with your own PR?

Yes, I am also opening a PR that solves the problem along side this issue

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Activity

  1. added
    waiting-on: maintainer
    has-pr
    on Aug 23, 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

    has-prwaiting-on: maintainer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions