Skip to content

[Tabs] Preserve host routing and reduce search churn - #13114

Merged
AmethystLiang merged 7 commits into
mainfrom
add-search-for-tabs
Aug 9, 2026
Merged

AmethystLiang merged 7 commits into
mainfrom
add-search-for-tabs

Conversation

@AmethystLiang

Copy link
Copy Markdown
Contributor

Summary

  • Preserve execution-host identity through open-tab search and workspace, browser, and emulator activation.
  • Snapshot agent metadata while the omnibox is open so status heartbeats do not rebuild the file index.
  • Restore tab-search translations for Spanish, Japanese, Korean, and Chinese.
  • Add regression coverage for host collisions and heartbeat render isolation.

Verification

  • 15 changed test files: 160 passed.
  • pnpm run typecheck passed.
  • Changed-code quality, React Doctor, localization checks, and diff checks passed.
  • Full suite: 47,822 passed; 3 unrelated SSH relay tests timed out under parallel load and passed 21/21 when rerun alone.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

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

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

Walkthrough

The change adds execution-host-aware search across workspace, browser, simulator, and agent tabs. It returns deferred query state with search results and rejects stale results in the tab bar. It routes activation through host-aware workspace, browser, and simulator helpers. It adds direct browser focus requests, worktree-aware path deduplication, typed failure handling, tests, and localized search labels.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes a summary and verification results but omits the required Screenshots, AI Review Report, Security Audit, and Notes sections. Add all missing template sections, state “No visual change” if applicable, and document AI review, cross-platform checks, security risks, and follow-up work.
Docstring Coverage ⚠️ Warning Docstring coverage is 8.20% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: preserving host routing and reducing open-tab search churn.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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

Comment @coderabbitai help to get the list of available commands.

@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

Caution

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

⚠️ Outside diff range comments (1)
src/renderer/src/components/WorktreeJumpPalette.tsx (1)

1737-1759: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Preserve the simulator result execution host.

Line 1739 passes SimulatorPaletteSearchResult to the activation helper. That result type has no executionHostId. The helper then resolves getKnownWorktreeById(worktreeId, undefined).

When worktree IDs collide across execution hosts, this can activate or reject the wrong simulator tab. Add executionHostId when building simulator search results. Pass it through the result type. Add a host-collision regression test.

🧹 Nitpick comments (1)
src/renderer/src/components/tab-bar/open-tab-entry-dedupe.test.ts (1)

70-100: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Strengthen the terminal fixture so the test proves what its name claims.

The terminal result at Line 72 carries relativePath: null, so it is filtered by the result.relativePath check, not by the source === 'workspace' check. The test therefore does not prove that a terminal result cannot suppress a file entry. Give the terminal fixture a non-null relativePath to pin the intended contract inside dropFileEntriesCoveredByTabResults.

