Repository navigation
fix(runtime): let connections own host status recovery - #20003
Conversation
Verify runtime status after authenticated connection recovery and publish ordered snapshots to desktop and browser viewers. Consolidate failed-status retries in the connection owner and remove renderer retry/diagnostics merging. Adapt sidebar host-state derivation and regression coverage from Omar Shahine's original fix in #19163. Co-authored-by: Omar Shahine <[email protected]>
There was a problem hiding this comment.
Important
The "not-probed-yet ≠ disconnected" fix is only applied to one of two host-status derivations, so a host still renders "Disconnected" in several prominent surfaces before its first probe answers.
Reviewed changes
- Connection-owned status owner — new
RuntimeHostStatusOwnerstate machine (one shared request, per-reader deadlines/abort, recovery driven byreadytransport transitions, sequence-ordered snapshots) replaces the renderer retry scheduler. - Desktop + browser wiring — per-host owner in main (
runtime-environment-request-connections.ts) and per-primary-session owner inWebRuntimeClient, publishing overruntimeEnvironments:statusChanged. - Renderer snapshot consumption —
applyRuntimeHostStatusSnapshotwith pairingRevision + sequence fencing,readRuntimeHostStatusSnapshots, and the newruntimeHostConnectionStateForEntryderivation. - Removed renderer machinery — the recheck ladder, diagnostics merge/generation, shared-control-support cache, and the probe/retry scheduler in the IPC bridge.
- Registry + sidebar derivation —
execution-host-registrynow reads the snapshot;NoticeHostGlyph/WorktreeCard/SshStatusSegmentuse the sharedruntimeHostConnectionStateForEntry.
The owner state machine itself is solid: I traced request/waiter/deadline/cancel/retry/dispose against its ten unit tests and found the shared-request, abort, and stale-result fencing correct.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe change introduces shared runtime host status snapshots and a Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to Host recovery can leave the UI with stale or incomplete connection details, and the lifecycle test may fail because it does not account for snapshot hydration. Resolve these issues before merging. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 9
🧹 Nitpick comments (2)
src/renderer/src/web/web-runtime-client-export-parity.test.ts (1)
9-13: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMake the options parameter assertion non-self-referential.
Line 11 derives the expected second parameter from
ConstructorParameters<typeof WebClient.WebRuntimeClient>[1], which is the value being asserted. That element of the tuple always matches, so the test no longer pins the options contract. A change toreconnector to thestatusblock (for example removingpublishor changing its signature) will not fail this parity test. Spell the expected shape out to restore the guard.♻️ Proposed fix to pin the options shape
expectTypeOf<ConstructorParameters<typeof WebClient.WebRuntimeClient>>().toEqualTypeOf< [ pairing: WebPairingOffer, - options?: ConstructorParameters<typeof WebClient.WebRuntimeClient>[1] + options?: { + reconnect?: boolean + status?: { + environmentId: string + pairingRevision: number + publish: (snapshot: RuntimeHostStatusSnapshot) => void + verified: (response: RuntimeHostStatusResponse) => void + } + } ] >()Add the supporting import:
+import type { + RuntimeHostStatusSnapshot, + RuntimeHostStatusResponse +} from '../../../shared/runtime-host-status'src/renderer/src/components/settings/use-runtime-environment-catalog.ts (1)
93-93: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winRead the snapshots once instead of once per environment.
Lines 93 and 111 run inside the
Promise.allSettledmap over every visible environment.readRuntimeHostStatusSnapshots()fetches the full snapshot list for all hosts, not one host. With N environments the hook issues N identical IPC round trips that each apply the same list.Move a single read to after
Promise.allSettledresolves.♻️ Proposed refactor
const runtimeStatus = unwrapRuntimeRpcResult<RuntimeStatus>(response) - // Why: feed the live status into the store so sidebar host pickers - // reflect manual refreshes, not just the settings pane. - await useAppStore.getState().readRuntimeHostStatusSnapshots() if (!mountedRef.current) {const remoteControl = extractRuntimeTransportDiagnostics(error) - await useAppStore.getState().readRuntimeHostStatusSnapshots() if (!mountedRef.current) {Then read once after the loop:
}) ) + // Why: feed the live status into the store so sidebar host pickers + // reflect manual refreshes, not just the settings pane. + await useAppStore.getState().readRuntimeHostStatusSnapshots() } catch (error) {Also applies to: 111-111
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: bf9d5676-5737-4312-a3c6-91bfe25caebf
📒 Files selected for processing (64)
config/reliability-gates.jsoncsrc/main/ipc/runtime-environment-connectivity-handlers.tssrc/main/ipc/runtime-environment-federated-read-routing.test.tssrc/main/ipc/runtime-environment-handler-channels.tssrc/main/ipc/runtime-environment-request-connections.tssrc/main/ipc/runtime-environment-shared-control-support.tssrc/main/ipc/runtime-environment-status-connection.test.tssrc/main/ipc/runtime-environment-status-owner.tssrc/main/ipc/runtime-environment-status-recovery.test.tssrc/main/ipc/runtime-environment-support-routing.test.tssrc/main/ipc/runtime-environment-support-routing.tssrc/main/ipc/runtime-environment-transport-routing.tssrc/main/ipc/runtime-environments-call-routing.test.tssrc/main/ipc/runtime-environments-capability-cache.test.tssrc/main/ipc/runtime-environments-ipc-test-harness.tssrc/main/ipc/runtime-environments-pairing.test.tssrc/main/ipc/runtime-environments-status-diagnostics.test.tssrc/main/ipc/runtime-environments-subscription-lifecycle.test.tssrc/main/ipc/runtime-environments-subscription-routing.test.tssrc/main/ipc/runtime-environments-subscription-teardown.test.tssrc/main/ipc/runtime-environments.tssrc/preload/api/runtime-api.tssrc/preload/api/runtime-environments-bridge.tssrc/renderer/src/components/NewWorkspaceComposerCard.tsxsrc/renderer/src/components/settings/RepositoryHostSetupsSection.tsxsrc/renderer/src/components/settings/use-runtime-environment-catalog.tssrc/renderer/src/components/settings/use-runtime-environment-connection-actions.tssrc/renderer/src/components/sidebar/AddRemoteHostDialog.tsxsrc/renderer/src/components/sidebar/HostSectionHeaderMenu.tsxsrc/renderer/src/components/sidebar/NoticeHostGlyph.test.tsxsrc/renderer/src/components/sidebar/NoticeHostGlyph.tsxsrc/renderer/src/components/sidebar/WorktreeCard.ssh-reconnect-prompt.test.tsxsrc/renderer/src/components/sidebar/use-worktree-card-foundation.tssrc/renderer/src/components/status-bar/SshStatusSegment.tsxsrc/renderer/src/hooks/ipc-events/app-lifetime-ipc-bridge.tssrc/renderer/src/hooks/ipc-events/runtime-client-ipc-bridge.tssrc/renderer/src/hooks/ipc-events/runtime-reconnect-host-status.test.tssrc/renderer/src/runtime/runtime-host-connection-state.test.tssrc/renderer/src/runtime/runtime-host-connection-state.tssrc/renderer/src/store/slices/runtime-status-diagnostics-generation.tssrc/renderer/src/store/slices/runtime-status-diagnostics-publish.tssrc/renderer/src/store/slices/runtime-status-diagnostics.test.tssrc/renderer/src/store/slices/runtime-status-recheck.test.tssrc/renderer/src/store/slices/runtime-status-recheck.tssrc/renderer/src/store/slices/runtime-status-refresh.tssrc/renderer/src/store/slices/runtime-status-snapshot.test.tssrc/renderer/src/store/slices/runtime-status-snapshot.tssrc/renderer/src/store/slices/runtime-status-types.tssrc/renderer/src/store/slices/runtime-status.tssrc/renderer/src/web/preload-api/web-runtime-environments-api.tssrc/renderer/src/web/preload-api/web-runtime-session.tssrc/renderer/src/web/web-runtime-client-export-parity.test.tssrc/renderer/src/web/web-runtime-client-timeout-budget.test.tssrc/renderer/src/web/web-runtime-client.tssrc/renderer/src/web/web-runtime-connection-transport.tssrc/renderer/src/web/web-runtime-connection-waiters.tssrc/renderer/src/web/web-runtime-request-registry.tssrc/renderer/src/web/web-runtime-status-owner.test.tssrc/shared/execution-host-registry.tssrc/shared/remote-runtime-shared-control-test-server.tssrc/shared/runtime-host-status-owner.test.tssrc/shared/runtime-host-status-owner.tssrc/shared/runtime-host-status.tstests/e2e/runtime-host-status-recovery.spec.ts
💤 Files with no reviewable changes (6)
- src/renderer/src/store/slices/runtime-status-recheck.test.ts
- src/main/ipc/runtime-environment-support-routing.test.ts
- src/renderer/src/store/slices/runtime-status-diagnostics-generation.ts
- src/renderer/src/store/slices/runtime-status-diagnostics.test.ts
- src/renderer/src/store/slices/runtime-status-recheck.ts
- src/renderer/src/store/slices/runtime-status-diagnostics-publish.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
| return getRuntimeEnvironmentStatusOwner(getUserDataPath(), environment.id).refresh({ | ||
| timeoutMs: args.timeoutMs, | ||
| reconnect: true | ||
| }) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
# Description: Find renderer/preload consumers of runtimeEnvironments:connect and check for remoteControl or Tailscale hint usage.
rg -n -C 6 "runtimeEnvironments:connect|\bconnect\s*\(" --type=ts -g '!**/*.test.ts' src/preload src/renderer | rg -n -C 6 "connect" | head -n 120
rg -n -C 4 "remoteControl" --type=ts -g '!**/*.test.ts' src/renderer src/preload | head -n 80Repository: stablyai/orca
Length of output: 19419
🤖 get_repo_knowledge executed:
get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings
Length of output: 38275
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- changed handler ---'
sed -n '110,175p' src/main/ipc/runtime-environment-connectivity-handlers.ts
printf '%s\n' '--- transport routing ---'
rg -n -C 12 "getRuntimeEnvironmentStatus|withTailscaleHintForResponse|attachRemoteControlDiagnostics" src/main/ipc/runtime-environment-transport-routing.ts
printf '%s\n' '--- bridge and relevant types ---'
sed -n '35,70p' src/preload/api/runtime-environments-bridge.ts
rg -n -C 8 "type RuntimeRpcResponse|interface RuntimeRpcResponse|remoteControl|withTailscaleHintForResponse|attachRemoteControlDiagnostics" src/main src/preload src/renderer/src --glob '*.ts' --glob '*.tsx' | head -n 240
printf '%s\n' '--- explicit connect helper and status consumers ---'
sed -n '1,120p' src/renderer/src/components/status-bar/runtime-environment-explicit-connect.ts
sed -n '1,150p' src/renderer/src/components/status-bar/SshStatusSegment.tsx
sed -n '1,115p' src/renderer/src/components/status-bar/remote-host-connection-status.tsRepository: stablyai/orca
Length of output: 41458
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- all runtime connect call sites ---'
rg -n -C 10 "runtimeEnvironments\.connect|ipcRenderer\.invoke\(['\"]runtimeEnvironments:connect|runtimeEnvironments:connect" src --glob '*.ts' --glob '*.tsx'
printf '%s\n' '--- hint and diagnostics definitions/callers ---'
rg -n -C 14 "function withTailscaleHintForResponse|const withTailscaleHintForResponse|function attachRemoteControlDiagnostics|const attachRemoteControlDiagnostics|withTailscaleHintForResponse\(|attachRemoteControlDiagnostics\(" src/main src --glob '*.ts' --glob '*.tsx'Repository: stablyai/orca
Length of output: 38612
🏁 Script executed:
#!/bin/bash
set -eu
sed -n '120,165p' src/main/ipc/runtime-environment-connectivity-handlers.ts
sed -n '1,220p' src/main/ipc/runtime-environment-transport-routing.ts
sed -n '1,90p' src/renderer/src/components/status-bar/runtime-environment-explicit-connect.ts
rg -n -C 8 "runtimeEnvironments\.connect|remoteControl|withTailscaleHintForResponse|attachRemoteControlDiagnostics" src/main src/preload src/renderer/src --glob '*.ts' --glob '*.tsx' | head -n 260Repository: stablyai/orca
Length of output: 36382
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- status owner refresh contract ---'
rg -n -C 16 "class .*Status|refresh\s*\(|getRuntimeEnvironmentStatusOwner" src/main/ipc/runtime-environment-request-connections.ts
printf '%s\n' '--- connect-related error handling ---'
rg -n -C 12 "unwrapRuntimeRpcResult|extractRuntimeTransportDiagnostics|runtimeEnvironments\.connect|Remote host is not reachable|withRemoteRuntimeTailscaleHint" src/renderer/src src/main --glob '*.ts' --glob '*.tsx' | head -n 260Repository: stablyai/orca
Length of output: 25871
🏁 Script executed:
#!/bin/bash
set -eu
rg -n -C 12 "createRuntimeEnvironmentStatusOwner|export class RuntimeHostStatusOwner|class RuntimeHostStatusOwner|refresh\(\):" src/main src/shared --glob '*.ts'Repository: stablyai/orca
Length of output: 23435
🏁 Script executed:
#!/bin/bash
set -eu
sed -n '1,260p' src/shared/runtime-host-status-owner.tsRepository: stablyai/orca
Length of output: 7650
Preserve response diagnostics on runtimeEnvironments:connect. RuntimeHostStatusOwner.refresh resolves transport failures as responses. The connect handler returns that response before applying withTailscaleHintForResponse and attachRemoteControlDiagnostics. The renderer stores the returned status, and SshStatusSegment reads status.remoteControl, so connect can lose the Tailscale hint and remote-control diagnostics. Apply the same decorators to the connect path.
| } catch (error) { | ||
| console.error('Failed to read runtime host status:', error) | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Report snapshot read failures to callers.
readRuntimeHostStatusSnapshots logs the error and resolves normally. Callers then continue as if renderer state was synchronized. A failed read can leave a stale host status after a completed probe.
Return a result that identifies failure, or rethrow the error so callers can handle the synchronization failure.
There was a problem hiding this comment.
Important
The new commit introduces no new issues, but the two findings from the prior review remain unaddressed, so this stays unapproved.
Reviewed changes
- Dropped the
onCapable/onAbsentverdict callbacks —applyRuntimeEnvironmentCapabilityVerdictnow returns only its acceptance boolean; the single production caller (runtime-environment-status-owner.ts) already gated itsestablish/pauseon that return value, so the callbacks were dead API. - Rendered terminally-blocked hosts honestly —
runtimeHostConnectionStateForEntrynow mapsverification: 'blocked'todisconnectedinstead ofreconnecting, so a host that answered with an unauthorized/protocol error no longer implies automatic recovery. Backed by a new failing-capable test. - Removed the
publishUnreachablerefresh option — no production caller passed it and the snapshot path already bypassed it; the slice signature and its test matrix were simplified accordingly.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Important
This commit is clean, but the two findings from the prior review remain unaddressed, so this stays unapproved.
Reviewed changes
- Preserved timeout guidance —
RuntimeHostStatusOwner.refreshnow distinguishes its timeout message: a ready transport reportsStatus request timed out.(socket up, runtime slow) while an unready transport reportsTimed out waiting for the remote Orca runtime.(unreachable). Covered by a newit.eachtest over both transports. - Updated IPC test fixtures —
useIpcEvents-lifecycle.test.tsnow expectsruntimeEnvironments.onStatusChangedin place ofonSharedControlDiagnostics;ipc-events-test-harness.tsstubsgetStatusSnapshots; the Tailscale-hint test mockselectronand resets shared-control support between cases.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (5)
tests/e2e/runtime-host-status-recovery.spec.ts (2)
99-99: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winMove resource setup inside the cleanup boundary. If
headless.client.call,interruptibleHost, orlaunchPairedElectronClientrejects beforetry, thefinallyblock does not run. The headless host or proxy can remain active and affect later tests.
129-131: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAssert the browser viewer is disconnected before reconnection.
The offline assertion currently checks only
client.page. If the browser viewer keepstransport: 'ready', its latertransport: 'ready'assertion still passes after reconnection. PollstatusEvidence(browser!.page)fortransport: 'disconnected'before callingproxy.setOnline(true).src/renderer/src/store/slices/runtime-status.ts (1)
46-56: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winPropagate snapshot-read failures to callers.
readRuntimeHostStatusSnapshotscatches IPC failures and resolves successfully.AddRemoteHostDialogthen reports success and closes whileruntimeStatusByEnvironmentIdcan still contain stale entries. Propagate the failure and handle it before callers report synchronization success; no lateronStatusChangedevent is guaranteed.src/renderer/src/store/slices/runtime-status-refresh.ts (1)
19-19: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winKeep snapshot synchronization failures separate from status-probe failures.
refreshRuntimeEnvironmentStatuswrapsgetStatusandgetStatusSnapshotsin onetry. IfgetStatussucceeds but snapshot retrieval or application throws, the catch publishesstatus: nulland returnsfalse. When the entry has no prior snapshot,setRuntimeEnvironmentStatusrecords that null and shows the disconnected-host toast, so a snapshot failure can appear as a host outage. Handle snapshot errors separately and preserve or report the successful probe result.src/main/ipc/runtime-environment-connectivity-handlers.ts (1)
145-148: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winApply the status-response decorators to
runtimeEnvironments:connect.The status route wraps
refresh()withwithTailscaleHintForResponseandattachRemoteControlDiagnostics, butconnectreturnsrefresh()directly. The status-bar caller stores the unwrapped result asRuntimeStatus, so a compatible reconnect can omitremoteControldiagnostics and the standard Tailscale guidance. Return the response through both decorators.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: d7c98632-2950-4d11-8267-22beb6678c66
📒 Files selected for processing (9)
src/main/ipc/runtime-environment-capability-evidence.test.tssrc/main/ipc/runtime-environment-capability-evidence.tssrc/main/ipc/runtime-environment-request-connections.test.tssrc/renderer/src/runtime/runtime-host-connection-state.test.tssrc/renderer/src/runtime/runtime-host-connection-state.tssrc/renderer/src/store/slices/runtime-status-restored-browser-host-attach.test.tssrc/renderer/src/store/slices/runtime-status-types.tssrc/renderer/src/store/slices/runtime-status.test.tssrc/renderer/src/store/slices/runtime-status.ts
💤 Files with no reviewable changes (1)
- src/main/ipc/runtime-environment-capability-evidence.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
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: 69a378e7-5710-4434-a45e-8b9b34b43911
📒 Files selected for processing (6)
src/main/ipc/runtime-environment-shared-control-support.tssrc/main/ipc/runtime-environment-transport-routing-tailscale-hint.test.tssrc/renderer/src/hooks/ipc-events-test-harness.tssrc/renderer/src/hooks/useIpcEvents-lifecycle.test.tssrc/shared/runtime-host-status-owner.test.tssrc/shared/runtime-host-status-owner.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/shared/runtime-host-status-owner.ts
- src/main/ipc/runtime-environment-shared-control-support.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.
| 'ui.onMobileMarkdownRequest', | ||
| 'automations.onChanged', | ||
| 'runtimeEnvironments.onSharedControlDiagnostics', | ||
| 'runtimeEnvironments.onStatusChanged', |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Add runtimeEnvironments.getStatusSnapshots to the expected sequence.
installAppLifetimeIpcEvents calls getStatusSnapshots() immediately after onStatusChanged registration. The proxy records this call in registrationOrder. The expected sequence omits it, so the registration-order assertion will fail.
Proposed fix
'automations.onChanged',
'runtimeEnvironments.onStatusChanged',
+ 'runtimeEnvironments.getStatusSnapshots',
'repos.onChanged',📝 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.
| 'runtimeEnvironments.onStatusChanged', | |
| 'runtimeEnvironments.onStatusChanged', | |
| 'runtimeEnvironments.getStatusSnapshots', |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Restored status-response decorators on
connect— theconnecthandler now routes throughgetRuntimeEnvironmentStatus(..., { reconnect: true }), which re-applieswithTailscaleHintForResponseandattachRemoteControlDiagnosticsthat were dropped when it called the owner'srefreshdirectly. - Aligned registry-fed surfaces with the renderer derivation —
execution-host-registrycontrolHealthmaps absent/checking/unknown-transport snapshots toconnecting(no longerdisconnected), and retains last-known status metadata viametadata = status ?? snapshot?.status, closing the "not-probed-yet ≠ disconnected" gap. - Kept snapshot-read failures from faking a host outage —
refreshRuntimeEnvironmentStatusnow logs and swallows a failed snapshot IPC read instead of publishingstatus: nulland returningfalse. - Tightened the test suite — per-test
resetRuntimeEnvironmentStatusOwners()teardown across the IPC suite, explicitvi.waitFor/.polltimeouts,it.eachdiagnostics coverage, and the e2e spec scopes resource setup totry/finallyand asserts the browser viewer goes offline before reconnection.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Added a workspace-host appearance assertion helper —
expectWorkspaceHostAppearancepins the worktree card's dimmedopacity(0.6),ServerOff/Serverglyph withtext-destructive/text-muted-foreground, and the "disconnected" vs "Project on …" hover tooltip. The assertions matchworktree-card-surface.tsx(opacity-60) andworktree-card-header.tsx/NoticeHostGlyph.tsx. - Extended the e2e journey — after the manual-disconnect block it now drives an explicit
runtimeEnvironments.connectand re-asserts restored appearance for both the desktop and browser viewers, plus recovery/restored screenshots.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Tightened the Cmd+J palette host-badge gate —
hasActiveRemoteHostnow requires a verifiedavailablenon-local host (health === 'available') instead of merely!== 'disconnected', so a connecting/blocked/error host no longer implies a live remote to disambiguate from. A newit.eachtest pins the gate for every non-available health while the explicit filter-label path (alwaysShowHostLabel) still returns the badge. - Corrected the sidebar host-options fixture — an unprobed runtime host now reads
health: 'connecting'in the test, matching the registry's absent-entry mapping added earlier, replacing the staledisconnectedexpectation.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Retained disconnected host snapshots for late renderers — the
disconnecthandler now recreates the status owner afterinvalidateTransporttears the old one down, and the owner's manual-disconnect guard immediately retires it, so a renderer that opens after the disconnect and only readsruntimeEnvironments:getStatusSnapshotssees aretiredsnapshot instead of nothing. - Pinned the behavior in the pairing suite — the "disconnects a saved runtime without removing it" test now asserts the retained
{ retired: true, transport: 'disconnected' }snapshot, and that a subsequentconnectrestores averified, non-retired snapshot.
Traced the mechanism end to end: invalidateRuntimeEnvironmentTransport synchronously runs closeRemoteRuntimeRequestConnection(environment.id) (dispose + delete) before the bare getRuntimeEnvironmentStatusOwner(...) call, so the getter always recreates a fresh owner whose isRuntimeEnvironmentManuallyDisconnected guard marks it retired. Correct as written.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
#20003 moved failed-status retries into the connection's status owner and split the vocabulary this PR's guard was written against: the store entry's `status` now means "verified on the current socket", while the owner's `snapshot.status` keeps the last verdict across an unverifiable probe. The guard itself is unchanged and still correct — it is the only writer for a `status.get` that threw, where there is no snapshot and no retry ladder — but its comment described a recheck ladder that no longer exists. The e2e flap arm's `sawNullStatus` gate does not survive that split. Under #20003 a dropped socket publishes `verification: 'unavailable'` and the renderer derives `entry.status = null` from it by design, and that null is what drives the session-tabs mirror's own rebuild once the socket returns. Asserting it stays non-null would contradict the recovery the same arm measures, so it is logged rather than gated. The connection-generation and pane-mounted assertions, which are the actual #19647 contract, are unchanged.
#20003 moved failed-status retries into the connection's status owner and split the vocabulary this PR's guard was written against: the store entry's `status` now means "verified on the current socket", while the owner's `snapshot.status` keeps the last verdict across an unverifiable probe. The guard itself is unchanged and still correct — it is the only writer for a `status.get` that threw, where there is no snapshot and no retry ladder — but its comment described a recheck ladder that no longer exists. The e2e flap arm's `sawNullStatus` gate does not survive that split. Under #20003 a dropped socket publishes `verification: 'unavailable'` and the renderer derives `entry.status = null` from it by design, and that null is what drives the session-tabs mirror's own rebuild once the socket returns. Asserting it stays non-null would contradict the recovery the same arm measures, so it is logged rather than gated. The connection-generation and pane-mounted assertions, which are the actual #19647 contract, are unchanged.
…s it (#20762) * fix(e2e): seed the runtime host with a snapshot the host cannot overwrite Since #20003 the published snapshot owns runtime-host health, so a bare status seed no longer survives: main's status owner publishes `checking` for this unreachable synthetic host as soon as any runtime RPC touches it, the host reads `connecting`, and the Add Project dialog falls back to Local — so the host-scoped copy the test asserts never renders. Seed a snapshot pinned at the top sequence instead. applyRuntimeHostStatusSnapshot drops any later publication whose sequence is not higher, and setRuntimeEnvironmentStatus no-ops a snapshot-less write once a snapshot exists, so the bare seed could not have worked either way. Ablated: passes with the pinned snapshot, fails without it. * fix(e2e): fabricate paired-web host health through the snapshot that owns it Companion to the onboarding seed fix. Since #20003 the published snapshot owns runtime-host health, so writing `status: null` alone leaves the paired-web client's verified/ready snapshot in place: addRuntimeHost reads snapshot.transport 'ready' before it ever consults status, and the host still renders Connected while the test waits for Disconnected. Rewrite the snapshot coherently instead, pinned at the top sequence so the live status owner cannot restore the host mid-assertion. The disconnected leg uses transport 'unknown' rather than 'disconnected', because a dropped transport is unverifiable and renders as Connecting; only a never-reached host renders Disconnected. remoteControl is nulled because runtimeControlHealth answers 'available' on a ready control socket even with a null status. Ablated with ORCA_E2E_WEB_CLIENT=1 (the whole file is test.skip'd without it, so a run without that flag reports a passing skip): fails without the change, passes with it. * test(e2e): preserve paired runtime status metadata
…s it (stablyai#20762) * fix(e2e): seed the runtime host with a snapshot the host cannot overwrite Since stablyai#20003 the published snapshot owns runtime-host health, so a bare status seed no longer survives: main's status owner publishes `checking` for this unreachable synthetic host as soon as any runtime RPC touches it, the host reads `connecting`, and the Add Project dialog falls back to Local — so the host-scoped copy the test asserts never renders. Seed a snapshot pinned at the top sequence instead. applyRuntimeHostStatusSnapshot drops any later publication whose sequence is not higher, and setRuntimeEnvironmentStatus no-ops a snapshot-less write once a snapshot exists, so the bare seed could not have worked either way. Ablated: passes with the pinned snapshot, fails without it. * fix(e2e): fabricate paired-web host health through the snapshot that owns it Companion to the onboarding seed fix. Since stablyai#20003 the published snapshot owns runtime-host health, so writing `status: null` alone leaves the paired-web client's verified/ready snapshot in place: addRuntimeHost reads snapshot.transport 'ready' before it ever consults status, and the host still renders Connected while the test waits for Disconnected. Rewrite the snapshot coherently instead, pinned at the top sequence so the live status owner cannot restore the host mid-assertion. The disconnected leg uses transport 'unknown' rather than 'disconnected', because a dropped transport is unverifiable and renders as Connecting; only a never-reached host renders Disconnected. remoteControl is nulled because runtimeControlHealth answers 'available' on a ready control socket even with a null status. Ablated with ORCA_E2E_WEB_CLIENT=1 (the whole file is test.skip'd without it, so a run without that flag reports a passing skip): fails without the change, passes with it. * test(e2e): preserve paired runtime status metadata

ELI5
A remote host can stay marked unreachable after its first status check fails. The connection now owns recovery: when it becomes authenticated and ready, it checks the host again and updates every viewer's snapshot.
What Changed
Why
A renderer-owned snapshot can become stale independently of the connection. Giving verification to the connection makes authenticated recovery the normal refresh trigger and gives viewers one ordered source of status.
Linked Issue
Addresses the recovery problem reported in #19163. The sidebar derivation and related coverage adapt Omar Shahine's original work; commit
354922fec8acredits him withCo-authored-by.Visual Proof
After automatic recovery, the desktop shows both remote workspace groups and two connected hosts:
Browser after reconnecting to the headless host:
No baseline screenshot was captured. The first-failed-status regression failed on main
58ff95becb40with one request instead of the expected automatic second request, and passes here.Testing
pnpm tc, changed-code quality including type-aware checks and React Doctor, reliability manifest validation, andgit diff --checkpassed.The app journeys interrupt real TCP connections, prove automatic recovery of a non-active host after its first failed check, keep the direct viewer healthy, and verify manual disconnect. The new experimental reliability gate records commands and coverage limits.
Live checks ran on macOS over loopback. Windows/Linux, SSH, mixed-version pairs, literal cold-start profile relaunch, and full host-process restart were not exercised. Runtime identity replacement is covered by the real authenticated socket test. Full repository lint/test coverage remains for CI.
Review
Self-reviewed ownership, cancellation, stale publication, passive intent, and authentication-stop behavior. Original PR remains open.
Agent skill upstream boundary