Skip to content

feat(workspace): save a link per workspace and open it from the card, status bar and a shortcut - #24856

Open
lucacri wants to merge 16 commits into
stablyai:mainfrom
lucacri:lucacri/port-url-override
Open

lucacri wants to merge 16 commits into
stablyai:mainfrom
lucacri:lucacri/port-url-override

Conversation

@lucacri

@lucacri lucacri commented Oct 2, 2026

Copy link
Copy Markdown

ELI5

Each workspace can now remember one web link — for example the address of the dev site it serves (https://app.test/admin). Orca shows that link on the workspace card and in the status bar, and a shortcut opens it in Orca's built-in browser.

What Changed

Before: the only way to reach a workspace's dev site from Orca was a detected listening port, which opens localhost:PORT. Sites served through a local proxy or a custom domain (https://app.test, with a path) had no place to live, and nothing showed when no port was detected.

After:

  • Saved link per workspace. A new optional workspaceUrl on the worktree metadata, set three ways:
    • the workspace's Update dialog has a new Link field (empty clears it; anything that is not an http(s) URL blocks Save);
    • orca worktree set --url <link> (--url null clears it);
    • any client through the existing worktree.set RPC (new optional, validated workspaceUrl param).
  • Where it shows. A link row (open / copy) at the top of the workspace card's ports section and of the status-bar ports popover. Both appear even when no port is live.
  • Shortcut. New rebindable action Open Workspace Link (⇧⌘U on macOS, Alt+Shift+U on Linux/Windows) opens the active workspace's link in Orca's browser. It does nothing, and lets the key through, when no link is set.

Mechanism: the link is stored like the other metadata fields (WorktreeMeta → mergeWorktree → Worktree). Opening reuses the port-open path: openWorkspacePortInBrowser now delegates to a new openUrlInWorkspaceBrowser, so the link follows the same Orca-browser / system-browser setting, modifier escape hatch, and remote-runtime browser routing as ports. The worktree set CLI handler and spec moved into their own files because specs/core.ts was already at the 300-line limit.

Why

A port is the wrong key for this: the same server is often reached through a proxy on 443/80, a custom hostname, or a specific path. Storing one explicit link per workspace is the smallest model that covers those, and it needs no port detection to be useful. I first tried a per-port URL map, but it hid the link whenever the server was down or moved ports, which is exactly when you want to open it.

Linked Issue

No linked issue.

Visual Proof

Pending — screenshots of the Update dialog field, the card row, and the status-bar row to follow.

Testing

  • pnpm typecheck and pnpm lint pass; the changed-code quality gate reports no findings in the changed files.

  • New tests: CLI --url set / clear / reject (index-worktree-set.test.ts), the Update dialog seeds and saves only an edited link and blocks a non-http link (WorktreeMetaDialog.test.tsx, WorktreeWorkspaceUrlField.test.ts), and the shortcut handler opens the link or leaves the chord alone (app-command-handlers-workspace-open-url.test.ts).

  • Tests under src/cli, src/main/{ipc,ports,runtime/rpc}, src/renderer/src/{lib,app-shell}, the sidebar, status bar and src/shared pass, except agent-launch-replay.test.ts, which fails identically without this change on my machine.

  • Not yet tested by hand in the running app.

  • I manually tested these changes locally

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

AI Disclosure

Written with Claude Code (Claude Opus 5.5), reviewed by me.

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: direct-SSH workspaces have no runtime target; their link opens in the local browser instead of failing. Environment-hosted workspaces open it through the remote browser, like ports.
  • Mixed versions: workspaceUrl is a new optional RPC field. An older host drops it silently (zod strips unknown keys), so setting a link against an old host is a no-op rather than an error.
  • Cross-platform: the shortcut has per-platform defaults; Ctrl+Shift+U is avoided on Linux because input methods use it for Unicode entry.

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)

@lucacri
lucacri requested a review from brennanb2025 as a code owner October 2, 2026 17:57

@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.

Important

One must-address gap: the new Link field is editable on folder workspaces, but saving there is silently discarded.

Reviewed changes

  • Saved link on the workspace model: a new optional workspaceUrl on WorktreeMeta/Worktree, persisted through worktree.set with '' meaning cleared, validated as absolute http(s) on the CLI (--url), in the zod contract, and in the dialog.
  • Card and status-bar row: a WorkspaceUrlRow (open / copy) shown above live ports on the sidebar card, activity hover card, and status-bar ports popover, rendered even when no port is live.
  • Open shortcut: a new rebindable workspace.openUrl action opens the active workspace link in Orca's browser; openWorkspacePortInBrowser now delegates to a shared openUrlInWorkspaceBrowser, and a null runtime target falls back to local for direct-SSH workspaces.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@@ -381,6 +387,7 @@ const WorktreeMetaDialog = React.memo(function WorktreeMetaDialog() {
