Skip to content

fix(native-chat): stop flashing a reconnecting line on a stream drop - #24898

Merged
brennanb2025 merged 14 commits into
mainfrom
brennanb2025/chat-reconnecting-line
Oct 7, 2026
Merged

brennanb2025 merged 14 commits into
mainfrom
brennanb2025/chat-reconnecting-line

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​526 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​520
Prod 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​344 $\color{#cf222e}{\Huge{\mathbf{−}}}$​119 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​225

ELI5

When the connection that streams a chat's messages blipped for a moment, the native chat flashed "Reconnecting to this chat…" above the message box for about a second, and then it went away. Nothing was wrong and there was nothing to do, so the line was noise. A chat that had loaded but had no messages yet was worse: the whole pane flipped to "Could not load conversation" for that second.

This PR stops a brief blip from changing the chat at all. When the remote host itself really is unreachable, the chat now says so in one line that names the host, the way the common pattern does: " is reconnecting…" once it has been reconnecting for a couple of seconds, or " is offline" with a Reconnect button.

Follow-up to #24564, which added a written rule for status messages: a message that flashes for a passing state is removed, not delayed.

What Changed

The problem. The native chat reads its transcript through a live stream. When that stream drops (a network hiccup, a remote host restarting, the computer waking from sleep), the read reports the failure at once and retries 750 ms later; the retry almost always succeeds. The failure was stored as the chat's error state even when the chat had already loaded, and two things displayed it: a grey "Reconnecting to this chat…" line above the composer when the chat had messages, and the full-pane "Could not load conversation" screen when it had none. Both flashed for about a second on every drop. And because the line was per chat and tied to the stream, it was also the only thing a chat said when a remote host went away for a long time — without naming the host or offering anything to do.

What this changes for you

Situation Before After
A loaded chat; its stream drops once "Reconnecting to this chat…" flashes above the composer for ~1 s (or the empty chat flips to "Could not load conversation") Nothing changes; the app reconnects in the background
The chat's remote host stops answering (host Orca stopped, host asleep, network gone) "Reconnecting to this chat…" in every open chat on that host, naming nothing After 2 s: " is reconnecting…" above the composer, naming the host; it disappears the moment the host is back
The remote host is disconnected (for example you chose Disconnect, or it was never reached) "Reconnecting to this chat…" " is offline" at once, with a Reconnect button (the same action as the status bar's Connect). A host that refuses the connection (for example a revoked pairing) also reads "offline", with no button, because reconnecting can't help
You send a message while the host is unreachable The send fails as "Message was not sent." with Retry Unchanged: it still fails as "Message was not sent." with Retry; the notice above now explains why
A chat that never loaded but already shows your own message, and its history keeps failing to load "Reconnecting to this chat…" "This chat's history couldn't be loaded." beside your message (or, while its host is unreachable, the host notice instead)
The host refuses the read (for example "Orca couldn't open this chat's history right now", or a damaged history) Its words Unchanged

Mechanism.

  • A blip no longer becomes chat state. The chat's history reader (structured-agent-session-read-owner.ts) now decides what a read failure means. Once the chat has loaded, a failure that comes with no refusal from the host is treated as lost contact: it is not stored as the chat's error, and the stream keeps retrying exactly as before (750 ms, doubling up to 30 s, and at once when a remote host comes back). Any refusal the host sent, and any failure before the chat first loads, is stored and shown as before. So a loaded chat only shows an error the host actually sent, and the status area under the transcript loses its special "reconnecting" case (the string is removed from every language file).
  • A host outage is shown from the host's state. A new hook (use-native-chat-host-outage.ts) derives the notice from the connection state Orca already keeps for each remote host (the same state the status bar's host list reads); nothing new is stored. "Reconnecting" (and "checking", and a host whose Orca isn't answering yet) shows only after the host has stayed that way for 2 s, so a normal reconnect never flashes it; "disconnected" shows "offline" at once and stays until the host is connected again, so background retries don't flip it back and forth. Temporary-VM hosts are covered. A per-chat stream blip can't trigger it, because it doesn't change the host's state. The notice (NativeChatHostOutageNotice.tsx) sits above the status area in a screen-reader status region.
  • Said once. While the host notice shows, a read failure caused by lost contact adds no line of its own, and a chat that never loaded shows the quiet loading spinner instead of "Could not load conversation". "Load earlier messages" isn't offered while the host is unreachable.
  • Reconnect reuses the status bar's existing Connect action, moved unchanged into status-bar/runtime-environment-explicit-connect.ts so both can call it. The reader's older-history paging moved, unchanged, into structured-agent-session-older-page-read.ts to keep the reader within the file-length limit.

Why

Fix the state, not the line. Deleting only the grey line would have left the same blip flipping an empty chat to a full-pane error, because the transient failure was still stored as the chat's error. Keeping it out of the chat's state once the chat has loaded removes every display of it at once.

Say the host's outage, scoped to the host. Whether a remote host can be reached is a fact about the host, not about one stream, so the notice is derived from the host's connection state and names the host. That is what the common pattern does inside the chat. Orca's other host surfaces (the status bar's host list and the sidebar workspace card) are too indirect to carry it alone: the status bar's button is one combined indicator (host names appear only after opening its menu), and the sidebar card only marks a host once it's confirmed down. Over SSH, a lost connection only means the host's state can't be checked yet, not that anything failed, so the copy says "reconnecting", not "failed".

Alternatives considered.

  • Delay the old line (show it only after a few seconds): it would still be tied to the per-chat stream, name nothing and offer nothing; the rule is to fix the state rather than delay a flashing message. The 2 s wait here is on the host's state, which a stream blip doesn't change.
  • Promise in the composer that messages will send when the host reconnects: not true today. A send during an outage fails as "not sent" with Retry, so the composer stays as it is. Making a send wait for the host is part of a separate, planned change to how failed sends are handled.

Differences from the common pattern

  • No in-chat cue during a brief stream drop — Intended. Orca shows nothing while a dropped stream reconnects, rather than a delayed syncing placeholder: the drop no longer changes the chat's state, and the stream reconnects on its own.
  • Sending is not held back during an outage — Temporary. The common pattern holds a send back while the host is unreachable. Orca lets you send, and the send fails as "Message was not sent." with Retry, with the host notice explaining why. Follow-up: the planned failed-send change returns such a message to the composer with its reason (owned outside this PR).
  • A loaded chat on a host running Orca 1.4.217 or older shows nothing when that host refuses a read — Intended. Those versions don't attach a refusal to their errors, so their refusal looks exactly like a dropped connection, and the chat treats it as one (keeps its messages and keeps retrying). A real outage of such a host still shows the host notice. Before, it showed "Reconnecting…", which didn't describe the problem either. This disappears as hosts update.

Linked Issue

Follow-up to #24564.

Visual Proof

A chat on a remote Orca host. Captured on a separate Mac test machine with two isolated, hidden test setups: a remote Orca host plus a desktop app paired to it, one setup built from main (before) and one from this PR (after), with a stand-in agent (no real agent, account or login). The app was driven by a non-Claude automated QA agent. Timings come from an in-page timeline of what text was on screen, in milliseconds after each event. The host is named "qa-host". These were captured on this PR's commit fde0885; later commits only merge main, align the notice's width with main's new chat-width setting, and fix a test.

1. One stream blip while the host stays connected. Before: "Reconnecting to this chat…" was on screen from +86 to +899 ms. After: nothing appeared through 4.6 s.

Before (~0.3 s after the blip) After (~0.3 s after the blip)
Before: Reconnecting to this chat… after a blip After: the chat is unchanged after a blip

2. The host stops answering for ~10 s, then comes back. Before: "Reconnecting to this chat…" from +484 ms until the host was back (+11.1 s). After: nothing for the first ~1.7 s, then "qa-host is reconnecting…" above the composer, gone as the host came back (+11.6 s).

Before (~4 s in) After (just before the host stops) After (~4 s in) After (host back, ~24 s)
Before: Reconnecting to this chat… After: no line before the outage After: qa-host is reconnecting… After: line gone once the host is back

3. The host is disconnected from the status bar's host menu, then reconnected. Before: "Reconnecting to this chat…" from +744 ms until Reconnect was chosen in the status bar (+5.5 s); the "before" frame below was taken ~0.1 s before that line appeared, so the timeline is the evidence for it. After: "qa-host is offline" at once with a Reconnect button in the chat; clicking it at +3.7 s cleared the line.

Before (~0.6 s, just before the old line appeared) After (~0.6 s): offline + Reconnect After (~9.7 s, after Reconnect)
Before: just after Disconnect After: qa-host is offline with Reconnect After: line gone after Reconnect

No new toast, banner or label appeared in the after build. The "Enjoying Orca?" card is the existing first-run prompt and shows in both builds.

A local chat (earlier captures, behaviour unchanged). Captured on a Windows test machine with the same kind of hidden test builds; the drop is one simulated stream error sent through the real app code.

Case Before After
Loaded chat with messages, one drop (before: line on screen +5 to +819 ms) before after
Loaded empty chat, one drop (before: full pane +3 to +827 ms) before after
Chat that never loaded, after a send, history keeps failing before after

On that machine a screenshot took ~3 s, so the "before" images of the first two local cases held the reconnect for 4.5 s to be photographable; the timings are from drops that were not held.

Testing

  • use-native-chat-host-outage.test.tsx (new): no notice while connected; "reconnecting" only after 2 s and cleared at once on recovery; "offline" at once for a disconnected host and held through retries until connected; Reconnect offered for a disconnected or never-reached host but not for one that refuses us; temporary-VM hosts included; the host name follows the user's rename, then the host's name, then its id.

  • NativeChatStructuredSession.host-outage.test.tsx (new): a loaded remote chat whose host stays connected shows no host line and no read line (the "a blip can't trigger it" proof); a reconnecting host is named above the composer only after the 2 s wait; a disconnected host reads offline at once with Reconnect; a host that refused us gets no Reconnect and the composer promises nothing; while the notice shows, a lost-contact read failure adds no second line and a never-loaded chat waits quietly; a refusal the host itself sent is still worded.

  • use-structured-agent-session-read.test.tsx (new tests, real history reader with the network client mocked): after load, a dropped connection leaves the chat as it was; a refusal the host sent is still stored (with a known reason and an unknown one); a failure before the first load is still stored.

  • NativeChatStructuredSession.read-error.test.tsx: a never-loaded chat showing a message with an unexplained failure says "This chat's history couldn't be loaded." once and never mentions reconnecting.

  • Each new behaviour was checked by reverting only the source and confirming the matching tests fail.

  • Also run: the read transport and read-owner tests, all NativeChatStructuredSession* and NativeChatComposer* tests, SshStatusSegment.test.ts; web typecheck, oxlint and format, the changed-code quality gate (design system, React Doctor), and the localization catalog, extraction and coverage checks (new copy in all six languages).

  • Visual proof: a remote-host chat (blip, host stops answering, Disconnect + Reconnect) on a Mac test machine, and three local-chat cases on a Windows test machine (see above).

  • Not verified: a real network drop against a real remote host (the captured local drops are simulated through the real app code; the remote-host outage was a real stop of the test host process).

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • SSH / remote: losing contact with a host is never called a failure; the chat keeps its messages and says the host is reconnecting (or offline once it is disconnected), naming the host. Temporary-VM hosts are covered. Native chat can't run on a plain SSH workspace, so there is no SSH-only path to cover.
  • Mobile: untouched; it has its own host connection state in its header.
  • Cross-platform / performance: renderer-only; one fewer state update per dropped stream on a loaded chat.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

A single transcript stream drop flashed 'Reconnecting to this chat…' above the
composer for about a second. An unnamed read failure now adds nothing: the
transcript and composer stay, and the host's own status shows reachability.
Named or final failures keep their line.
…aming nothing

A loaded chat with no messages yet still flipped to the full-pane "Could not
load conversation" on every stream blip: the read owner stored any read
failure as status 'error', and the pane shows that error whenever there is no
transcript. Once the chat has loaded, a failure that names no reason is now the
transport's own retry and is not stored; a named or final failure, and any
failure before the first load, are reported as before.

The "names a reason" check moves next to the final-refusal check so the owner
and the failure notice share it. The older-page read moves to its own module to
keep the read owner within its line budget.
A chat that never loaded but already shows the user's own message (a launch
prompt or a queued send) said nothing when its first read kept failing with a
failure that names no reason. The loaded case is handled at the read owner, so
any read failure the pane sees beside messages is named, final, or from before
the first load; the status area now says its words in every such case.
The read owner skipped any loaded-chat failure without a named reason, but an
older host sends every refusal without details, so a refusal it really sent
(such as a damaged history) went unshown while the read retried in silence.
Skip only failures the host sent no refusal for, which is lost contact; any
refusal is the host's answer and is shown. The shared 'named' check is no
longer needed and is removed.
…ed as

