Skip to content

feat(app): open a session from an opencode:// link - #59061

Open
kitlangton wants to merge 3 commits into
devfrom
desktop-session-links
Open

kitlangton wants to merge 3 commits into
devfrom
desktop-session-links

Conversation

@kitlangton

@kitlangton kitlangton commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Another app can now open a specific OpenCode session with an opencode://session/<id> link.
The desktop app already catches opencode:// links, but nothing inside it did anything with them. Links only navigate: they never send a prompt, run anything, or add a server.

🔍 Origin: requested in #44167

💡 Why: a task board or script has no way to jump straight to a session in the desktop app.

🆕 Now you can

  • Open opencode://session/<sessionID> and land on that session in a tab. An open tab for it is reused.
  • Add ?server=<origin-or-key> to say which server holds it. Without it, every connected server is asked at once and the first to have it wins.
  • Open a subagent's link and get its parent's tab, routed to the subagent.
  • Get "Session not found on your servers" when no server has it.
- renderer buffers links, nothing in the app listens (opencode:deep-link event, window global)
+ platform.onOpenLink(cb) -> validate -> pick server (named one first, else ask all) -> open tab

📊 Proof: tested by hand in a packaged build on a fresh macOS VM (before the latest rebase), together with #59058.

Link Result
Root session, app cold-launched, restored tab showing a subagent ✅ opens the root session (used to stay on the subagent)
Subagent session ✅ opens in its root's tab
Unknown ID ✅ "Session not found on your servers"

10 unit tests pass (link parsing, server choice, subagent routing).

👀 Read: shell/links/ (server choice and the 3 s probe timeout) and openNotificationSession, which now takes an optional child route and adds a new tab with its route set so the tab store can't drop it. Web has no onOpenLink, so nothing changes there. The rest is routine.

Works without #59058: the app validates links on its own, and #59058 adds the desktop-side checks and window choice.

Checks run
  • bun test --conditions=solid --isolate --preload ../ui/test/solid-jsx.ts --preload ./happydom.ts src/shell/links src/shell/notifications/notification.test.ts (packages/app): 10 pass
  • bun typecheck (packages/app): clean
  • pre-push bun run check (lint and typecheck): pass

Added by the opencode bot (AI-generated).

Fixes #44167

Related: #53529, #55106, #56471

Public API: adds the opencode://session/<id>[?server=…] desktop deep link; removes the unused opencode:deep-link DOM event and window.__OPENCODE__.deepLinks global (backwards compatible)

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

The change looks sound and I have nothing blocking. I couldn't run it end to end: a real opencode:// link needs the desktop app and the OS link handler. The new link, resolution and notification tests pass (10/10), and tsc -b is clean in packages/app and packages/desktop. On reading, a link that launches the window is held until the app subscribes. Resolution falls back correctly when the named server is missing, lacks the session, or is down: the 3 s timeout bounds each probe and the rest run in parallel. Subagent links open in the root session's tab, routed to the subagent.

Public API: adds the opencode://session/<sessionID>[?server=<origin-or-key>] link format to the desktop app. It removes the opencode:deep-link DOM event and the window.__OPENCODE__.deepLinks global; nothing in the repository used either, so this is backwards compatible. The new onOpenLink hook on Platform is internal to the app.

Fixes #44167
Related: #53529, #55106, #56471

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

The new commit looks correct; nothing new to raise. Opening a session now gives the tab the same route it saves. Clicking a root-session notification therefore leaves a subagent the tab was showing, where before the tab saved the root route but still navigated to the subagent. Notifications for subagents themselves are unaffected, because the callers skip sessions with a parent. I read the change and ran the links and notifications tests in packages/app (10/10 pass); tsc -b is clean. The public API is unchanged since my last review.

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

The new commits look correct; nothing new to raise. A new link tab is now added with its route, so the route can't be lost while the tab joins the store, and an existing tab still gets the route saved and selected. Parent sessions already in the local cache aren't fetched again. I read the changes and ran the links and notifications tests in packages/app (10/10 pass); tsc -b is clean in packages/app and packages/desktop. The public API is unchanged since my last review.

@kitlangton
kitlangton force-pushed the desktop-session-links branch from 777124e to 0f3dd87 Compare October 25, 2026 21:43

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

This push only rebases the branch onto a newer dev; none of the pull request's own files changed, and I have nothing new to raise. The links and notifications tests in packages/app still pass (10/10). The public API is unchanged since my last review.

@kitlangton
kitlangton force-pushed the desktop-session-links branch from 0f3dd87 to 0476780 Compare October 26, 2026 17:53

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

This push rebases onto a newer dev; nothing new to raise. The pull request's own changes only shift around dev's new code (<SessionLinks /> now mounts next to <VoiceProvider>). The links and notifications tests in packages/app still pass (10/10), and tsc -b is clean in packages/app and packages/desktop. The public API is unchanged since my last review.

@kitlangton kitlangton changed the title feat(app): open session deep links feat(app): open a session from an opencode:// link Oct 26, 2026

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a deep link to open a specific Desktop session

1 participant