The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(chat): keep snapshot polling alive across socket resubscribes
Steven Enamakel6181e0e02fc2
diff --git a/app/src/providers/ChatRuntimeProvider.tsx b/app/src/providers/ChatRuntimeProvider.tsxindex 9bc57700e4..de5b271966 100644--- a/app/src/providers/ChatRuntimeProvider.tsx+++ b/app/src/providers/ChatRuntimeProvider.tsx@@ -412,6 +412,12 @@ function chatTurnUsagePayload(event: ChatDoneEvent): {const ChatRuntimeProvider = ({ children }: { children: React.ReactNode }) => {const dispatch = useAppDispatch();+ const snapshotPollingRef = useRef<AbortController | null>(null);+ useEffect(() => {+ const controller = new AbortController();+ snapshotPollingRef.current = controller;+ return () => controller.abort();+ }, []);// Latest translator for the long-lived socket handlers below: a failed turn's// copy is rendered in the locale active when the error arrives.const { t } = useT();@@ -620,7 +626,10 @@ const ChatRuntimeProvider = ({ children }: { children: React.ReactNode }) => {useEffect(() => {if (socketStatus !== 'connected') return;- const snapshotPolling = new AbortController();+ // A terminal snapshot must survive a socket subscription refresh, but+ // cannot outlive the provider that owns its store projection.+ const snapshotPolling = snapshotPollingRef.current;+ if (!snapshotPolling) return;// When a turn ends, any follow-ups the user queued behind it are about to be// dispatched by the backend as fresh turns. Nothing else persists their@@ -1997,7 +2006,6 @@ const ChatRuntimeProvider = ({ children }: { children: React.ReactNode }) => {const cleanup = subscribeChatEvents(coalesced.listeners);return () => {- snapshotPolling.abort();rtLog('unsubscribe_chat_events');coalesced.dispose();cleanup();