Comment-only: the read owner treats a failure with no host refusal as lost
contact, which covers hosts too old to attach refusals; the test's reasonless
case is a reason this build doesn't know.
…onnecting-line

# Conflicts:
#	src/renderer/src/components/native-chat/NativeChatStructuredSessionStatus.tsx
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review summary

The problem. In the native chat, a single drop of the connection that streams a chat's messages (a network blip, a remote host restarting, waking from sleep) flashed "Reconnecting to this chat…" above the message box for about a second, until the automatic retry reconnected. A chat that had loaded but had no messages yet flipped its whole pane to "Could not load conversation" for that second instead. Nothing was wrong and there was nothing to do.

What changes for you. A brief drop no longer changes the chat at all: messages and the message box stay as they are, and the app reconnects in the background as before. A host that stays unreachable shows on the host's own status (the status bar's host list, and the workspace card in the sidebar), not as a line in every chat. A chat that never loaded but already shows your own message now says "This chat's history couldn't be loaded." if its history keeps failing, instead of "Reconnecting…". Failures the host actually reports keep their words.

What the review changed. The first version only deleted the grey line. Review found that this left the cause in place: the brief drop was still stored as the chat's error, so an empty loaded chat still flashed the full-pane error. The fix moved to the source. Once a chat has loaded, a failure that carries no answer from the host is treated as lost contact and isn't stored; the connection keeps retrying. Any refusal the host sends is still shown. Review also caught three problems introduced along the way, all fixed:

  • A chat that never loaded but showed your message had lost its only cue.
  • An early version of the rule hid a real refusal from a host when the refusal had no reason this version recognises.
  • The PR description wrongly said the common pattern shows nothing during a drop, wrongly said host reporting was unchanged, and misdescribed older hosts.

