other runtime hooks still lose in-flight work on a fast refresh
the fix for #7872 covers the thread list path (useRemoteThreadListRuntime, useCloudThreadListAdapter, and the AssistantRuntimeImpl wrappers). the same fast refresh contract still breaks these hooks when they run in the edited component's render: memos recompute with their deps ignored, every effect runs cleanup then setup in the same commit, and only state and refs survive.
identity held in a memo
packages/react-a2a/src/useA2ARuntime.ts:72and:98: the managedA2AClientand theA2AThreadRuntimeCoreare rebuilt, so a refresh starts an empty session and orphans the running turn.packages/react-ag-ui/src/useAgUiRuntime.ts:312: the runtime wrapper is rebuilt.packages/react-opencode/src/useOpenCodeRuntime.ts:386,:390,:399: the client, the controller registry, and the thread list adapter are rebuilt, and a new adapter identity resets the thread list.packages/react-pi/src/runtime/usePiRuntime.ts:548and:555: the registry and the thread list adapter, same as opencode.
teardown in a cleanup that refresh re-runs
packages/core/src/react/runtimes/useExternalStoreRuntime.ts:36: the cleanup invalidates the main thread's generation and the setup is empty, so an in-flight append, voice commit, or pendingsendTextdrops.packages/core/src/react/runtimes/useExternalStoreRuntime.ts:46: detaching the history copy drops a pending copy, and the re-attachseed()marks the uncopied messages as copied, so they never reach the history adapter. an<Activity>hide and show does the same.packages/ai-sdk/src/runtime/useAISDKRuntime.ts:253: aborts the suggestion generation in flight, and nothing restarts it.packages/react-a2a/src/useA2ARuntime.ts:202andpackages/react-ag-ui/src/useAgUiRuntime.ts:321:detachRuntime()aborts or cancels the active run.packages/react-opencode/src/useOpenCodeRuntime.ts:392andpackages/react-pi/src/runtime/usePiRuntime.ts:550:registry.dispose()disposes the event source and every controller.packages/eve/src/useEveAgentRuntime.ts:377: the cleanup bumpssendEpochRef, so sends queued behind an active turn reject.
edits inside a runtime hook
with the thread resources kept across a refresh, the edited runtime hook body runs, but tap compares memo deps normally, so a useCallback or useMemo inside a runtime hook keeps its closure from before the edit until the thread remounts. repro: a runtime hook with useCallback(() => sendTo("/old"), []), edit it to "/new", refresh, send; the old callback runs. React recomputes memos on a refresh; the tap equivalent would re-render hosted resources with deps ignored, which re-runs their effects too, so it needs the teardown guards above first.
constraint
moving a memo into state is safe everywhere. for teardown, a generation guard like the one useRemoteThreadListRuntime uses now fixes refresh in both react and tap, because refresh runs the setup in the same tick as the cleanup; it keeps today's teardown on an <Activity> hide, which stays with #8034. useHostDestroySignal only fits a hook that never runs as a thread list runtimeHook, since under tap it aborts on every soft unmount.
Source: assistant-ui/assistant-ui