Repository navigation
fix(web): say the host is unreachable and reload when it answers, instead of "Session restore failed" - #29460
Conversation
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
4a6b3c22-2168-41cd-a37b-cec656516399
📒 Files selected for processing: 9
src/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/fr.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/startup/startup-degraded-recovery.test.tssrc/renderer/src/startup/startup-degraded-recovery.tssrc/renderer/src/startup/startup-web-host-unreachable.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
| if (isCancelled()) { | ||
| return | ||
| } | ||
| if (hostUnreachable) { |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Keep partial-reconnect failures on the degraded path.
If reconnectStarted is true and the transport drops during terminal reconnect, this branch announces an unreachable host and arms an automatic reload. The partial-reconnect state is not a clean, unapplied hydration failure. Exclude reconnectStarted from the host-unreachable branch before announcing it. The PR objective requires partial-reconnect failures to retain the existing degraded behavior.
ELI5
The browser version of Orca gets everything from the Orca host it is paired with. If that host wasn't answering when the page loaded (asleep, stopped, or on a changed port), Orca said "Session restore failed" and stopped saving changes until a restart. That sounded like something broke, but nothing had: the host just wasn't answering yet. Now Orca says "Couldn't reach your Orca host. Nothing was lost." and reloads by itself as soon as the host answers. There is also a "Retry now" button.
What Changed
Before: on the paired web client, the "local" catalog is the host. When the host was unreachable at boot,
repo.listfailed with "Could not connect to the remote Orca runtime".awaitLocalRepoCatalogSettlementthen threw, andrecoverFromDegradedStartupshowed the sticky "Session restore failed / Changes won't be saved until restart" toast. The web transport kept reconnecting in the background, but nothing used that: the page stayed in no-save mode until the user reloaded by hand.After:
recoverFromDegradedStartupfirst asksisWebHostUnreachableAtStartup(error)(newstartup-web-host-unreachable.ts). This is true only when all of these hold:isRecoverableRemoteRuntimeConnectionErrorplus two web-transport messages it doesn't list: the connection waiter's timeout and "connection interrupted" for a socket that dropped mid-request;ready, according to the status owner's snapshot.In that case it shows an honest offline toast with "Retry now". It also subscribes to
runtimeEnvironments.onStatusChangedand reloads once, on the first snapshot whose transport isready. It re-reads the snapshot once after subscribing, in case the reconnect landed in between. The listener belongs to its startup pass: a pass that was cancelled during the check announces nothing, and aborting the pass removes the listener, so a torn-down StrictMode pass can't reload the page later.Everything else is unchanged: the shell still mounts with the ready flags forced, and saving stays off until the reload. On desktop, and for real hydration faults (schema, persistence, or a failure on a connected socket), the "Session restore failed" toast and its behavior are exactly as before.
Why
The no-save lock (#1158) protects against writing half-hydrated state. That protection still matters here: the host's projects never loaded, so a session save now would prune the user's tabs. So this PR keeps the lock and changes two things: what the user is told, and how they get out. A reload on the first ready transport gives a clean hydration with no new hydration path to get wrong.
Alternatives considered:
readyis a genuine fault, and reloading on the next ready snapshot could loop. So the check also requires a transport that isn't ready.Loss of contact is reported as just that: the copy says the host didn't answer and that nothing was lost. It never implies the host's work stopped.
Linked Issue
Fixes #26620
Visual Proof
N/A in this PR. The visible change is the toast text, plus an automatic reload when the host comes back. The tests pin both. Copy: "Couldn't reach your Orca host / Nothing was lost. Orca will reload when the host answers, and won't save changes until then. [Retry now]". Strings are added in all six locales.
Testing
pnpm test src/renderer/src/startup/startup-degraded-recovery.test.ts:connecting, and reloads exactly once onready. Fails onmain, which shows "Session restore failed".ready. Keeps "Session restore failed" and doesn't arm the reload.ready, and a pass cancelled during the check neither announces nor subscribes.pnpm tc:web,pnpm run check:code-quality:changed,pnpm run verify:localization-catalogandverify:localization-extractionpass.Notes
isWebClient()is false there).Checklist
N/Afor visual proof with reason