Repository navigation
Description
TanStack AI version
0.44.0
Framework/Library version
@tanstack/ai-client: 0.23.2 | @tanstack/ai-persistence: 0.1.2 | @tanstack/ai-svelte: 0.16.2
Describe the bug and the steps to reproduce it
#1086 covers the client-side gap: recognizing that server hydration installed hidden client-tool interrupts so an application can call cancelInterrupts(). That issue stops once the cancelled resume batch is submitted.
The server-authoritative resume path then drops those cancellations.
- The client submits cancelled resume entries for the pending client-tool interrupts.
withPersistenceonConfigtranslates persisted pending interrupts intoresumeToolStateand clearsconfig.resume, so the engine skips ephemeral reconstruction middleware.ts#L1475-L1486.resumeToolStateFromPending()handles approvals and resolved client-tool results, but never maps a cancelled client-tool entry intocancelledToolCallIdsmiddleware.ts#L393-L423.
The ephemeral path already does the right thing: cancelled bindings are added to cancelledToolCallIds in interrupt-resume.ts#L631-L633. The tool executor then emits an output-error result (Tool execution cancelled) instead of re-interrupting tool-calls.ts#L806-L813.
Because persistence clears config.resume and supplies an incomplete resumeToolState, the engine still sees the stored tool call as unhandled and emits another client-tool interrupt instead of an output-error. Cancelling a hydrated orphaned client tool therefore cannot complete the turn under withPersistence.
Expected behavior
resumeToolStateFromPending() should mirror the ephemeral resume translator:
- cancelled client-tool (and approval) entries populate
cancelledToolCallIds - resolved client-tool entries continue to populate
clientToolResults - a resume batch that is only cancellations still produces a non-empty
resumeToolStateso the engine does not fall through to a fresh interrupt
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
None
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