Skip to content

Say "Reconnecting…" on the live line while a Bot retries its model - #2942

Merged
davidmckayv merged 3 commits into
mainfrom
reconnecting-line
Dec 4, 2026
Merged

davidmckayv merged 3 commits into
mainfrom
reconnecting-line

Conversation

@davidmckayv

@davidmckayv davidmckayv commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

What

While a Bot waits to try a dropped model call again, the turn's live line says "Reconnecting…" in place of "Thinking". Same line, same place, same shimmer, same role="status". Nothing new is drawn. If the Bot runs out of tries, the run ends with its error and the existing "connection dropped" notice and Carry on appear, unchanged.

Mid-turn, after the Bot has already said something, nothing used to show while the next model call was pending. While reconnecting, the same line now comes back under the Bot's words and goes when the Bot carries on.

Why

A Bot stopped mid-turn when its model connection dropped, and the person had to press Carry on. The engine is being changed to retry transient model failures by itself, with backoff, and carry the turn on. The person should see only a quiet sign that it is reconnecting while it waits.

The contract, plain AG-UI

Any Bot can send it, built in or connected, as CUSTOM events on its run:

  • openbot.reconnecting, value { attempt, attempts, retryInMs } (attempt counted from 1). One per wait, several in a row allowed.
  • openbot.reconnected, value {}, when the retried call starts answering.

The line also clears on any later non-CUSTOM event of the run (words, a tool call, reasoning, a step, RUN_FINISHED, RUN_ERROR), and when the run ends or fails. Other CUSTOM events change nothing. Documented on AgUiEvent in api/asyncapi.yaml as two new optional members, name and value. The change is additive: api:live:diff reports no break, and api:lint passes.

How

  • app/src/lib/copilot/reconnecting.ts: watchReconnecting(agent, set) subscribes to the agent's AG-UI events (onEvent, onRunInitialized, onRunFinalized, onRunFailed) and keeps the state per run. useReconnecting(agent) is the hook.
  • channel-chat.tsx reads it from the conversation's agent and passes reconnecting through ConversationView to ChatTranscript.
  • chat-transcript.tsx: Thinking reads "Reconnecting…" while reconnecting, and is drawn while busy && reconnecting as well as where it was drawn before.

What the leaders do

  • Cursor shows a plain "Reconnecting…" while the live connection drops and re-attaches. The agent keeps running on its side (Cursor forum, staff reply). Cursor shows "Agent stopped retrying" with a Retry button only when it gives up (forum).
  • OpenAI Codex shows "Reconnecting... 1/5" with an attempt count, then "stream disconnected before completion" when it gives up (openai/codex#11741, #13245).
  • Claude Code retries transient failures up to 10 times with exponential backoff before it shows an error. While it waits, its status line reads "Waiting for API response · will retry in …" (Claude Code errors).

Most of them retry quietly, with a short status line on the work line, and say something only when the retries run out. This follows that pattern with the quiet "Reconnecting…" wording. The events carry attempt, attempts and retryInMs, so a count could be added later.

Tests

  • app/tests/reconnecting-line.test.tsx feeds real AG-UI events through a real AbstractAgent, the same useReconnecting subscriber the screen uses, and the real ChatTranscript. It checks that "Reconnecting…" appears on the live line and goes on openbot.reconnected, on the next words, at run end, and on RUN_ERROR, including mid-turn under the Bot's words. Red without the transcript change (3 fail: the line still says "Thinking", or nothing mid-turn). Green with it.
  • app/tests/reconnecting-line-layout.test.tsx runs the real ConversationView in a real browser (Chromium and WebKit, light and dark, 1000px and 390px wide). It checks that "Reconnecting…" is drawn exactly where "Thinking" was, at the same size, colour and weight, on one line, with no sideways scroll, under the Bot's words mid-turn, and gone once it carries on.

Changelog

Conversations.

  • When a Bot's model connection drops and it tries again, the conversation shows "Reconnecting…" until it carries on.

API.

  • A Bot's run can send the AG-UI CUSTOM events openbot.reconnecting and openbot.reconnected while it waits to try its model again. Any Bot can send them, built in or connected.

A Bot whose model connection drops now tries again by itself. While it
waits, its run sends a CUSTOM openbot.reconnecting event, and
openbot.reconnected once the retried call answers. The turn's live line
reads "Reconnecting…" in place of "Thinking" until then, or until any
other event of the run, or its end. Mid-turn it shows under what the Bot
already said. Same line and shimmer, nothing new drawn.

The two events are documented on AgUiEvent in api/asyncapi.yaml, so any
Bot can send them over plain AG-UI.
CI holds every real-browser test to a real-browser job, so the new layout test is listed in the Chromium and WebKit one.
…ing… layout test

Browser tests wait for the page, never the clock (no-fixed-settle-waits.test.ts).
@davidmckayv
davidmckayv marked this pull request as ready for review December 4, 2026 16:56
@davidmckayv
davidmckayv added this pull request to the merge queue Dec 4, 2026
Merged via the queue into main with commit 29359cb Dec 4, 2026
50 of 52 checks passed
@davidmckayv
davidmckayv deleted the reconnecting-line branch December 4, 2026 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant