Agent sidebar: a pending approval is replaced by "The server says this chat is no longer running" after a few seconds
Agent sidebar: a pending approval is replaced by "The server says this chat is no longer running" after a few seconds
Summary
We use Agent Native. When the agent pauses for an approval in the agent sidebar, the approval card is removed after a few seconds and replaced with the banner "The server says this chat is no longer running. Reload to see its result." The Stop button stays visible, and the user can no longer approve or deny the call.
The same request in the full-page chat (/chat) works: the approval card stays until the user answers it, with no banner.
Environment
- Versions:
@agent-native/core,@agent-native/toolkitand@agent-native/agentkit0.209.2 - App: reproduced in a freshly scaffolded app (
create --standalone --template chat), run withagent-native dev, and in our internal app, which uses the agent sidebar as its main chat. - Model:
gpt-6-lunaviaai-sdk:openai - We use the framework's chat UI:
AgentSidebar, and the template's full-page chat route for comparison. - Not run on the latest stable release (
0.214.0), but the relevant code is described under "Relevant code observations".
Steps and observed behavior
Agent sidebar (fails)
- Open a page with the agent sidebar, for example
/home?agentSidebar=open, and start a new chat in the sidebar. - Ask for something that needs approval, for example: "Can you write a shared skill to write a pop song?" The agent calls
resourceswithaction: "write"andscope: "shared". - The approval card appears (about 17 seconds after sending). The Stop button is visible.
- Don't click anything. About 3–5 seconds later, the banner "The server says this chat is no longer running. Reload to see its result." appears, the approval card disappears, and "Agent activity" is left empty. The Stop button is still visible.
Full-page chat (works)
- Open
/chatand send the same request. - The approval card appears after about the same time. The Stop button is visible.
- Don't click anything. After 15 seconds the card is still there and there's no banner. In an earlier run, the card stayed for about four minutes and approving it then worked.
What's the same in both
- While the card is pending, both surfaces poll
GET /_agent-native/agent-chat/runs/active?threadId=…, and the server returnsactive: false,status: "completed",terminalReason: "done". - The run's event stream ends with
approval_required,tool_done(with the approval-pause result),text("Waiting for your approval to run resources.") anddone. In our internal app we timed it: the chat request finished at the same moment the approval card appeared, the firstactive: falsecame about 2.5 seconds later, and the banner about 5 seconds after that.
So both surfaces receive the end of the run, both keep showing Stop, and both get active: false from the server. Only the sidebar treats that combination as a lost run.
Expected behavior
In the sidebar, as on the full-page chat, a pending approval stays on screen until the user approves or denies it, without a "no longer running" banner.
Impact
In apps that use the agent sidebar as their chat, any action that needs approval can't be approved unless the user clicks within a few seconds. After the banner, reloading shows the thread without the approval card.
Relevant code observations
These are static source observations from 0.209.2:
hasActiveAgentRunsin@agent-native/agentkitdist/client/state.jscounts a run inawaiting_approvalwith an unresolved approval as active. This matches the Stop button staying visible on both surfaces while the card is pending.- In
@agent-native/core's run manager (dist/agent/run-manager.js), the run is markedcompletedwhen the agent loop pauses for approval, so/runs/activereportsactive: falsefor the paused run. RunStuckBannerin@agent-native/toolkitsrc/app/chat/RunStuckBanner.tsxshows the "no longer running" message (agentChat.recovery.statusMismatch) when the chat still shows a run in progress, the server has reported it settled, and reconciling the thread (reconcileSettledRun) doesn't clear it.- The two surfaces use different chat components. The sidebar (
AgentSidebar→MultiTabAssistantChat) rendersAgentKitAssistantChat, which includesRunStuckBanner. The template's full-page chat route rendersCoreAgentKitRoot/AgentKitChat, which doesn't includeRunStuckBanner. In our search of@agent-native/toolkit0.209.2,RunStuckBanneris only rendered byAgentKitAssistantChat.
Taken together, these suggest the sidebar's stuck-run check treats a run that's paused for approval (shown as running, reported settled by the server) as a lost run. The full-page chat has no such check, so its approval card stays.
In 0.214.0, reconcile-settled-run.ts adds isWaitingOnConnectionRequest, documented as: "A run that yielded to a connection request ends on the server by design, so the server reporting it settled says nothing about a chat that is waiting on the user rather than on a response." AgentKitAssistantChat now passes isAwaitingResponse={() => isRunning && !isWaitingOnConnectionRequest(thread)}. A run paused for approval is the same situation, but isn't covered by that check, and RunStuckBanner.tsx and hasActiveAgentRuns are unchanged. So we expect this still happens in 0.214.0.
Thanks for the report. The pending-approval sidebar behavior was addressed in https://github.com/BuilderIO/agent-native/pull/8137, which is merged; the original incident was not reproduced.