Skip to content

Improve cmd j ranking - #19005

Merged
AmethystLiang merged 12 commits into
mainfrom
improve-cmd-j-ranking
Sep 6, 2026
Merged

AmethystLiang merged 12 commits into
mainfrom
improve-cmd-j-ranking

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 33 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2298 $\color{#cf222e}{\Huge{\mathbf{−}}}$​490 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1808
Prod 57 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2178 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1017 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1161

ELI5

What Changed

Why

Linked Issue

Fixes #

Visual Proof

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

AI Disclosure

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

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • 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)

@coderabbitai

coderabbitai Bot commented Sep 6, 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: d59dbe72-d94d-4ad4-8996-8d3d03e4f089

📥 Commits

Reviewing files that changed from the base of the PR and between 298571a and 2f2fda5af11aced9e494576e064338b08df05643.

📒 Files selected for processing (81)
  • src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx
  • src/renderer/src/components/WorktreeJumpPalette.recent-tabs.behavior.test.tsx
  • src/renderer/src/components/WorktreeJumpPalette.recent-tabs.test.tsx
  • src/renderer/src/components/WorktreeJumpPalette.test.tsx
  • src/renderer/src/components/cmd-j/palette-section-render-cap.test.ts
  • src/renderer/src/components/cmd-j/palette-section-render-cap.ts
  • 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/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/use-open-tab-search.test.ts
  • src/renderer/src/components/tab-bar/use-open-tab-search.ts
  • src/renderer/src/components/tab-bar/use-tab-create-entry-search-results.ts
  • src/renderer/src/components/use-worktree-jump-palette-controller.ts
  • src/renderer/src/components/use-worktree-jump-palette-local-state.ts
  • src/renderer/src/components/use-worktree-jump-palette-open-tabs.ts
  • src/renderer/src/components/use-worktree-jump-palette-recent-tabs.ts
  • src/renderer/src/components/use-worktree-jump-palette-sections.ts
  • src/renderer/src/components/use-worktree-jump-palette-selection-lifecycle.ts
  • src/renderer/src/components/use-worktree-jump-palette-worktrees.ts
  • src/renderer/src/components/worktree-jump-palette-browser-simulator-rows.tsx
  • src/renderer/src/components/worktree-jump-palette-interleaved-sections.test.tsx
  • src/renderer/src/components/worktree-jump-palette-open-tab-items.ts
  • src/renderer/src/components/worktree-jump-palette-primitives.test.tsx
  • src/renderer/src/components/worktree-jump-palette-primitives.tsx
  • src/renderer/src/components/worktree-jump-palette-workspace-tab-row.tsx
  • src/renderer/src/components/worktree-jump-palette-worktree-row.tsx
  • src/renderer/src/hooks/use-palette-search-evaluation-context.test.ts
  • src/renderer/src/hooks/use-palette-search-evaluation-context.ts
  • 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/browser-palette-search.ts
  • src/renderer/src/lib/browser-workspace-tab-activation.test.ts
  • src/renderer/src/lib/browser-workspace-tab-activation.ts
  • src/renderer/src/lib/cmd-j-host-qualified-candidate-ownership.test.ts
  • src/renderer/src/lib/cmd-j-section-leadership.test.ts
  • src/renderer/src/lib/cmd-j-section-leadership.ts
  • src/renderer/src/lib/file-preview.test.ts
  • src/renderer/src/lib/palette-match/cmd-j-ranking-contract.test.ts
  • src/renderer/src/lib/palette-match/indexed-field.ts
  • src/renderer/src/lib/palette-match/match-document.ts
  • src/renderer/src/lib/palette-match/match-field-allocation.test.ts
  • src/renderer/src/lib/palette-match/palette-assignment-inspection.ts
  • src/renderer/src/lib/palette-match/palette-assignment-ranking.ts
  • src/renderer/src/lib/palette-match/palette-document.ts
  • src/renderer/src/lib/palette-match/palette-match-budget.ts
  • src/renderer/src/lib/palette-match/palette-match-core.test.ts
  • src/renderer/src/lib/palette-match/palette-match-performance.test.ts
  • src/renderer/src/lib/palette-match/palette-match-rendering.ts
  • src/renderer/src/lib/palette-match/palette-query.ts
  • src/renderer/src/lib/palette-match/palette-ranking.test.ts
  • src/renderer/src/lib/palette-match/palette-ranking.ts
  • src/renderer/src/lib/palette-match/palette-selection-source-order.ts
  • src/renderer/src/lib/palette-match/tab-document.ts
  • src/renderer/src/lib/palette-match/tab-match.ts
  • src/renderer/src/lib/simulator-palette-active-tab.ts
  • src/renderer/src/lib/simulator-palette-search.test.ts
  • src/renderer/src/lib/simulator-palette-search.ts
  • src/renderer/src/lib/simulator-tab-palette-activation.test.ts
  • src/renderer/src/lib/simulator-tab-palette-activation.ts
  • src/renderer/src/lib/unified-tab-host-ownership.ts
  • src/renderer/src/lib/workspace-tab-agent-metadata.test.ts
  • src/renderer/src/lib/workspace-tab-agent-metadata.ts
  • src/renderer/src/lib/workspace-tab-agent-snippet-match.ts
  • src/renderer/src/lib/workspace-tab-palette-activation.store.test.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-content-type.ts
  • src/renderer/src/lib/workspace-tab-palette-entry-builder.ts
  • src/renderer/src/lib/workspace-tab-palette-results.test.ts
  • src/renderer/src/lib/workspace-tab-palette-results.ts
  • src/renderer/src/lib/workspace-tab-palette-search.test.ts
  • src/renderer/src/lib/worktree-palette-document.ts
  • src/renderer/src/lib/worktree-palette-multi-keyword.test.ts
  • src/renderer/src/lib/worktree-palette-search.test.ts
  • src/renderer/src/lib/worktree-palette-search.ts
  • src/renderer/src/lib/worktree-palette-task-url-result.ts
