Repository navigation
fix: resolve local worktrees to the connected server on web clients (#9047) - #9147
PannenetsF wants to merge 1 commit into
Conversation
|
Important Review skippedWe couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting You can disable this status message by setting the Use the checkbox below for a quick retry:
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: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 1272406 and 1122dcb20c6eda744a09af84ff0e4616ebd02d58. 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughFile explorer operation-owner resolution now accepts web-client context. Web clients map local worktrees to a connected runtime environment when available, while desktop clients and disconnected web clients retain local ownership. Quick-open file-list loading passes the detected client location. Web-client detection handles missing location data. Tests cover desktop, connected-runtime, and fallback routing. Merge Risk: ⚪ Minimal · up to This change routes local worktrees in web clients to the connected server while preserving desktop behavior, with regression tests covering the new resolution paths; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
|
Taking a look! |
|
Hi @brennanb2025, thanks for taking a look at this one earlier! Whenever you have a moment, is there anything you'd like me to adjust, or any context that would help move it along? Happy to rebase onto latest |
e26216a to
5c4f4f7
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
5c4f4f7 to
8408760
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
455b436 to
1122dcb
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
@brennanb2025 Rebased onto the latest main and resolved all conflicts. Verified locally (typecheck + targeted tests pass); CI is pending maintainer approval to run. Ready for review whenever you have a moment — thanks! |
On a browser web client connected to a headless `orca serve`, worktrees stored
as host:local are unusable: getFileExplorerOperationOwnerFromState resolved them
to { kind: 'local' }, and getFileExplorerOperationRoute then routed to
{ activeRuntimeEnvironmentId: null } — i.e. the browser's local host, which has
no filesystem or PTY. The result is "Couldn't determine which host owns this
workspace" in the file explorer and "Local PTYs are unavailable" / "Couldn't
launch <agent> — the terminal did not start" for terminals/agents, for every
pre-existing or UI-added local-host project.
A web client has no local host; host:local means "the server I'm connected to".
Resolve a local-owned worktree to the connected server's runtime environment
(the client's activeRuntimeEnvironmentId, which is seeded from the connected
environment id at web startup) when running as a web client. This is
per-connection, so different browsers/devices each resolve to their own
connected server — no shared/global pin. Desktop behavior is unchanged, and it
falls back to local when no connected runtime env is known.
Also harden isWebClientLocation() to not throw when window exists without a
location (guards window.location?.pathname).
Fixes stablyai#9047
Co-Authored-By: Claude Fable 5 <[email protected]>
1122dcb to
ca987d2
Compare
Summary
On a browser web client connected to a headless
orca serve, worktrees stored ashost:localare unusable:getFileExplorerOperationOwnerFromStateresolved them to{ kind: 'local' }.getFileExplorerOperationRoute({kind:'local'})then routed to{ activeRuntimeEnvironmentId: null }— the browser's local host, which in a web client has no filesystem or PTY.Symptoms for every pre-existing or UI-added local-host project: the file explorer shows "Couldn't determine which host owns this workspace", and terminals/agents show "Local PTYs are unavailable in the web client" / "Couldn't launch — the terminal did not start."
A web client has no local host —
host:localmeans "the server I'm connected to". This change resolves a local-owned worktree to the connected server's runtime environment (the client'sactiveRuntimeEnvironmentId, seeded from the connected environment id at web startup) when running as a web client. It is per-connection, so different browsers/devices each resolve to their own connected server (no shared/global pin). Desktop behavior is unchanged, and it falls back tolocalwhen no connected runtime env is known.Also hardens
isWebClientLocation()so it doesn't throw whenwindowexists without alocation(guardswindow.location?.pathname).Fixes #9047.
Screenshots
No visual change to component markup. Behavior-only: in a web client, opening a local-host worktree now loads files and starts terminals/agents against the connected server instead of erroring.
Testing
pnpm typecheck— pass for the web project (tsc --noEmit -p config/tsconfig.tc.web.json); no errors in changed files.pnpm lint— ranoxlinton the changed files (pass); did not run the fulllintscript (localization/ratchet gates unrelated to this change).pnpm test— ran the affected suites (see below, all pass); could not run the full suite locally because the nativenode-ptypostinstall build fails in my environment (unrelated to this change).pnpm build— not run locally (blocked by the same native-module build issue).Ran and passed:
file-explorer-operation-owner.test.ts(3 cases): desktop keepslocal; web client routeslocal→ connected runtime env; web client with no connected env falls back tolocal.file-explorer-delete-owner-provenance.test.ts,remote-host-file-delete-repro.test.ts,worktree-activation.test.ts— 42 passed total.AI Review Report
Reviewed with an AI coding agent, focused on the destructive-action path:
{kind:'runtime'}), not just the route.useFileDeletionkeys its OS-Trash-vs-permanent-remote logic onoperationOwner.kind; because a web-client local worktree now consistently presents asruntime, deletes correctly take the remote path (confirm dialog + no bogus local-trash on a remote path) instead of the inconsistent "local kind, runtime route" state a route-only patch would create.getFileExplorerOperationOwner/...FromState+getFileExplorerOperationRoute(file explorer tree, directory listing, quick-open, deletion). The store-backed entry points injectisWebClientLocation(); the pure...FromStatetakes an explicitisWebClientflag defaulting tofalse, so non-web callers and existing tests are unchanged.activeRuntimeEnvironmentId, so concurrent browsers/devices each resolve to their own connected server; nothing is pinned server-side.isWebClientLocation()hardening only adds optional chaining.Security Audit
unresolvedwhen neither SSH nor a connected runtime env is known.activeRuntimeEnvironmentIdandisWebClientLocation()signals.Notes
orca servereached from a browser; this is the same class as the file-explorer/terminal host-unresolved reports.ELI5
When you use Orca in a browser connected to a remote server, local worktrees were treated as if they lived on the browser’s machine—which has no files. They now correctly open on the connected server so the file explorer and terminals work.