blog: surviving the refresh - #1112
Conversation
Launch post for the TanStack AI durability release: chat persistence, resumable streams, generation persistence and durable sandboxed agent runs, plus server-side memory, the rebuilt interrupt lifecycle, multi-instance locks and the BytePlus adapter. Every snippet is taken from the new docs pages, so the API names match what ships.
📝 WalkthroughWalkthroughChangesThe new “Surviving the refresh” article documents TanStack AI persistence and durability features. It covers chat recovery, resumable streams, media generation, sandboxed agents, server-side memory, interrupts, locks, zod removal, and related documentation links. Surviving the refresh article
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/blog/surviving-the-refresh.md`:
- Around line 107-120: Update the storage section text around defineMessageStore
to replace “typers” with “type helpers” or the correct exported type name, and
change “testkit” to “test kit” unless it is an official product name.
- Around line 164-170: Update the imports for the POST generation example to
include the exported generationParamsFromRequest helper from `@tanstack/ai`,
alongside generateImage and toServerSentEventsResponse, so the existing call
resolves correctly.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: db479a20-881a-4bf7-a646-f677fb53c982
📒 Files selected for processing (1)
src/blog/surviving-the-refresh.md
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
tanstack-com | ae6ebc7 | Commit Preview URL Branch Preview URL |
Aug 05 2026, 05:15 AM |
Humanize the prose, drop BytePlus from this post, note Start server functions and persistence skills, and fix the generation example import.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/blog/surviving-the-refresh.md (2)
167-210: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winShow the generation recovery route end-to-end.
The prose promises
reconstructGeneration, but the example only showsPOSTwithwithGenerationPersistenceand a client without the reconstruction path. Add the release-version HTTP/TanStack Start wiring, or explicitly limit this section to run metadata persistence rather than restored media bytes.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/blog/surviving-the-refresh.md` around lines 167 - 210, Update the image-generation example to show the complete release-version recovery flow: retain the POST persistence setup, add the HTTP/TanStack Start GET route that invokes reconstructGeneration for the same threadId, and wire the client’s persistence option to that recovery endpoint. Ensure the example’s code matches the documented restored-media behavior, or revise the prose to describe metadata-only persistence if media reconstruction is not included.Source: MCP tools
147-159: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winDo not use
memoryStreamin production durability examples.
memoryStreamkeeps the durability log in this process, so host or replica restarts lose resumable state. UsedurableStreamin both the POST writer and the GET replay handler, and labelmemoryStreamas development-only.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/blog/surviving-the-refresh.md` around lines 147 - 159, Replace memoryStream with durableStream in both the POST writer and GET replay handler examples in src/blog/surviving-the-refresh.md: lines 147-159 and 212-216. Configure durableStream with the request and DURABLE_STREAMS_URL in each handler, and label memoryStream as development-only wherever it remains.Source: MCP tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/blog/surviving-the-refresh.md`:
- Line 282: Update the component example around the interrupts.map(...)
expression so the mapped interrupt controls are included in the component’s
returned JSX. Wrap the expression in the existing return or add a return
statement, ensuring the controls render instead of remaining a standalone unused
expression.
---
Outside diff comments:
In `@src/blog/surviving-the-refresh.md`:
- Around line 167-210: Update the image-generation example to show the complete
release-version recovery flow: retain the POST persistence setup, add the
HTTP/TanStack Start GET route that invokes reconstructGeneration for the same
threadId, and wire the client’s persistence option to that recovery endpoint.
Ensure the example’s code matches the documented restored-media behavior, or
revise the prose to describe metadata-only persistence if media reconstruction
is not included.
- Around line 147-159: Replace memoryStream with durableStream in both the POST
writer and GET replay handler examples in src/blog/surviving-the-refresh.md:
lines 147-159 and 212-216. Configure durableStream with the request and
DURABLE_STREAMS_URL in each handler, and label memoryStream as development-only
wherever it remains.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 94104871-d386-46d5-b8dd-fc10718072aa
📒 Files selected for processing (1)
src/blog/surviving-the-refresh.md
| }) | ||
| ``` | ||
|
|
||
| **Interrupts, rebuilt.** Tool approvals, generic interrupts, and client tools now follow the AG-UI interrupt lifecycle: typed bound resolvers, atomic batches, and structured errors. No database required — the continuation carries the message history. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Return the interrupt controls from the component.
The example shows the interrupts.map(...) expression as a standalone block after useChat. In a component body, it does not render. Wrap it in return (...) or place it inside the component’s existing JSX return.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/blog/surviving-the-refresh.md` at line 282, Update the component example
around the interrupts.map(...) expression so the mapped interrupt controls are
included in the component’s returned JSX. Wrap the expression in the existing
return or add a return statement, ensuring the controls render instead of
remaining a standalone unused expression.
Launch post for the TanStack AI durability release.
What it covers
The problem framing is one user action: a reload mid-answer breaks the transcript, the stream, and the sandboxed agent doing the work. Three layers, three fixes.
POST+GETand theuseChatcall, in a single snippet.withPersistence, client ownership choice, adefineMessageStoreadapter).durabilityadapter,memoryStreamtodurableStreamswap, SSE and NDJSON).withGenerationPersistence,useGenerateImage({ persistence: true })).reapDetachedRuns).@tanstack/ai.Notes
TanStack/ai, so the API names, option shapes and model ids match what ships. Four snippets I first wrote from memory were corrected against the source.library: aiposts. Docs links use/ai/docs/..../blog-assets/<slug>/header.png. Happy to add one before merge.Summary by CodeRabbit