🚧 Files skipped from review as they are similar to previous changes (60)
  • src/renderer/src/components/worktree-jump-palette-browser-simulator-rows.tsx
  • src/renderer/src/lib/palette-match/palette-ranking.test.ts
  • src/renderer/src/lib/workspace-tab-agent-snippet-match.ts
  • src/renderer/src/lib/palette-match/palette-match-budget.ts
  • src/renderer/src/lib/workspace-tab-agent-metadata.test.ts
  • src/renderer/src/lib/palette-match/palette-match-rendering.ts
  • src/renderer/src/lib/palette-match/indexed-field.ts
  • src/renderer/src/lib/worktree-palette-document.ts
  • src/renderer/src/components/worktree-jump-palette-interleaved-sections.test.tsx
  • src/renderer/src/hooks/use-palette-search-evaluation-context.test.ts
  • src/renderer/src/components/use-worktree-jump-palette-controller.ts
  • src/renderer/src/lib/simulator-palette-active-tab.ts
  • src/renderer/src/hooks/use-palette-search-evaluation-context.ts
  • src/renderer/src/components/worktree-jump-palette-open-tab-items.ts
  • src/renderer/src/components/cmd-j/palette-section-render-cap.test.ts
  • src/renderer/src/lib/file-preview.test.ts
  • src/renderer/src/components/use-worktree-jump-palette-worktrees.ts
  • src/renderer/src/components/use-worktree-jump-palette-open-tabs.ts
  • src/renderer/src/lib/worktree-palette-task-url-result.ts
  • src/renderer/src/lib/cmd-j-section-leadership.test.ts
  • src/renderer/src/lib/simulator-tab-palette-activation.test.ts
  • src/renderer/src/components/tab-bar/TabBarCreateEntryRow.tsx
  • src/renderer/src/lib/simulator-palette-search.test.ts
  • src/renderer/src/components/WorktreeJumpPalette.recent-tabs.behavior.test.tsx
  • src/renderer/src/lib/worktree-palette-multi-keyword.test.ts
  • src/renderer/src/lib/workspace-tab-palette-activation.test.ts
  • src/renderer/src/lib/palette-match/match-field-allocation.test.ts
  • src/renderer/src/components/tab-bar/TabBarCreateEntry.tsx
  • src/renderer/src/components/worktree-jump-palette-worktree-row.tsx
  • src/renderer/src/components/worktree-jump-palette-workspace-tab-row.tsx
  • src/renderer/src/lib/browser-page-palette-activation.ts
  • src/renderer/src/components/tab-bar/use-open-tab-search.ts
  • src/renderer/src/lib/browser-page-palette-activation.test.ts
  • src/renderer/src/components/cmd-j/palette-section-render-cap.ts
  • src/renderer/src/lib/palette-match/palette-match-core.test.ts
  • src/renderer/src/lib/browser-palette-search.ts
  • src/renderer/src/lib/workspace-tab-palette-activation.store.test.ts
  • src/renderer/src/lib/worktree-palette-search.test.ts
  • src/renderer/src/lib/palette-match/tab-match.ts
  • src/renderer/src/lib/worktree-palette-search.ts
  • src/renderer/src/lib/workspace-tab-agent-metadata.ts
  • src/renderer/src/components/tab-bar/TabBarCreateEntry.tab-results.test.tsx
  • src/renderer/src/lib/browser-workspace-tab-activation.ts
  • src/renderer/src/lib/palette-match/tab-document.ts
  • src/renderer/src/lib/workspace-tab-palette-results.ts
  • src/renderer/src/components/WorktreeJumpPalette.recent-tabs.test.tsx
  • src/renderer/src/lib/palette-match/palette-ranking.ts
  • src/renderer/src/lib/workspace-tab-palette-entry-builder.ts
  • src/renderer/src/lib/cmd-j-section-leadership.ts
  • src/renderer/src/lib/palette-match/palette-query.ts
  • src/renderer/src/components/worktree-jump-palette-primitives.tsx
  • src/renderer/src/components/use-worktree-jump-palette-sections.ts
  • src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx
  • src/renderer/src/components/WorktreeJumpPalette.test.tsx
  • src/renderer/src/components/tab-bar/open-tab-search.test.ts
  • src/renderer/src/lib/simulator-palette-search.ts
  • src/renderer/src/components/tab-bar/use-tab-create-entry-search-results.ts
  • src/renderer/src/lib/palette-match/cmd-j-ranking-contract.test.ts
  • src/renderer/src/components/tab-bar/open-tab-search.ts
  • src/renderer/src/lib/workspace-tab-palette-results.test.ts

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


