Skip to content

fix(bots): open remote thread links from the server reply - #48439

Merged
brennanb2025 merged 34 commits into
mainfrom
brennanb2025/remote-link-501
Nov 26, 2026
Merged

brennanb2025 merged 34 commits into
mainfrom
brennanb2025/remote-link-501

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

“Open this thread in Orca” could leave you on the bot’s Home with an error even though the paired server found your chat. Orca opens it as soon as the server answers, including after a restart. If you choose another tab, pane, or workspace while it loads, Orca follows your newer action.

Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​399 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​399
Prod 42 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1731 $\color{#cf222e}{\Huge{\mathbf{−}}}$​285 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1446

What Changed

A paired thread link uses the server’s tab-list reply to draw the requested chat. The live feed fills in the workspace and older frames keep the opened chat until the feed catches up. Repeat clicks share pending work.

Why

The tab list and the live feed arrive separately. A delay in the feed can leave the window looking at an incomplete list of tabs.

Linked Issue

Tracked in #47486 as a follow-up.

Visual Proof

Seeded before and after

Before, the bot Home stayed open and reported a chat-open error
After, the linked chat opened while the feed was held

Testing

  • Open seeded Claude and Codex thread links with the feed held. Check repeat opens, a paired host restart, and tab order through an older frame.
  • Named Linux tests cover stale inventory, runtime replacement, split placement, shared requests, and navigation.

Performance

One chat is drawn from the existing connection. Repeat opens share reads and the navigation observer stops when the link settles.

Risk

Medium. Incorrect receipt ordering could hide an open chat or restore a stale tab. A revert restores the previous path.

AI Disclosure

N/A

Review

Checked tab ownership, freshness, navigation, and request cleanup.

Agent skill upstream boundary

  • No upstream skill-installer code or data copied.

Notes

Scoped to desktop thread links targeting paired bots.

Checklist

  • Seeded evidence and a revert path included.
  • Platform, paired-server, navigation, correctness, and performance considered.
  • Full checks covered by CI.

@brennanb2025 brennanb2025 changed the title fix(bots): open remote thread links when the chat tab arrives fix(bots): use the server tab list to open remote thread links Nov 24, 2026
@brennanb2025 brennanb2025 changed the title fix(bots): use the server tab list to open remote thread links fix(bots): open remote thread links when the chat tab arrives Nov 24, 2026
@brennanb2025
brennanb2025 marked this pull request as ready for review November 24, 2026 22:04
@brennanb2025
brennanb2025 marked this pull request as draft November 24, 2026 22:09
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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.

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

No actionable comments were generated in the recent review.

Walkthrough

The change adds a keyed, cancellable lifecycle for bot conversation opens and connects link activation to abort-aware structured-session operations. Runtime session-tab reads can create and track directly opened chat tabs. Snapshot reconciliation retains eligible chats, applies host group placement, and clears tracking during cleanup. The change also adds regression tests for open deduplication, chat retention, and initial host-group adoption.

Merge Risk: Low · up to bb1b0

Opening a bot thread link from the server reply now handles most newer-navigation cases. Two narrow edge cases may remain: a replacement chat may not open before the live feed catches up, and a chat may briefly appear in two groups after an older frame. Both are minor and self-correcting once the feed catches up.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(bots): open remote thread links from the server reply" matches the main change: paired-bot thread links now open from the server's tab-list reply instead of waiting for the live feed. T…
Description check Passed The description follows the repository template: it has ELI5, What Changed, Why, Linked Issue, Visual Proof with before and after images, Testing, Performance, Risk with a level, AI Disclosure, Review…
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: Title check

Explanation

The title "fix(bots): open remote thread links from the server reply" matches the main change: paired-bot thread links now open from the server's tab-list reply instead of waiting for the live feed. The title is concise, specific, and follows a conventional commit style. It does not cover the cancellation, navigation tracking, or shared-request work, which is expected for a short title.

Full details: Description check

Explanation

The description follows the repository template: it has ELI5, What Changed, Why, Linked Issue, Visual Proof with before and after images, Testing, Performance, Risk with a level, AI Disclosure, Review, upstream boundary, Notes, and Checklist. The Why section is brief and does not compare alternatives. The Linked Issue section references #47486 as a follow-up but does not use the 'Fixes #' form, and the template asks for an actual issue link. The Risk level is set to Medium. The Testing items are checked but do not list the exact platforms tested beyond Linux tests. The Performance section is one line with a reason. Overall the description is mostly complete, so the check passes with minor gaps.

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

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ddf27d85-c10b-4028-a02a-df04e05916d7
Commits

Reviewing files that changed from the base of the PR and between 1a73ff0 and bb1b043.

Files selected for processing: 1

  • src/renderer/src/runtime/rpc/compatibility/runtime-capability-proof.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@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

Caution

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

⚠️ Outside diff range comments (1)

Minor · Check current() before presenting an opened result. · open-existing-structured-session.ts:190

src/renderer/src/lib/agent-session/open/open-existing-structured-session.ts:190
Minor · Functional Correctness · Quick win

Check current() before presenting an opened result.

The success handler presents the result when only initialized is true. If a newer navigation sets current() to false after the result settles but before this callback runs, the handler still calls present. presentDesktopStructuredSession then activates the stale workspace. The user can land on that workspace instead of the newer selection. The PR states that newer user actions take precedence, so the presentation should not run for an operation that is no longer current.

Guard the presentation with the same current check that the paired refresh already uses:

Suggested fix

       (result) => {
-        if (initialized) {
+        if (initialized && (deps.current?.() ?? true)) {
           options.present(result, owner)
         }
         return result
Minor comments: 1

src/renderer/src/runtime/web-session-tabs-sync/inventory/paired-chat-tab-reply.ts: 1

107-107: Minor · Functional Correctness · Poor tradeoff

Do not return early when a replacement chat is requested.

When the client already has an owner-host tab for session old, and the requested inventory row is new with replacesSessionId: 'old', this guard returns before new is projected. The reply cannot make new available to the opener in this case. If no other path projects new before the opener's final activation check, the open can fail with TAB_NEVER_APPEARED until the live feed reconciles the replacement.

Keep the early return only for an existing owner tab whose session is already sessionId. For the replacement case, reuse the existing tab for old and map it to new. Do not create a second tab. This keeps the requested chat openable before the subscription arrives, as the PR objective requires.

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a58ebf91-e8d8-478b-90c1-fa2a9265eea3
Commits

Reviewing files that changed from the base of the PR and between d7bd9c6 and bab73b0.

Files selected for processing: 25

  • src/renderer/src/components/bots/bot-session-open.ts
  • src/renderer/src/components/native-chat/session/native-chat-removed-tab-retirement.ts
  • src/renderer/src/components/tab-bar/model/use-tab-bar-item-actions.ts
  • src/renderer/src/lib/agent-session/open/activate-ai-vault-structured-session.ts
  • src/renderer/src/lib/agent-session/open/bot-thread-open-lifecycle.test.ts
  • src/renderer/src/lib/agent-session/open/bot-thread-open-lifecycle.ts
  • src/renderer/src/lib/agent-session/open/bot-thread-open-navigation.ts
  • src/renderer/src/lib/agent-session/open/open-existing-structured-session.ts
  • src/renderer/src/lib/bot-catalog.ts
  • src/renderer/src/lib/bot-link-open.ts
  • src/renderer/src/lib/keyboard/tab-number-shortcuts.ts
  • src/renderer/src/lib/workspace/tabs/ipc-tab-switch.ts
  • src/renderer/src/runtime/hosted-terminals/creation/web-runtime-terminal-creation.ts
  • src/renderer/src/runtime/native-chat/tab-retirement/structured-agent-session-tab-retirement.ts
  • src/renderer/src/runtime/web-session-tabs-sync/identity/tracking-mappings.ts
  • src/renderer/src/runtime/web-session-tabs-sync/inventory/paired-chat-tab-reply.ts
  • src/renderer/src/runtime/web-session-tabs-sync/snapshots/apply-preparation-browser.ts
  • src/renderer/src/runtime/web-session-tabs-sync/snapshots/apply-preparation-groups.ts
  • src/renderer/src/runtime/web-session-tabs-sync/snapshots/apply-worktree-records.ts
  • src/renderer/src/runtime/web-session-tabs-sync/tab-projection/terminal-surfaces.ts
  • src/renderer/src/runtime/web-session-tabs-sync/tracking/directly-opened-chat-tabs.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync/tracking/directly-opened-chat-tabs.ts
  • src/renderer/src/runtime/web-session-tabs-sync/tracking/tracking-lifecycle.ts
  • src/renderer/src/runtime/web-session-tabs-sync/tracking/tracking.ts
  • src/shared/agent-session/view/open-structured-agent-session.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@brennanb2025 brennanb2025 changed the title fix(bots): open remote thread links when the chat tab arrives fix(bots): open remote thread links from the server reply Nov 24, 2026
@brennanb2025
brennanb2025 marked this pull request as ready for review November 25, 2026 03:06

@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: 3

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e834aaca-1e6c-4d2a-a966-6a04fa8feeb0
Commits

Reviewing files that changed from the base of the PR and between bab73b0 and b5d9e92.

Files selected for processing: 33

  • src/renderer/src/components/terminal-pane/input/keyboard/terminal-keyboard-action-dispatch.ts
  • src/renderer/src/components/terminal-pane/mounting/terminal-pane-manager-options.ts
  • src/renderer/src/components/terminal-pane/titles/use-terminal-pane-header-actions.ts
  • src/renderer/src/lib/agent-session/open/bot-thread-open-lifecycle.test.ts
  • src/renderer/src/lib/agent-session/open/bot-thread-open-lifecycle.ts
  • src/renderer/src/lib/agent-session/open/bot-thread-open-navigation.ts
  • src/renderer/src/lib/agent-session/open/open-existing-structured-session.ts
  • src/renderer/src/lib/agent-session/open/paired-bot-thread-recovery.ts
  • src/renderer/src/lib/agent-session/open/structured-session-restore.ts
  • src/renderer/src/lib/bot-link-open.ts
  • src/renderer/src/lib/keyboard/tab-number-shortcuts.ts
  • src/renderer/src/lib/pane-manager/pane-manager-pane-creation.ts
  • src/renderer/src/lib/pane-manager/pane-manager-types.ts
  • src/renderer/src/runtime/rpc/calls/runtime-rpc-call.ts
  • src/renderer/src/runtime/rpc/calls/shared-runtime-rpc-admission.ts
  • src/renderer/src/runtime/rpc/compatibility/runtime-capability-proof.ts
  • src/renderer/src/runtime/rpc/compatibility/runtime-compatibility-probe.ts
  • src/renderer/src/runtime/web-session-tabs-sync/inventory/load-initial.ts
  • src/renderer/src/runtime/web-session-tabs-sync/inventory/paired-chat-tab-reply.ts
  • src/renderer/src/runtime/web-session-tabs-sync/inventory/remote-runtime-session-tabs-inflight.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync/inventory/remote-runtime-session-tabs-inflight.ts
  • src/renderer/src/runtime/web-session-tabs-sync/inventory/web-runtime-session-snapshot.ts
  • src/renderer/src/runtime/web-session-tabs-sync/placement/layout-groups.ts
  • src/renderer/src/runtime/web-session-tabs-sync/snapshots/agent-tab-snapshot.ts
  • src/renderer/src/runtime/web-session-tabs-sync/snapshots/apply-preparation-browser.ts
  • src/renderer/src/runtime/web-session-tabs-sync/snapshots/apply-preparation-groups.ts
  • src/renderer/src/runtime/web-session-tabs-sync/snapshots/apply-preparation-unified.ts
  • src/renderer/src/runtime/web-session-tabs-sync/state.ts
  • src/renderer/src/runtime/web-session-tabs-sync/tab-projection/terminal-surfaces.ts
  • src/renderer/src/runtime/web-session-tabs-sync/tracking/directly-opened-chat-tabs.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync/tracking/directly-opened-chat-tabs.ts
  • src/renderer/src/runtime/web-session-tabs-sync/tracking/tracking-lifecycle.ts
  • src/renderer/src/runtime/web-session-tabs-sync/tracking/tracking.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@brennanb2025
brennanb2025 marked this pull request as draft November 25, 2026 03:21
@brennanb2025
brennanb2025 marked this pull request as ready for review November 25, 2026 04:25
@brennanb2025
brennanb2025 marked this pull request as draft November 25, 2026 04:32
@brennanb2025
brennanb2025 marked this pull request as ready for review November 25, 2026 05:12
@brennanb2025
brennanb2025 marked this pull request as draft November 26, 2026 00:02
@brennanb2025
brennanb2025 marked this pull request as ready for review November 26, 2026 00:06
@brennanb2025

Copy link
Copy Markdown
Contributor Author

A paired thread link now opens the requested chat from the server’s reply while the tab feed catches up. A newer deliberate pane selection takes priority. An older feed frame keeps the chat visible once, and repeat clicks share the pending open.

QA evidence: With the feed held, seeded desktop links opened both chats before the feed released. After release, each still had one active tab. An in-flight repeat recovered with one follow-up read and one reveal total. The desktop flow passed all seven steps.

The current commit passed targeted tests for shortcuts, chat reads, and tab reconciliation, plus full typecheck and CI.

Seeded chat open while the feed was held

The linked chat opened while the feed was held

Benchmark: head=1a73ff04ad593cf0da02ca3c163ffe9b40988923 gate=PASS With the navigation observer and runtime request handler mounted, a listed chat opened with one read and one activation. At 12 and 120 repeat clicks, one list reached dispatch.
Benchmark: head=1a73ff04ad593cf0da02ca3c163ffe9b40988923 gate=PASS With navigation and request settlement observers mounted, settlement released the navigation subscription, abort listeners, and deadline timer.
Benchmark: head=1a73ff04ad593cf0da02ca3c163ffe9b40988923 gate=PASS With pane focus handlers and the navigation observer mounted, passive hover let the link finish and a deliberate pane selection canceled it. Focus made zero additional inventory calls.
Benchmark: head=1a73ff04ad593cf0da02ca3c163ffe9b40988923 gate=PASS With the runtime request handler installed and no link open, ten simulated idle minutes produced zero additional timers, requests, or navigation callbacks.

@brennanb2025
brennanb2025 merged commit b0364bc into main Nov 26, 2026
87 checks passed
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