Deferred (all minor, listed so nothing is hidden):

  • Experimental temporary-VM workspaces: while such a host is reconnecting, nothing on screen says so, because those hosts aren't in the status bar's host list. The chat line used to be the only cue. Follow-up: show their connection state on the host surface.
  • A chat that never loaded but shows your message can briefly show "This chat's history couldn't be loaded." if its very first read fails once and the retry succeeds. This is unlikely, since a new chat's first read runs after it was created successfully. Follow-up: before the first load, report a failure only after a second read in a row fails.
  • During a long outage, with the chat scrolled to the very top, the "Load earlier messages" row can alternate with "Loading earlier messages…" on each reconnect attempt. Follow-up: offer older history only while connected.
  • A host on Orca 1.4.217 or older doesn't attach refusals to its errors, so its refusal on a loaded chat looks like a dropped connection and isn't shown (before, "Reconnecting…" showed, which didn't describe it either). This goes away as hosts update.
  • If a never-loaded chat's read fails at the same moment a message's delivery is unconfirmed, the read failure's words show instead of the delivery line. Rare.
  • If the user has hidden the status bar or its host entry, a long outage on a remote host has no cue except the sidebar card.

Verified.

  • New tests run the real history reader and fail without the fix.
  • One test fails with the earlier "skip anything without a stated reason" rule.
  • A view test fails with the old status-area rule.
  • The targeted tests pass, along with web typecheck, lint, the changed-code quality gate and the localization checks, after merging the latest main; CI is green.
  • Before/after captures on a separate Windows test machine (hidden test builds, stand-in agent, no real account) for all three cases: a chat with messages, an empty loaded chat, and a never-loaded chat with the user's message. Timed with an in-page change timeline: before, the line or full-pane error was on screen about 0.8 s per drop; after, nothing appeared across three drops each. The drop is a simulated one, sent through the real app code from the test app's main process. Screenshots there took about 3 s, so the "before" images of the first two cases held the reconnect for 4.5 s to be photographable; the timings are from drops that were not held.

Not verified.

  • A real network drop against a real remote host.
  • The temporary-VM path and a host on Orca 1.4.217 or older, which were read from code only.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 4, 2026 05:22
@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b1a524ad-a716-4a6e-8f0f-61a2b6c40c22
📥 Commits

Reviewing files that changed from the base of the PR and between 2d77017 and d017d9a.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7aa5cff6-1463-4d3b-b9f9-14bb67c22f95
📥 Commits

Reviewing files that changed from the base of the PR and between 38159dd and 2d77017.

📒 Files selected for processing (6)
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
🚧 Files skipped from review as they are similar to previous changes (6)
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/fr.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

The native-chat session derives host outage status from runtime connection state and displays offline or reconnecting notices. It offers reconnection when allowed and suppresses older-history availability during an outage. The read owner uses a shared bounded reader for older-history requests and suppresses transport errors without a refusal after the session loads. The SSH status segment now uses shared runtime-host connection helpers.

Priority: ⬇️ Low

Merge Risk: 🔵 Low · up to 2d770

Reconnection or project refresh failures may still produce unhandled errors. These bounded risks need owner awareness or follow-up before merging.

Security Architecture Review

Security architecture risk: 🔵 Low · up to f38af

The change is bounded to conversation loading and recovery. Explicit host refusals remain visible, and history requests retain their existing session identity and interruption protections. No new security issue was identified in the reviewed paths, but end-to-end service security was not established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The reviewed changes do not demonstrate new cross-session or cross-environment reachability: paging retains the existing owner-provided identity and RPC path, and the component change forwards display text rather than adding a command or transport call. This conclusion is limited to the reviewed read and display paths.

Trust Boundaries and Controls

  • observed — The renderer continues to consume controller-owned refusal information for status wording. Explicit host refusals remain distinguishable from connection failures, including refusals without optional reason details; the added tests assert that these refusals remain in error state.

Resilience and Maintainability Implications

  • observed — Concurrent older-page callers continue to share one active promise. Completion cleanup only affects the current page, while generation guards invalidate stale reads after interruption or session-state replacement. A failed page leaves the loaded conversation intact and returns a retryable failure result; these containment behaviors predate the extraction.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.79% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 12 files. (6 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: preventing a transient stream drop from flashing the chat’s reconnecting message.
Description check ✅ Passed The description is comprehensive. It explains the user-facing change, mechanism, rationale, linked follow-up issue, visual proof, testing, and cross-platform considerations. The combined lint, typeche…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 15.79% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 12 files. (6 skipped: 6 unsupported.)

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Loaded chats ignore a stream drop — the read owner now drops a failure with no host refusal once epoch !== null, so a transient drop no longer sets status: 'error' and neither the grey "Reconnecting…" line nor the full-pane error flashes.
  • Refusals and pre-load failures still surface — a host refusal (any reason, including one this build doesn't know) and any failure before the first load are stored and worded exactly as before.
  • Status surface simplified — NativeChatStructuredSessionStatus loses the reconnecting branch and its translate import; NativeChatStructuredSession narrows the status error prop to !readFailure.
  • Older-page paging extracted — the anchor-retry loop moved verbatim into structured-agent-session-older-page-read.ts, parameterized by getState/apply/shouldStop.
  • Locale cleanup — components.native-chat.state.reconnecting removed from all six locales.
  • Tests — new stream-failure cases for the read owner (drop after load, known refusal with/without a reason after load, failure before load) and a rendered-status case beside a never-loaded chat.

I read the full diff and traced the surrounding code paths. epoch is only set by a page/snapshot/reset (replacePage), never by the loading action, so the epoch !== null gate is a sound "has loaded" proxy and the before-first-load path stays intact. Stream refusals ride in error.data.refusal while plain drops do not, so the owner's refusal === undefined check separates the two correctly. The extracted paging file reads the same mutable snapshot state the inline version did. The targeted suites (use-structured-agent-session-read, NativeChatStructuredSession.read-error, structured-agent-session-read-transport, 38 tests) pass locally, and the removed locale key has no remaining references.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@brennanb2025
brennanb2025 marked this pull request as draft October 4, 2026 05:52
A loaded remote chat looked live through a long host outage while sends sat
in the outbox. Derive a host-scoped notice from the host's connection state:
'<host> is reconnecting…' after a 2 s grace, '<host> is offline' at once with
the status bar's Connect as Reconnect, and a composer placeholder saying
sends go out when the host reconnects. A lost read beside the notice adds no
line of its own, and older history waits for the host.
A send while the host's transport is down fails and waits for its own Retry,
so the composer must not promise it will go out on reconnect. A host that
refused us (auth, protocol) still reads offline but offers no Reconnect,
which would be turned away the same way. Name the host with the shared
display-label selector, and keep the notice's live region mounted so it is
announced.
…onnecting-line

# Conflicts:
#	src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx
#	src/renderer/src/i18n/locales/es.json
…onnecting-line

# Conflicts:
#	src/renderer/src/components/native-chat/NativeChatStructuredSessionStatus.tsx
#	src/renderer/src/components/native-chat/structured-agent-session-read-owner.ts
@brennanb2025

brennanb2025 commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Review summary (follow-up)

This updates the earlier summary; the design changed after it.

The problem. In the native chat, a single drop of the connection that streams a chat's messages flashed "Reconnecting to this chat…" above the message box for about a second, or flipped an empty chat to "Could not load conversation". When a remote host really went away, that same unnamed line was the only thing a chat said, with nothing to do about it.

What changes for you.

  • A brief drop no longer changes the chat at all.
  • When the chat's remote host really is unreachable, one line above the message box names it: " is reconnecting…" once it has been reconnecting for 2 seconds (gone the moment it's back), or " is offline" at once, with a Reconnect button. There's no button when the host refuses the connection, because reconnecting can't help.
  • A send during an outage still fails as "Message was not sent." with Retry, the same as today. The notice now explains why.

What the review changed since the last summary.

  • Long outages (P1). The earlier version relied on the status bar and the sidebar card to show a long outage. A user-side check found that too weak: the status bar's button is one unnamed combined indicator, and temporary-VM hosts had no cue at all. The in-chat host notice above replaces that, derived from the connection state Orca already keeps for each host. Nothing new is stored, and temporary-VM hosts are covered.
  • A false promise (P1). A first version told the user in the message box that messages would send when the host reconnected. That isn't true today (the send fails with Retry), so the line was removed.
  • Smaller fixes (P3). No Reconnect button for a host that refuses us. The host name comes from the shared helper the status bar uses, so chats don't re-render on every settings change. The notice is announced to screen readers.
  • Merges. Main was merged twice. Main had restructured the chat component and still passed the old reconnecting line, so this PR's edits were re-applied on top of main's version; two fresh reviews found nothing lost. One test mock was updated for a hook main had renamed.

Deferred, all minor:

  • A chat that never loaded but shows your message can briefly flash "This chat's history couldn't be loaded." if its very first read fails once and the retry succeeds.
  • A host on Orca 1.4.217 or older doesn't attach refusals to its errors, so a refusal from it on a loaded chat looks like a dropped connection and isn't shown. A real outage of such a host still shows the notice.
  • If a never-loaded chat's read fails at the same moment a message's delivery is unconfirmed, the read failure's words replace the delivery line.
  • The Reconnect action lives in the status bar's folder; a shared runtime folder would be a better home.
  • No test pins a permanent read failure during a host outage. The code was checked: the permanent failure still takes the whole pane.
  • Making a send wait for the host instead of failing belongs to the planned change to how failed sends are handled, which is outside this PR.

Verified.

  • QA on a remote-host chat. A separate Mac test machine ran two hidden, isolated setups: a remote Orca host plus a paired desktop app, built from main and from this PR, with a stand-in agent. A non-Claude QA agent (Grok, on 2026-10-04) drove the app.
    • A blip with the host up: before, the line was on screen from +86 to +899 ms; after, nothing.
    • The host stopped for ~10 s: after, nothing for ~1.7 s, then "qa-host is reconnecting…", cleared as the host came back.
    • A status-bar Disconnect: after, "qa-host is offline" at once, and the chat's Reconnect button cleared it.
  • QA on local chats. Three cases on a Windows test machine: a chat with messages, an empty loaded chat, and a never-loaded chat holding a message. Images for all of these are in the description.
  • Tests. New tests fail without each fix. 18 targeted test files (157 tests) pass on the merged head, along with lint, the quality gates and the localization checks.
  • Typecheck. Clean apart from errors main already has.
  • CI. Every check passes except "static analysis and typecheck" (and "verify", which only reports it). Its one error is in src/main/runtime/structured-agent-session-codex-stopped-send-order.test.ts, which is missing resolveLaunchArgs: main's own error, not this PR's. This PR changes no file under src/main/, the failing test and the type it uses are identical to main's, and main's latest commit still lacks that argument in that test.

Not verified.

  • A real network drop against a real remote host. The remote outage was a real stop of the test host process; the local drops were simulated through the real app code.
  • The temporary-VM path, and a host on Orca 1.4.217 or older, were checked in code only.
  • The remote-host captures were taken on 2026-10-04 on commit fde0885, a head from before the last three merges of main, and that run's QA driver was Grok, used before Grok was dropped from the allowed QA drivers. The results are kept as evidence. Later commits only merge main, align the notice's width with main's new chat-width setting, and fix a test.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 6, 2026 22:03

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 168f2e0e-baa0-4add-af12-e4973617c2a0
📥 Commits

Reviewing files that changed from the base of the PR and between f38afbd and 38159dd.

📒 Files selected for processing (17)
  • src/renderer/src/components/native-chat/NativeChatHostOutageNotice.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.host-outage.test.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.read-error.test.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSessionStatus.tsx
  • src/renderer/src/components/native-chat/structured-agent-session-read-owner.ts
  • src/renderer/src/components/native-chat/use-native-chat-host-outage.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-host-outage.ts
  • src/renderer/src/components/status-bar/SshStatusSegment.test.ts
  • src/renderer/src/components/status-bar/SshStatusSegment.tsx
  • src/renderer/src/components/status-bar/runtime-environment-explicit-connect.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
💤 Files with no reviewable changes (1)
  • src/renderer/src/components/native-chat/NativeChatStructuredSessionStatus.tsx
🚧 Files skipped from review as they are similar to previous changes (6)
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/en.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

Comment on lines +19 to +26
const reconnect = (environmentId: string): void => {
setConnecting(true)
void connectRuntimeHostAndReloadProjects(environmentId).finally(() => {
if (mountedRef.current) {
setConnecting(false)
}
})
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Handle a rejected reconnect promise.

connectRuntimeHostAndReloadProjects(...).finally(...) returns a new promise. If the helper rejects (for example, a fetch throws), that rejection is unhandled, because the call has no catch and uses void. The finally handler still resets connecting. The unhandled rejection can still reach the global handler.

Proposed fix
-    void connectRuntimeHostAndReloadProjects(environmentId).finally(() => {
-      if (mountedRef.current) {
-        setConnecting(false)
-      }
-    })
+    void connectRuntimeHostAndReloadProjects(environmentId)
+      .catch(() => {})
+      .finally(() => {
+        if (mountedRef.current) {
+          setConnecting(false)
+        }
+      })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const reconnect = (environmentId: string): void => {
setConnecting(true)
void connectRuntimeHostAndReloadProjects(environmentId).finally(() => {
if (mountedRef.current) {
setConnecting(false)
}
})
}
const reconnect = (environmentId: string): void => {
setConnecting(true)
void connectRuntimeHostAndReloadProjects(environmentId)
.catch(() => {})
.finally(() => {
if (mountedRef.current) {
setConnecting(false)
}
})
}

Comment on lines +51 to +70
/** The status bar's Connect for a paired host; also the chat's Reconnect when its host is offline. */
export async function connectRuntimeHostAndReloadProjects(environmentId: string): Promise<boolean> {
const store = useAppStore.getState()
const reachable = await connectRuntimeHostForNavigation({
environmentId,
refreshStatus: connectRuntimeEnvironmentAndRecordStatus,
fetchRepos: store.fetchRuntimeEnvironmentRepos,
fetchWorktrees: store.fetchWorktrees,
fetchLineage: store.fetchWorktreeLineage
})
if (!reachable) {
toast.error(
translate(
'auto.components.status.bar.SshStatusSegment.runtime_connect_unavailable',
'Remote host is not reachable'
)
)
}
return reachable
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
rg -nP -C4 'connectRuntimeHostAndReloadProjects' src/renderer/src
rg -nP -C3 'unhandledrejection' src/renderer/src | head -40

Repository: stablyai/orca

Length of output: 10442


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\\n' '--- reviewed helper ---'
nl -ba src/renderer/src/components/status-bar/runtime-environment-explicit-connect.ts | sed -n '1,100p'
printf '%s\\n' '--- SshStatusSegment caller ---'
nl -ba src/renderer/src/components/status-bar/SshStatusSegment.tsx | sed -n '90,118p'
printf '%s\\n' '--- NativeChatHostOutageNotice caller ---'
nl -ba src/renderer/src/components/native-chat/NativeChatHostOutageNotice.tsx | sed -n '1,45p'
printf '%s\\n' '--- crash diagnostics handler ---'
nl -ba src/renderer/src/lib/crash-diagnostics.ts | sed -n '1,80p'
printf '%s\\n' '--- merge-base helper / related old flow ---'
git show 6aa12c30ef5ab11d9bbc09fb4ae05e273f4727ce:src/renderer/src/components/status-bar/runtime-environment-explicit-connect.ts 2>&1 | sed -n '1,120p' || true
printf '%s\\n' '--- worktree refresh implementation references ---'
rg -n -F 'refreshRuntimeProjectWorktreesAndLineage' src/renderer/src

Repository: stablyai/orca

Length of output: 12765


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\\n' '--- scheduler implementation ---'
nl -ba src/renderer/src/hooks/runtime-project-refresh-scheduler.ts | sed -n '1,145p'
printf '%s\\n' '--- rejection listener implementation ---'
nl -ba src/renderer/src/lib/crash-diagnostics.ts | sed -n '78,145p'
printf '%s\\n' '--- relevant changed-file diff against merge base ---'
git diff --unified=4 6aa12c30ef5ab11d9bbc09fb4ae05e273f4727ce 38159dde006b37b2dd7e200fe0ad5acb013cfd21 -- src/renderer/src/components/status-bar/runtime-environment-explicit-connect.ts src/renderer/src/components/status-bar/SshStatusSegment.tsx src/renderer/src/components/native-chat/NativeChatHostOutageNotice.tsx

Repository: stablyai/orca

Length of output: 14993


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\\n' '--- status-bar connect callback bindings ---'
rg -n -C 5 -F 'connectRuntimeHost' src/renderer/src/components/status-bar/SshStatusSegment.tsx
printf '%s\\n' '--- chat reconnect button binding ---'
nl -ba src/renderer/src/components/native-chat/NativeChatHostOutageNotice.tsx | sed -n '17,66p'

Repository: stablyai/orca

Length of output: 4471


Handle project-refresh failures in the new chat reconnect flow.

When the host connects but the project refresh fails, connectRuntimeHostAndReloadProjects rejects without showing a refresh error. The new chat reconnect handler’s .finally() clears its loading state but leaves the returned promise rejected. Catch the refresh failure, show a separate error toast, and return true because the host connected.

@brennanb2025
brennanb2025 merged commit cdd0b7a into main Oct 7, 2026
28 of 30 checks passed
brennanb2025 added a commit that referenced this pull request Oct 7, 2026
No conflicts. Main's host outage notice (#24898) merges into the chat view beside this branch's send state; nothing in main's 7 commits sends through the desktop's outbox.
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