📝 Walkthrough

Walkthrough

The change introduces shared palette ranking, activity, and identity helpers. Search engines now return encoded host-qualified identities, secondary matches, alias matches, and activity ranks. Open-tab search supports field filtering and retained results during capping. Palette rows render additional matches for visual and assistive technology output. Activation paths validate worktree, unified-tab, and open-file ownership before state changes. Tests cover ranking, identity collisions, retention, rendering, activity, and activation behavior.

Merge Risk: ⚪ Minimal · up to 2f2fd

No concrete current-head correctness, security, data-integrity, or availability issue remains.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes the template headings but leaves the ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Review, Notes, and Checklist content incomplete. It does not explain the imp… Complete the required sections. Add the ELI5 summary, detailed changes, rationale, linked issue number, visual proof or an exact N/A explanation, testing steps and platform coverage, review notes, applicable compatibility considerations, an…
Docstring Coverage ⚠️ Warning Docstring coverage is 7.07% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 99 functions across 50 files. (31 skipped:… 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 identifies the main change: improving Cmd+J ranking behavior. It is concise and related to the changeset.
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: Description check

Explanation

The description includes the template headings but leaves the ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Review, Notes, and Checklist content incomplete. It does not explain the implementation, rationale, issue, validation steps, or visual impact.

Resolution

Complete the required sections. Add the ELI5 summary, detailed changes, rationale, linked issue number, visual proof or an exact N/A explanation, testing steps and platform coverage, review notes, applicable compatibility considerations, and checklist status.

Full details: Docstring Coverage

Explanation

Docstring coverage is 7.07% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 99 functions across 50 files. (31 skipped: 31 over the file limit.)

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

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

ℹ️ One minor cleanup — nothing blocking.

Reviewed changes

A large, careful rewrite of Cmd+J (and new-tab omnibox) ranking from a seven-key PaletteDocumentRank to a semantic-first scheme with activity bucketing, plus identity encoding to resolve cross-host collisions. Reviewed all 72 files (44 prod, 28 test) end to end.

  • Semantic-first rank schema — PaletteDocumentRank is now destination/recovery/wordMatch/coverage/strength/placement; match-document.ts builds per-token candidates with those metrics and delegates winner selection to the new palette-assignment-ranking.ts (lexicographic maximin over metrics, per-field/per-evidence/recognized-identifier assignments ranked together).
  • Activity bucketing — new palette-ranking.ts buckets recency and threads a PaletteSearchContext through every engine so ties break on ageBucket → placement → timestamp → position → identity.
  • Identity encoding — encodePaletteIdentity length-prefixes host/worktree/tab parts; activation paths now reject ambiguous child ids and pass { worktreeId } to activateTab.
  • Render-cap retention — capPaletteSection/layoutMultiPrimaryPaletteSections gain a retain predicate wired to selectedItemId and pinnedOptionId.
  • Secondary-match badges — rows carry secondaryMatches/typeAliasMatches and render a +N badge/tooltip.
  • Host-scoped ownership — isOpenFileOwnedByWorktree and host-qualified agent-metadata joins stop snippet/activity borrowing across same-id worktrees.

The contract tests (cmd-j-ranking-contract.test.ts, palette-ranking.test.ts, the "Atlas reference fixture" in workspace-tab-palette-results.test.ts) pin the new ordering precisely, and the perf budgets were updated to account for the additional selection work.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Comment thread .gitignore Resolved

@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

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: c5cc7086-70b8-4be8-82c2-765b53f8c2ad

📥 Commits

Reviewing files that changed from the base of the PR and between 64374d5 and 44114b9f08fa0fdc30a674e46e7818265404a6a8.

📒 Files selected for processing (72)
  • .gitignore
  • src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx
  • src/renderer/src/components/WorktreeJumpPalette.recent-tabs.behavior.test.tsx
  • src/renderer/src/components/WorktreeJumpPalette.recent-tabs.test.tsx
  • src/renderer/src/components/WorktreeJumpPalette.test.tsx
  • src/renderer/src/components/cmd-j/palette-section-render-cap.test.ts
  • src/renderer/src/components/cmd-j/palette-section-render-cap.ts
  • 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/open-tab-search.test.ts
  • src/renderer/src/components/tab-bar/open-tab-search.ts
  • src/renderer/src/components/tab-bar/use-open-tab-search.ts
  • src/renderer/src/components/tab-bar/use-tab-create-entry-search-results.ts
  • src/renderer/src/components/use-worktree-jump-palette-controller.ts
  • src/renderer/src/components/use-worktree-jump-palette-open-tabs.ts
  • src/renderer/src/components/use-worktree-jump-palette-sections.ts
  • src/renderer/src/components/use-worktree-jump-palette-worktrees.ts
  • src/renderer/src/components/worktree-jump-palette-browser-simulator-rows.tsx
  • src/renderer/src/components/worktree-jump-palette-interleaved-sections.test.tsx
  • src/renderer/src/components/worktree-jump-palette-open-tab-items.ts
  • src/renderer/src/components/worktree-jump-palette-primitives.tsx
  • src/renderer/src/components/worktree-jump-palette-workspace-tab-row.tsx
  • src/renderer/src/components/worktree-jump-palette-worktree-row.tsx
  • src/renderer/src/hooks/use-palette-search-evaluation-context.test.ts
  • src/renderer/src/hooks/use-palette-search-evaluation-context.ts
  • 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/browser-palette-search.ts
  • src/renderer/src/lib/browser-workspace-tab-activation.ts
  • src/renderer/src/lib/cmd-j-host-qualified-candidate-ownership.test.ts
  • src/renderer/src/lib/cmd-j-section-leadership.test.ts
  • src/renderer/src/lib/cmd-j-section-leadership.ts
  • src/renderer/src/lib/file-preview.test.ts
  • src/renderer/src/lib/palette-match/cmd-j-ranking-contract.test.ts
  • src/renderer/src/lib/palette-match/indexed-field.ts
  • src/renderer/src/lib/palette-match/match-document.ts
  • src/renderer/src/lib/palette-match/match-field-allocation.test.ts
  • src/renderer/src/lib/palette-match/palette-assignment-ranking.ts
  • src/renderer/src/lib/palette-match/palette-document.ts
  • src/renderer/src/lib/palette-match/palette-match-budget.ts
  • src/renderer/src/lib/palette-match/palette-match-core.test.ts
  • src/renderer/src/lib/palette-match/palette-match-performance.test.ts
  • src/renderer/src/lib/palette-match/palette-match-rendering.ts
  • src/renderer/src/lib/palette-match/palette-query.ts
  • src/renderer/src/lib/palette-match/palette-ranking.test.ts
  • src/renderer/src/lib/palette-match/palette-ranking.ts
  • src/renderer/src/lib/palette-match/tab-document.ts
  • src/renderer/src/lib/palette-match/tab-match.ts
  • src/renderer/src/lib/simulator-palette-active-tab.ts
  • src/renderer/src/lib/simulator-palette-search.test.ts
  • src/renderer/src/lib/simulator-palette-search.ts
  • src/renderer/src/lib/simulator-tab-palette-activation.test.ts
  • src/renderer/src/lib/simulator-tab-palette-activation.ts
  • src/renderer/src/lib/unified-tab-host-ownership.ts
  • src/renderer/src/lib/workspace-tab-agent-metadata.test.ts
  • src/renderer/src/lib/workspace-tab-agent-metadata.ts
  • src/renderer/src/lib/workspace-tab-agent-snippet-match.ts
  • src/renderer/src/lib/workspace-tab-palette-activation.store.test.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-entry-builder.ts
  • src/renderer/src/lib/workspace-tab-palette-results.test.ts
  • src/renderer/src/lib/workspace-tab-palette-results.ts
  • src/renderer/src/lib/workspace-tab-palette-search.test.ts
  • src/renderer/src/lib/worktree-palette-document.ts
  • src/renderer/src/lib/worktree-palette-multi-keyword.test.ts
  • src/renderer/src/lib/worktree-palette-search.test.ts
  • src/renderer/src/lib/worktree-palette-search.ts
  • src/renderer/src/lib/worktree-palette-task-url-result.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.

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

✅ No new issues found.

Reviewed changes

Re-reviewed the two commits pushed since the prior Pullfrog review (44114b9f0): the stable-identity ranking optimization and the hostless-tab ambiguity rejection.

  • Dropped the dangling .gitignore exception — removed !docs/reference/cmd-j-ranking.md, resolving the stale reference to the deleted design doc.
  • Optimized candidate selection — match-document.ts now carries the full PaletteIndexedField on each FieldHit and uses a precomputed proofIdentity; candidateMetricKey became a numeric mixed-radix encoding instead of a string join, eliminating findIndex lookups.
  • Rejected hostless tabs/files on ambiguous worktree IDs — workspace-tab-palette-activation.ts and browser-workspace-tab-activation.ts now compute findAmbiguousWorktreeIds and refuse hostless tabs/files when a worktree ID collides across hosts.
  • Fixed the +N badge accessibility — the secondary-match badge is now aria-hidden/tabIndex=-1 with an sr-only span, so extra matches read through the row's accessible name rather than a stray tab stop.

ℹ️ Simulator activation path still passes an empty ambiguity set

simulator-tab-palette-activation.ts still calls isUnifiedTabOwnedByWorktree(tab, worktree, new Set()) while the two sibling activation paths updated in this delta now compute findAmbiguousWorktreeIds. In principle a hostless (legacy) simulator tab whose worktree ID exists on multiple hosts would still be attributed instead of rejected there.

This is consistency/defense-in-depth rather than a live bug: both callers (open-tab-search-entries.ts and use-worktree-jump-palette-open-tabs.ts) build simulator entries through buildSearchableSimulatorTabs, which already filters hostless tabs by the ambiguous-worktree-id set, so the unguarded path is not reachable with such a tab today.

Technical details
# Simulator activation hostless ambiguity

## Affected sites
- src/renderer/src/lib/simulator-tab-palette-activation.ts:35 — passes `new Set()` to `isUnifiedTabOwnedByWorktree`

## Required outcome
- None required; informational. For symmetry with the other two activation paths, pass `findAmbiguousWorktreeIds(getIndexedAllWorktrees(state.worktreesByRepo))` here, mirroring `browser-workspace-tab-activation.ts`.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

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

ℹ️ One minor observation — no blocking issues.

Reviewed changes

Re-reviewed the single commit pushed since the prior Pullfrog review (4de7f5aaf): 4b2c5c0a adds token-count tiebreakers to PaletteDocumentRank and precomputes palette identities.

  • Token-count tiebreakers — PaletteDocumentRank gains containerOnlyTokenCount and recoveryTokenCount, folded into comparePaletteSemanticRank so fewer container-only or recovered tokens wins an equal-severity tie; the per-document winner selection moved to a new comparePaletteProofRank that excludes those aggregates.
  • Multi-candidate token proofs — TokenCandidates.visible is now a TokenCandidate[] covering every matching visible field, deduped by a mixed-radix candidateMetricKey via summarizeCandidates, instead of a single best candidate.
  • Precomputed identities — each engine's baseResult now computes paletteIdentity once rather than re-encoding it in the sort comparator; searchOpenTabCandidates/capOpenTabSearchCandidates were split out of searchOpenTabs so the hook can cap a memoized candidate list.
  • Hostless ambiguity closes the loop — simulator-tab-palette-activation now computes findAmbiguousWorktreeIds (resolving the prior informational note), and hasOpenFileExecutionHostEvidence extends ownership checks to files with explicit host evidence even on an unambiguous worktree ID.
  • Narrowed evaluation snapshots — useWorktreeJumpPaletteController and useOpenTabSearch now key the activity clock on query/visibility rather than every store slice, so the clock no longer churns on store updates.

The rank/leadership test helpers were updated for the two new rank fields, and the recoveryTokenCount tiebreak plus several hostless-rejection tests pin the new behavior.

ℹ️ Nitpicks

  • comparePaletteDocumentRank is no longer called from production code — cross-entity ordering goes through comparePaletteSemanticRank (inside comparePaletteEntityRanks) and winner selection through comparePaletteProofRank. cmd-j-ranking-contract.test.ts and palette-match-core.test.ts still assert ordering via comparePaletteDocumentRank, whose RANK_KEYS places placement immediately after strength, unlike production where it falls below the age bucket. Consider switching those tests to comparePaletteSemanticRank (or dropping comparePaletteDocumentRank if it's now redundant).

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

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

⚠️ Outside diff range comments (1)
src/renderer/src/lib/workspace-tab-palette-activation.ts (1)

83-85: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Select the target-owned OpenFile instead of rejecting duplicate IDs.

When state.openFiles contains multiple records for result.entityId, this guard returns missing-file before ownership selection, even when one record belongs to result.worktreeId. Mirror the entry builder: select the matching worktree record using the same isOpenFileOwnedByWorktree predicate, then validate that record. Add a test with duplicate IDs and one valid target owner.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: ff0f6818-8a97-488f-b277-2e88a5b2bd5a

📥 Commits

Reviewing files that changed from the base of the PR and between 4de7f5aaf0d2fb8e5b26629d8d1d604dc2daa7c8 and 4b2c5c0a81b481dcf06bdf60247d171d9991c0d3.

📒 Files selected for processing (25)
  • src/renderer/src/components/cmd-j/palette-section-render-cap.ts
  • src/renderer/src/components/tab-bar/open-tab-search.ts
  • src/renderer/src/components/tab-bar/use-open-tab-search.ts
  • src/renderer/src/components/use-worktree-jump-palette-controller.ts
  • src/renderer/src/components/use-worktree-jump-palette-sections.ts
  • src/renderer/src/lib/browser-palette-search.ts
  • src/renderer/src/lib/browser-workspace-tab-activation.test.ts
  • src/renderer/src/lib/browser-workspace-tab-activation.ts
  • src/renderer/src/lib/cmd-j-section-leadership.test.ts
  • src/renderer/src/lib/palette-match/match-document.ts
  • src/renderer/src/lib/palette-match/palette-assignment-ranking.ts
  • src/renderer/src/lib/palette-match/palette-document.ts
  • src/renderer/src/lib/palette-match/palette-match-performance.test.ts
  • src/renderer/src/lib/palette-match/palette-ranking.test.ts
  • src/renderer/src/lib/palette-match/tab-match.ts
  • src/renderer/src/lib/simulator-palette-search.ts
  • src/renderer/src/lib/simulator-tab-palette-activation.test.ts
  • src/renderer/src/lib/simulator-tab-palette-activation.ts
  • src/renderer/src/lib/unified-tab-host-ownership.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-entry-builder.ts
  • src/renderer/src/lib/workspace-tab-palette-results.test.ts
  • src/renderer/src/lib/workspace-tab-palette-results.ts
  • src/renderer/src/lib/workspace-tab-palette-search.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@AmethystLiang
AmethystLiang force-pushed the improve-cmd-j-ranking branch 3 times, most recently from e493c33 to 2f2fda5 Compare September 6, 2026 18:50
@coderabbitai

coderabbitai Bot commented Sep 6, 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.

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

ℹ️ No critical issues — one minor accessibility observation inline.

Reviewed changes

Re-reviewed the single commit pushed since the prior Pullfrog review (2f2fda5af1, "Centralize palette identity and unify host ownership resolution").

  • Centralized palette identity — paletteIdentity is now computed once per engine's baseResult (type prefixes unified to browser-page/workspace-tab/simulator-tab) and consumed directly as the item/open-tab id, replacing the ad-hoc encodePaletteIdentity calls scattered across consumers.
  • Unified host-ownership resolution — new getPaletteOwnershipWorktreeIds folds folder workspaces (via folderWorkspaceKey) into the ambiguity set, and every entry-builder and activation path now derives findAmbiguousWorktreeIds from it.
  • Added duplicate-id filtering — findDuplicateIds drops tabs, pages, and workspaces whose id appears more than once in the catalog, replacing the old "emit both / re-host the survivor" fallback with unambiguous rejection.
  • Refined ranking — containerOnly joined the per-candidate metric set (with a new total selection step), sourceOrder replaced the string proofIdentity, and compareSelectedSourceOrder now breaks otherwise-equal proofs; comparePaletteProofRank was removed in favor of comparePaletteDocumentRank plus source order.
  • Scoped recent-tab resolution — terminalTabsById became terminalTabsByWorktree, and occurrence identity now keys on item.id (the encoded palette identity) instead of a JSON-stringified tuple.

ℹ️ Evaluation-clock snapshot widened

The worktree-jump controller's paletteEvaluationSnapshot was widened from { query, visible } back to live store slices (openFiles, unifiedTabsByWorktree, browserPagesByWorkspace, retainedAgentsByPaneKey, sleepingAgentSessionsByPaneKey, …). Because usePaletteSearchEvaluationContext re-rolls nowMs on every snapshot change, this reverses the earlier narrowing introduced so the activity clock would not churn on store updates. Likely intentional (a fresh nowMs per data change keeps ageBucket current), but worth confirming the search re-run cost is acceptable.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

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

✅ No new issues found.

Reviewed changes

Re-reviewed the single commit pushed since the prior Pullfrog review (a83e61b11f → 3faac97f41, "Route same-target SSH worktrees through paired runtime owners").

  • Routed runtime-owned worktrees through their paired runtime — new getPaletteWorktreeExecutionHostId / getPaletteWorktreeIdentity prefer runtimeOwnerEnvironmentId (→ runtime:<owner>) over physical hostId, and every palette/search/activation call site that used getWorktreeHostIdentity now keys on the palette identity instead.
  • Kept same-target SSH worktrees distinct — dedupePaletteWorktrees (replacing getIndexedAllWorktrees in the ownership inventory) and a rebuilt buildPaletteWorktreeIndex (with an unambiguous physical-host-alias fallback) stop two runtime owners of one physical host from collapsing into a single row.
  • Simplified empty-query recent-tab ranking to focus recency — orderRecentWorkspaceTabs dropped the two-tier attention model (blocked/waiting promotion, focused-group MRU, worktree visit recency) in favor of a stable lastFocusedAt sort; attention now surfaces only through the live status dot.
  • Fixed the +N secondary-match badge accessibility — the badge left the tab order (aria-hidden / tabIndex={-1}) and the extra match texts now read through an sr-only span in the row's accessible name.

ℹ️ Recent-tab ranking no longer promotes attention

The empty-query "Recent chats & terminals" section now ranks purely by lastFocusedAt, so a freshly blocked or permission-requiring terminal is no longer hoisted above recently-focused idle tabs — that signal survives only as the status dot. This is clearly deliberate (the ranking tests were rewritten to pin the new order, and lastFocusedAt was already the documented recency source in tabs-create-actions.ts), but it is a user-facing behavior change that neither the commit message nor the PR description mentions (the What Changed / Why sections are still empty).

Technical details
# Recent-tab ranking simplification is undocumented

## Affected sites
- src/renderer/src/lib/recent-workspace-tab-rows.ts:104 — `orderRecentWorkspaceTabs` now sorts by `lastFocusedAt` only
- src/renderer/src/components/use-worktree-jump-palette-recent-tabs.ts:65 — builds the `tabFocusTimes` map that feeds that sort

## Required outcome
- None required; informational. Add a one-line note to the PR body so the ranking change isn't a surprise to reviewers, or confirm the demotion of attention is intentional.

ℹ️ Nitpicks

  • resolveRecentWorkspaceTabAttention in src/renderer/src/lib/recent-workspace-tab-rows.ts is now dead — its only caller was the removed attention branch of orderRecentWorkspaceTabs. resolveRecentWorkspaceTabStatus (still used) inlines the same attention resolution, so the orphaned export can be dropped.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@AmethystLiang
AmethystLiang force-pushed the improve-cmd-j-ranking branch 2 times, most recently from b07ebad to 71e19bc Compare September 6, 2026 21:58

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

✅ No new issues found.

Reviewed changes

This run re-reviewed the rebase of the branch onto current main, which pulled in the already-merged Seed Cmd-J filter from sidebar scope (#19036) and reconciled the palette's recent-tab ordering with it.

  • Reconciled recent-tab ordering with the sidebar-scope filter — the rawFilter/setRawFilter + filterActive boolean gave way to the seeded filter/setFilter state, and the palette's recentTabSnapshot state refactor was merged with the capturedFilterRef guard so a filter change mid-open re-captures the recent order instead of hiding rows a cleared chip brought back.
  • Moved filter reset into the open path — setRawFilter(EMPTY_PALETTE_FILTER) on open is gone; filter seeding from the sidebar scope now lives in useWorktreeJumpPaletteLocalState (re-seeded on each open), and the visible/unused-import plumbing was tidied.

The reconciliation is clean: no dangling references to the old filter API remain, and the recentTabSnapshot + capturedFilterRef interaction preserves the freeze-until-filter-change semantics.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Replaces the old score-based ranking with a semantic-first contract that
compares destination, recovery, word match, coverage, strength, and placement
before using age buckets and recency to break ties. Adds explicit field roles
(primary, secondary, alias, container), identity encoding, and activity-based
bucketing so recent activity never overrides semantic relevance. Removes the
substring-elision deduplication of secondary fields. This fixes the fixture
where titles like "atlas-follow-up.md" beat recently active "Clarify Atlas
action items".
- Structured identity encoding for consistent ID handling
- Badge+tooltip reduces clutter of additional secondary matches
- Reorder activation to refocus group after state updates
- Use composite keys (executionHostId, worktreeId, tabId) to uniquely identify tabs
- Validate tab accessibility before activation to prevent mutation on invalid state
- Extract getActivatableBrowserWorkspaceTab for consistent browser workspace validation
- Refactor workspace tab validation with stricter collision and ownership checks
- Remove unused comparePaletteActivity and mergeCandidateSummaries functions
Replace manual command-item ID construction with encodePaletteIdentity()
to include host and worktree context, ensuring tests match the encoding
scheme. Also adjust component styling (flex-1→flex-auto) and make
HighlightedText highlight class customizable for secondary match badges.
- Add proofIdentity field to enable consistent tiebreaking in matches
- Pass field objects in FieldHit instead of fieldId strings
- Encode metric keys as numbers via bitwise operations
- Eliminate document lookups for field coverage calculation
When worktree IDs collide across hosts, hostless tabs cannot be safely
attributed. Refuse activation to prevent accidental host switching.

Improve badge accessibility by keeping it out of tab order and
exposing secondary matches through screen reader text only.
Add containerOnlyTokenCount and recoveryTokenCount fields to distinguish
entities when match quality is equal, enabling better ranking of results
that rely on container fields or recovery mechanisms. Cache paletteIdentity
in search results to avoid repeated encoding during sorting. Extract omnibox
field filtering and open-tab capping into reusable functions. Optimize
evidence-unit iteration to only process matched units. Strengthen worktree
ambiguity checks to reject hostless tabs when IDs collide across hosts.
- Document why capPaletteSection retains the selected match
- Explain retainedResultId's role in keeping keyboard selection visible
- Clarify secondaryMatches exposes additional match offsets
- Compute palette identity at search result level instead of constructing ad-hoc
- Include folder workspaces in palette ownership via getPaletteOwnershipWorktreeIds
- Add duplicate detection to filter colliding tab, page, and file IDs
- Refine ranking with containerOnly metric and source-order tiebreakers
- Improve secondary matches badge accessibility for keyboard users
- Centralize worktree palette identity resolution via getPaletteWorktreeIdentity
  and getPaletteWorktreeExecutionHostId, which use runtimeOwnerEnvironmentId when
  present instead of physical hostId
- Deduplicate worktrees by palette identity to keep same-target SSH worktrees
  distinct when paired with different runtime environments
- Replace scattered getWorktreeHostIdentity calls with new palette-specific
  resolution functions across palette components and search logic
- Fix accessibility: move badge out of tab order, expose extra matches through
  row text instead of interactive tooltip
@AmethystLiang
AmethystLiang merged commit a224e2d into main Sep 6, 2026
4 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* Refactor Cmd+J ranking to semantic-first ordering with activity bucketin

Replaces the old score-based ranking with a semantic-first contract that
compares destination, recovery, word match, coverage, strength, and placement
before using age buckets and recency to break ties. Adds explicit field roles
(primary, secondary, alias, container), identity encoding, and activity-based
bucketing so recent activity never overrides semantic relevance. Removes the
substring-elision deduplication of secondary fields. This fixes the fixture
where titles like "atlas-follow-up.md" beat recently active "Clarify Atlas
action items".

* Encode palette IDs and display secondary matches as badge

- Structured identity encoding for consistent ID handling
- Badge+tooltip reduces clutter of additional secondary matches
- Reorder activation to refocus group after state updates

* Encode tab palette identities to resolve collisions across hosts and wor

- Use composite keys (executionHostId, worktreeId, tabId) to uniquely identify tabs
- Validate tab accessibility before activation to prevent mutation on invalid state
- Extract getActivatableBrowserWorkspaceTab for consistent browser workspace validation
- Refactor workspace tab validation with stricter collision and ownership checks
- Remove unused comparePaletteActivity and mergeCandidateSummaries functions

* Update palette identity tests to use encodePaletteIdentity

Replace manual command-item ID construction with encodePaletteIdentity()
to include host and worktree context, ensuring tests match the encoding
scheme. Also adjust component styling (flex-1→flex-auto) and make
HighlightedText highlight class customizable for secondary match badges.

* rm design doc

* Use stable field identity and field objects for ranking optimization

- Add proofIdentity field to enable consistent tiebreaking in matches
- Pass field objects in FieldHit instead of fieldId strings
- Encode metric keys as numbers via bitwise operations
- Eliminate document lookups for field coverage calculation

* Reject hostless tabs when worktree IDs are ambiguous

When worktree IDs collide across hosts, hostless tabs cannot be safely
attributed. Refuse activation to prevent accidental host switching.

Improve badge accessibility by keeping it out of tab order and
exposing secondary matches through screen reader text only.

* Improve cmd-j palette ranking with token-count tiebreakers and identity

Add containerOnlyTokenCount and recoveryTokenCount fields to distinguish
entities when match quality is equal, enabling better ranking of results
that rely on container fields or recovery mechanisms. Cache paletteIdentity
in search results to avoid repeated encoding during sorting. Extract omnibox
field filtering and open-tab capping into reusable functions. Optimize
evidence-unit iteration to only process matched units. Strengthen worktree
ambiguity checks to reject hostless tabs when IDs collide across hosts.

* Add clarifying comments to palette ranking retention logic

- Document why capPaletteSection retains the selected match
- Explain retainedResultId's role in keeping keyboard selection visible
- Clarify secondaryMatches exposes additional match offsets

* Centralize palette identity and unify host ownership resolution

- Compute palette identity at search result level instead of constructing ad-hoc
- Include folder workspaces in palette ownership via getPaletteOwnershipWorktreeIds
- Add duplicate detection to filter colliding tab, page, and file IDs
- Refine ranking with containerOnly metric and source-order tiebreakers
- Improve secondary matches badge accessibility for keyboard users

* Route same-target SSH worktrees through paired runtime owners

- Centralize worktree palette identity resolution via getPaletteWorktreeIdentity
  and getPaletteWorktreeExecutionHostId, which use runtimeOwnerEnvironmentId when
  present instead of physical hostId
- Deduplicate worktrees by palette identity to keep same-target SSH worktrees
  distinct when paired with different runtime environments
- Replace scattered getWorktreeHostIdentity calls with new palette-specific
  resolution functions across palette components and search logic
- Fix accessibility: move badge out of tab order, expose extra matches through
  row text instead of interactive tooltip

* fix static analysis
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