provider={reviewProvider}
value={reviewInput}
/>
<WorktreeWorkspaceUrlField draft={workspaceUrl} onEnter={handleSave} />

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.

The Link field is editable for folder workspaces, but a save there is silently discarded. getFolderWorkspaceMetaUpdates whitelists a fixed key set without workspaceUrl, and neither FolderWorkspace nor folderWorkspaceToWorktree carries the field, so the dialog seeds empty, canSave passes, and updateWorktreeMeta returns { ok: true } without writing. Either support the link end-to-end for folder workspaces or render the field read-only/hidden for isFolderWorkspace, matching the Issue field.

Technical details
# Folder workspaces silently drop a saved link

## Affected sites
- `src/renderer/src/store/slices/worktrees/listing/detected-worktree-meta.ts:126` — `getFolderWorkspaceMetaUpdates` maps a fixed key set and omits `workspaceUrl`; with no other change, line 52 returns `{ ok: true }` early.
- `src/shared/folder-workspace-worktree.ts:29` — `folderWorkspaceToWorktree` never projects `workspaceUrl`, so the dialog always seeds empty and the card/status bar never show one.
- `src/shared/folder-workspace-types.ts:17` — `FolderWorkspace` has no `workspaceUrl`.
- `src/renderer/src/components/sidebar/WorktreeMetaDialog.tsx:390` — field renders unconditionally; the Issue field at line 373 uses `isReadOnly={isFolderWorkspace}`.
- Main-side sites that would need the field if persisted: `src/main/ipc/worktrees/folder-workspace-model.ts`, `src/main/runtime/runtime-folder-workspace.ts`.

## Required outcome
- A link saved on a folder workspace must either persist and surface on its card/status bar, or the field must be disabled/hidden so input is not silently discarded.

