Reopening a chat whose agent run is still going showed a frozen snapshot from the moment it was opened. Add a passive-observer reconnect-poll path: when this tab did NOT start the run locally, poll POST /ai-chat/run every 2s while the run is pending/running and merge its incrementally-persisted assistant message into the thread, so new steps/tool-calls and the growing text appear live. Polling stops on terminal status (refetchInterval keyed on run.status, mirroring the reindex polling); a final messages invalidate shows the persisted end state. Observer-vs-streamer detection: ChatThread reports its local useChat streaming status up; the window only polls/merges while NOT locally streaming (the streamer's SSE owns the view — no double-render). Gated by settings.ai.autonomousRuns; the query is disabled when the feature is off so the flag-gated endpoint is never hit, and a failed fetch can't loop (retry:false -> refetchInterval(undefined)=false). Pure decisions (poll interval, observe gate, message merge) extracted to run-polling.ts and unit-tested; added query enable-gating and ChatThread observer-merge tests. Client-only change — the reconnect endpoint already returns the run plus the assistant message with its metadata.parts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- Configure the top-level
parserOptionsproperty like this:
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
- Replace
plugin:@typescript-eslint/recommendedtoplugin:@typescript-eslint/recommended-type-checkedorplugin:@typescript-eslint/strict-type-checked - Optionally add
plugin:@typescript-eslint/stylistic-type-checked - Install eslint-plugin-react and add
plugin:react/recommended&plugin:react/jsx-runtimeto theextendslist