BuilderIO / BuilderIO/agent-native
Chat: agent-chat/runs/active polling loops and trips React Maximum update depth exceeded, swallowing clicks inside inline extensions
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 449
- Avg merge
- 10h 24m
- Merged PRs (30d)
- 883
Description
# Chat: `agent-chat/runs/active` polling loops and trips React "Maximum update depth exceeded", swallowing clicks inside inline extensions
**Version:** `@agent-native/core` 0.176.4, Chat template, local dev gateway (React Router SPA at `/chat`).
**What happens.** With a Chat thread open, the client polls `/_agent-native/agent-chat/runs/active` in a tight loop before any user interaction. Intermittently the console shows:
Error: Maximum update depth exceeded. This can happen when a component repeatedly calls
setState inside componentWillUpdate or componentDidUpdate.
at activeRunHandler (MultiTabAssistantChat-*.js)
at notifyActiveRunStateChanged (FeedbackButton-*.js)
at updateActiveRunSeq (FeedbackButton-*.js)
at readSSEStream (MultiTabAssistantChat-*.js)
While this is happening, a click on a button inside a transient inline extension (rendered by `render-inline-extension`, button calls `agentNative.chat.send(label, { submit: true })`) produces no user message. Hover states inside the iframe still change, so pointer events reach the sandbox; the bridge send is what gets lost. After a plain page reload the same click works and the message is submitted. Observed twice in one session on 2026-09-09; the Content and Assets templates' chats did not show it in the same session.
**Why (probable).** The active-run state notifier (`notifyActiveRunStateChanged` / `updateActiveRunSeq`) re-renders on every SSE read, and the `runs/active` poll appears to re-arm without a back-off, so the run-state store updates faster than React allows; the extension bridge message lands during the storm and is dropped.
**Expected.** A single in-flight poll with a back-off, and run-state updates coalesced so a bridge `chat.send` is never lost while the panel is idle.
**Workaround used.** Reload the page and click again. No app code change.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce in the Chat template at /chat while tracing the /_agent-native/agent-chat/runs/active poll and the activeRunHandler, notifyActiveRunStateChanged, updateActiveRunSeq, and readSSEStream entry points named in the report. Confirm that polling does not loop tightly, React avoids the maximum update depth error, and a button calling agentNative.chat.send(label, { submit: true }) reliably submits a message during the idle panel state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100