## Suggested approach
- Full support: add `workspaceUrl` to `FolderWorkspace`, project it in `folderWorkspaceToWorktree`, map it in `getFolderWorkspaceMetaUpdates`, and persist it through the folder-workspace main models.
- Minimal: gate `WorktreeWorkspaceUrlField` on `!isFolderWorkspace`.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in b0fa862: the Link field is hidden on folder workspaces, orca worktree set --url rejects them with a clear error, and folder-kind repos that do persist the link now project it.

}: WorktreeCardPortsProps): React.JSX.Element | null {
const recordFeatureInteraction = useAppStore((s) => s.recordFeatureInteraction)

if (ports.length === 0) {
if (ports.length === 0 && !worktree?.workspaceUrl) {

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.

With this guard, the trigger now renders for a workspace that has a link but zero ports, yet its aria-label below still reads {{value0}} live {{value1}} → "0 live ports". Consider a link-aware label so the control does not announce zero ports when it is the only affordance for the saved link.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 2df471f: with a link and no live ports the trigger is now labelled "Workspace link". Added a test.

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

  • Last reviewed commit: baa539eb17077e5fa0c6a03f41be0d288f6853c3
  • Latest commit, not reviewed: a6c737a

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
Walkthrough

Worktrees now support an optional workspace URL that can be set through the CLI or metadata dialog and cleared with an empty value. The interface displays saved URLs in worktree cards and the ports status popover, with controls to open or copy them. A shared opener handles system-browser, local Orca Browser, and environment-target URLs. A keybinding and app command open the active worktree’s saved URL.

Merge Risk: Low · previous review baa53

A renderer caller that bypasses the validating dialog can persist a file URL that Orca may admit as a browser URL. Screen-reader users also lack an associated validation explanation, and URL-only cards have a misleading trigger label. These are bounded issues; the normal dialog and CLI paths validate URLs.

Security Architecture Review

Security architecture risk: 🔵 Low · up to b8eab

Saved links introduce user-directed navigation to arbitrary web destinations. Normal editing restricts links to HTTP(S), and existing browser protections remain in place. Some write-boundary and recovery assurances remain incomplete.

Retained concerns
No architecture-level concerns identified.

Security review details


Security Blast Radius

  • inferred — Influence over a saved URL can direct subsequent user-initiated navigation to arbitrary HTTP(S) hosts reachable from the selected browser environment, including internal services. The inspected update path persists metadata rather than automatically opening it; unauthorized metadata write access was not established.

Trust Boundaries and Controls

  • observed — The inspected paired WebSocket transport rejects missing, invalid or conflicting device tokens, applies a mobile method allowlist and supplies authenticated device identity to dispatch. The local system-browser sink independently rejects non-HTTP(S) schemes.
  • observed — URL validation is not uniform across write boundaries. The dialog and RPC validate workspaceUrl, while local metadata IPC normalizes linked-item fields and writes the remaining metadata without applying the URL validator. This establishes a contract inconsistency, not a demonstrated privilege escalation.
  • observed — The inspected routed-browser guest navigation path rejects file URLs and requires current registration and a navigation grant. These downstream controls counter a claim that unvalidated metadata necessarily grants unrestricted browser authority; complete coverage of every guest-opening path remains unresolved.

Resilience and Maintainability Implications

  • observed — Remote page creation precedes local tab creation and handle association. Failure between these steps has no cleanup call in the helper, and repeated activation creates additional pages. The same sequence existed in the base port opener, so it is a pre-existing lifecycle limitation rather than an introduced concern.

Hardening Proposals

  • proposed — Apply the same presence-sensitive HTTP(S)-or-clear validation at local metadata writes and saved-link opening, so the contract does not depend solely on the editing client.
Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 16 files. (1 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 and concisely describes the main change: saving a workspace link and opening it from multiple workspace surfaces and a shortcut.
Description check Passed The description is detailed and covers the user-facing change, implementation, rationale, testing, platform behavior, and checklist. It identifies missing linked-issue information, pending visual proo…
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 36.36% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 16 files. (1 skipped: 1 unsupported.)

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

Autopilot is currently an internal CodeRabbit preview.

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

@lucacri
lucacri force-pushed the lucacri/port-url-override branch 5 times, most recently from 59f06b9 to 7f6b66d Compare October 8, 2026 17:59

@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: a98510d1-95c7-43c4-b4b1-0ecd47c32764
📥 Commits

Reviewing files that changed from the base of the PR and between e07780d and 7f6b66d4bb08308f7f3e419384b9727c48e88d0c.

📒 Files selected for processing (15)
  • src/cli/handlers/worktree.ts
  • src/main/runtime/rpc/methods/worktree.ts
  • src/renderer/src/app-shell/app-command-handlers.ts
  • src/renderer/src/app-shell/workspace-open-url-command.ts
  • src/renderer/src/components/activity/activity-thread-hover-card.tsx
  • src/renderer/src/components/sidebar/WorktreeMetaDialog.test.tsx
  • src/renderer/src/components/sidebar/WorktreeMetaDialogDraft.tsx
  • src/renderer/src/components/sidebar/WorktreeWorkspaceUrlField.tsx
  • src/renderer/src/components/sidebar/use-worktree-card-secondary-details.ts
  • src/renderer/src/components/sidebar/worktree-card-parent-content.tsx
  • src/renderer/src/components/sidebar/worktree-card-presentation.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/shared/rpc-contract/worktree-params.ts
  • src/shared/worktree/meta-types.ts
  • src/shared/worktree/types.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • 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; 9 remain after this review.

@lucacri
lucacri force-pushed the lucacri/port-url-override branch from 7f6b66d to 2d91316 Compare October 9, 2026 09:17

@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: 38a9abe4-fbe9-4295-b8e4-507a81b269c6
📥 Commits

Reviewing files that changed from the base of the PR and between e07780d and 2d913164b0db2dd7af5aaa02356c4159d90a3b7c.

📒 Files selected for processing (17)
  • src/cli/handlers/worktree.ts
  • src/main/runtime/rpc/methods/worktree.ts
  • src/renderer/src/app-shell/app-command-handlers.ts
  • src/renderer/src/app-shell/workspace-open-url-command.ts
  • src/renderer/src/components/activity/activity-thread-hover-card.tsx
  • src/renderer/src/components/sidebar/WorktreeMetaDialog.test.tsx
  • src/renderer/src/components/sidebar/WorktreeMetaDialogDraft.tsx
  • src/renderer/src/components/sidebar/WorktreeWorkspaceUrlField.tsx
  • src/renderer/src/components/sidebar/use-worktree-card-secondary-details.ts
  • src/renderer/src/components/sidebar/worktree-card-parent-content.tsx
  • src/renderer/src/components/sidebar/worktree-card-presentation.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/shared/keybindings/definitions-core-4.ts
  • src/shared/keybindings/types.ts
  • src/shared/rpc-contract/worktree-params.ts
  • src/shared/worktree/meta-types.ts
  • src/shared/worktree/types.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • 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; 8 remain after this review.

@lucacri
lucacri force-pushed the lucacri/port-url-override branch from 2d91316 to baa539e Compare October 10, 2026 20:07

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Reject invalid workspaceUrl values in the desktop IPC handler. · meta-types.ts:86-87

src/shared/worktree/meta-types.ts:86-87
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Reject invalid workspaceUrl values in the desktop IPC handler.

The desktop bridge accepts arbitrary updates, but worktrees:updateMeta persists every truthy workspaceUrl without applying the HTTP(S)-only contract. A value such as file:///... then survives in browser page state and can be admitted as an initial Orca browser URL. The system-browser path rejects it, but the Orca browser does not enforce the workspace URL contract. Validate the field before persistence.

Suggested fix
 import { normalizeLinkedWorkItemFields } from '../ipc-context-schemas'
 import { listDesktopLineageForHost } from './host-lineage-listing'
 import type { WorktreeIpcContext } from '../worktree-ipc-context'
+import { isValidWorkspaceUrl } from '../../../../shared/workspace-url'

 export function registerWorktreeMetadataHandlers(context: WorktreeIpcContext): void {
   const { mainWindow, store, runtime } = context
   ipcMain.handle(
@@
       if (args.executionHostId !== undefined && !executionHostId) {
         throw new Error('Invalid execution host identity.')
       }
+      if (
+        args.updates.workspaceUrl !== undefined &&
+        args.updates.workspaceUrl !== '' &&
+        !isValidWorkspaceUrl(args.updates.workspaceUrl)
+      ) {
+        throw new Error('Invalid workspace URL.')
+      }
       const validatedUpdates = normalizeLinkedWorkItemFields(args.updates)

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: af4ce46d-373e-4280-9eb0-5f38dda2c031
📥 Commits

Reviewing files that changed from the base of the PR and between 2d913164b0db2dd7af5aaa02356c4159d90a3b7c and baa539eb17077e5fa0c6a03f41be0d288f6853c3.

📒 Files selected for processing (3)
  • src/cli/handlers/worktree.ts
  • src/main/runtime/rpc/methods/worktree.ts
  • src/renderer/src/i18n/locales/en.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • 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; 7 remain after this review.

@lucacri
lucacri force-pushed the lucacri/port-url-override branch 6 times, most recently from b72abef to 1b59022 Compare October 16, 2026 09:17
@lucacri
lucacri force-pushed the lucacri/port-url-override branch 3 times, most recently from 56ad19e to 25137ca Compare October 23, 2026 12:48
@lucacri
lucacri force-pushed the lucacri/port-url-override branch 7 times, most recently from 494c508 to 98efbde Compare October 30, 2026 15:39
@lucacri
lucacri force-pushed the lucacri/port-url-override branch 6 times, most recently from c0e85ae to 30183cf Compare November 21, 2026 21:13
@lucacri
lucacri force-pushed the lucacri/port-url-override branch 6 times, most recently from 5e1b7a0 to 8fa39b1 Compare November 30, 2026 08:49
Luca Critelli added 16 commits November 30, 2026 23:56
… bar

Each workspace can store one http(s) link (e.g. https://app.test/admin).
The card's ports section and the status-bar ports popover show it with
open and copy actions, even when no port is live. Set with
`orca worktree set --url <link>`; `--url null` clears it.
Adds a rebindable 'Open Workspace Link' action (⇧⌘U on macOS,
Alt+Shift+U elsewhere) that opens the active workspace's saved link in
the built-in browser. It does nothing when no link is set. Direct-SSH
workspaces, which have no runtime target, now open the link locally.
Adds a Link field to the workspace Update dialog, seeded from the saved
link. Saving writes it only when it changed; an empty field clears it,
and anything that is not an http(s) link blocks Save.
…of dropping it

Project-group folder workspaces have no link field in their store, so the
dialog's Link field and `orca worktree set --url` silently lost the value.
Hide the field for them, reject --url with a clear error, and project the
saved link for folder-kind repos, which already persist it in worktree meta.
@lucacri
lucacri force-pushed the lucacri/port-url-override branch from 8fa39b1 to a6c737a Compare December 1, 2026 04:57

This branch has not been deployed

No deployments
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