♻️ Proposed test fixture change
     const results: OpenTabSearchResult[] = [
-      { ...editorTab(null), contentType: 'terminal' },
+      { ...editorTab('src/zebra.ts'), contentType: 'terminal' },
       {

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 49f7a5f9-644c-459d-bd72-02cedacb10a0

📥 Commits

Reviewing files that changed from the base of the PR and between 4c26ef6 and 0f00c7c0c6da2ed2ac6fe9099eb3440ed77f0351.

📒 Files selected for processing (37)
  • src/renderer/src/components/WorktreeJumpPalette.test.tsx
  • src/renderer/src/components/WorktreeJumpPalette.tsx
  • src/renderer/src/components/tab-bar/TabBar.context-menu.test.ts
  • src/renderer/src/components/tab-bar/TabBar.tsx
  • src/renderer/src/components/tab-bar/TabBar.windows-shell-launch.test.ts
  • src/renderer/src/components/tab-bar/TabBarCreateEntry.keyboard.test.tsx
  • src/renderer/src/components/tab-bar/TabBarCreateEntry.tab-results.test.tsx
  • src/renderer/src/components/tab-bar/TabBarCreateEntry.tsx
  • src/renderer/src/components/tab-bar/TabBarCreateEntryRow.tsx
  • src/renderer/src/components/tab-bar/lucide-icon-stub-fixture.ts
  • src/renderer/src/components/tab-bar/open-tab-entry-dedupe.test.ts
  • src/renderer/src/components/tab-bar/open-tab-entry-dedupe.ts
  • src/renderer/src/components/tab-bar/open-tab-search-entries.ts
  • src/renderer/src/components/tab-bar/open-tab-search.test.ts
  • src/renderer/src/components/tab-bar/open-tab-search.ts
  • src/renderer/src/components/tab-bar/open-tab-selection-routing.test.ts
  • src/renderer/src/components/tab-bar/open-tab-selection-routing.ts
  • src/renderer/src/components/tab-bar/tab-create-entry-active-option.ts
  • src/renderer/src/components/tab-bar/tab-create-entry-classifier.test.ts
  • src/renderer/src/components/tab-bar/tab-create-entry-classifier.ts
  • src/renderer/src/components/tab-bar/use-open-tab-search.test.ts
  • src/renderer/src/components/tab-bar/use-open-tab-search.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/browser-page-palette-activation.test.ts
  • src/renderer/src/lib/browser-page-palette-activation.ts
  • src/renderer/src/lib/browser-palette-page-entries.test.ts
  • src/renderer/src/lib/browser-palette-page-entries.ts
  • src/renderer/src/lib/simulator-tab-palette-activation.test.ts
  • src/renderer/src/lib/simulator-tab-palette-activation.ts
  • src/renderer/src/lib/workspace-tab-palette-activation.test.ts
  • src/renderer/src/lib/workspace-tab-palette-activation.ts
  • src/renderer/src/lib/workspace-tab-palette-search.test.ts
  • src/renderer/src/lib/workspace-tab-palette-search.ts

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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 600305d9-0ebc-445b-a07d-b8e08bd95614

📥 Commits

Reviewing files that changed from the base of the PR and between 0f00c7c0c6da2ed2ac6fe9099eb3440ed77f0351 and bb8df1c768baf377b7541bfddbd02a6b78009606.

📒 Files selected for processing (4)
  • src/renderer/src/components/tab-bar/open-tab-search-entries.ts
  • src/renderer/src/components/tab-bar/open-tab-selection-routing.test.ts
  • src/renderer/src/components/tab-bar/open-tab-selection-routing.ts
  • src/renderer/src/components/tab-bar/use-open-tab-search.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/renderer/src/components/tab-bar/open-tab-selection-routing.test.ts
  • src/renderer/src/components/tab-bar/open-tab-selection-routing.ts
  • src/renderer/src/components/tab-bar/use-open-tab-search.test.ts

- Use worktree.hostId to resolve execution host instead of defaulting to LOCAL_EXECUTION_HOST_ID
- Correctly populate search results for remote-only worktrees when activeWorkspaceExecutionHostId is null
- Remove automatic focus of terminal tabs after search activation
- useOpenTabSearch now returns {query, results} to track which query the results describe
- Gate tab results on query match so stale results don't appear on user's screen
- Add live region (role=status) for accessibility of tab switch error messages
- Distinguish missing-worktree from missing-page errors in browser page activation
- Improve host resolution to prefer active host when worktree and repo don't specify one
Track whether selection auto-follows the top-ranked result or was
manually positioned. Re-pin entry to tabs when they rank higher,
but preserve manual selection.
- Extract requestBrowserFocus to handle queueing + event dispatch atomically
- Simplify omnibox selection tracking with single pinnedOptionId state
- Optimize host resolution in tab search to compute once per query
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

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.

Two readiness-checklist fixes for open-tab search:

- Browser page activation checked page/workspace before the worktree, but
  deleting a worktree purges its browser workspaces and pages too, so a dead
  workspace surfaced as "Browser page no longer exists". Check the worktree
  first; routing already maps missing-worktree to the workspace wording.

- Editor-tab/file dedupe compared paths with separator normalization only, so
  a Windows worktree offered both "Switch to tab" and "Open file" for the same
  path in different case. Fold by the worktree path's syntax via the new
  isCaseInsensitiveRuntimeRoot, keeping WSL, POSIX and SSH roots case-sensitive,
  and add NFC so a macOS NFD listing matches an editor's composed path.
@AmethystLiang

Copy link
Copy Markdown
Contributor Author

@coderabbitai Fixing. Will be in the next commit

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@AmethystLiang Acknowledged. I will review the update when you push the next commit.

You are interacting with an AI system.

- Only editor tabs should suppress file entries; check contentType instead
  of relying on path being empty for non-editor tabs.
- Add executionHostId to simulator search results to disambiguate when
  the same worktree id exists on multiple execution hosts.
@AmethystLiang
AmethystLiang merged commit 17eefef into main Aug 9, 2026
43 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix tab search host routing and churn

* Fix open-tab search to resolve hosts from worktree when active host unkn

- Use worktree.hostId to resolve execution host instead of defaulting to LOCAL_EXECUTION_HOST_ID
- Correctly populate search results for remote-only worktrees when activeWorkspaceExecutionHostId is null
- Remove automatic focus of terminal tabs after search activation

* Prevent stale tab results when user keeps typing ahead of deferred searc

- useOpenTabSearch now returns {query, results} to track which query the results describe
- Gate tab results on query match so stale results don't appear on user's screen
- Add live region (role=status) for accessibility of tab switch error messages
- Distinguish missing-worktree from missing-page errors in browser page activation
- Improve host resolution to prefer active host when worktree and repo don't specify one

* Re-pin entry to deferred tab results that rank higher

Track whether selection auto-follows the top-ranked result or was
manually positioned. Re-pin entry to tabs when they rank higher,
but preserve manual selection.

* Consolidate browser focus requests and simplify selection state

- Extract requestBrowserFocus to handle queueing + event dispatch atomically
- Simplify omnibox selection tracking with single pinnedOptionId state
- Optimize host resolution in tab search to compute once per query

* Report dead browser workspaces correctly and fold dedupe case by host

Two readiness-checklist fixes for open-tab search:

- Browser page activation checked page/workspace before the worktree, but
  deleting a worktree purges its browser workspaces and pages too, so a dead
  workspace surfaced as "Browser page no longer exists". Check the worktree
  first; routing already maps missing-worktree to the workspace wording.

- Editor-tab/file dedupe compared paths with separator normalization only, so
  a Windows worktree offered both "Switch to tab" and "Open file" for the same
  path in different case. Fold by the worktree path's syntax via the new
  isCaseInsensitiveRuntimeRoot, keeping WSL, POSIX and SSH roots case-sensitive,
  and add NFC so a macOS NFD listing matches an editor's composed path.

* Fix tab deduplication and resolve worktree host collisions

- Only editor tabs should suppress file entries; check contentType instead
  of relying on path being empty for non-editor tabs.
- Add executionHostId to simulator search results to disambiguate when
  the same worktree id exists on multiple execution hosts.
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