Repository navigation
fix: support worktree name selectors - #5696
Conversation
|
Ready to review this PR? Stage has broken it down into 3 individual chapters for you:
Chapters generated by Stage for commit 2e4d127 on Jun 18, 2026 11:46am UTC. |
📝 WalkthroughWalkthroughThe PR introduces 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/runtime/orca-runtime.ts (1)
13967-13968: ⚡ Quick winDocument why
name:uses exactdisplayNamematching.Please add a 1–2 line comment in this branch clarifying that exact equality is intentional for selector consistency/ambiguity handling; this behavior is non-obvious from the code alone.
Proposed patch
- } else if (selector.startsWith('name:')) { - candidates = worktrees.filter((worktree) => worktree.displayName === selector.slice(5)) + } else if (selector.startsWith('name:')) { + // Keep `name:` resolution exact (no fuzzy/case-insensitive match) so selector + // behavior stays deterministic and ambiguity handling remains consistent. + candidates = worktrees.filter((worktree) => worktree.displayName === selector.slice(5)) } else if (selector.startsWith('issue:')) {As per coding guidelines, "When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does."
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 2bcca74c-a077-4a2c-808b-8a421cdfb6e3
📥 Commits
Reviewing files that changed from the base of the PR and between e22d2c2 and 4917e8c26700ae500884d9dc5d5d6c289d1ae193.
📒 Files selected for processing (5)
skills/orca-cli/SKILL.mdsrc/cli/help.tssrc/cli/selectors.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.ts
There was a problem hiding this comment.
Pull request overview
Adds name:<displayName> to worktree selector resolution so CLI and runtime-routed commands can target a worktree by its display name, aligning worktree selectors with the existing repo selector grammar and fixing #5695.
Changes:
- Extend
OrcaRuntimeService.resolveWorktreeSelectorto supportname:selectors against worktreedisplayName. - Add a runtime regression test covering
name:selector resolution. - Update CLI/help/skill docs to mention
name:for--worktreeselectors.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/runtime/orca-runtime.ts | Adds name: selector handling when resolving worktree targets. |
| src/main/runtime/orca-runtime.test.ts | Adds a regression test ensuring name:<displayName> resolves correctly. |
| src/cli/selectors.ts | Updates remote-runtime error message to list name: as a valid server-side selector. |
| src/cli/help.ts | Updates top-level and per-flag help text to include name: for worktree selectors. |
| skills/orca-cli/SKILL.md | Documents name:<displayName> as a supported worktree selector. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4917e8c to
2e4d127
Compare
|
Addressed review comments in 2e4d127:
Verification rerun: pnpm exec oxfmt --check src/main/runtime/orca-runtime.ts src/cli/help.ts src/cli/selectors.ts
pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/orca-runtime.test.ts --testNamePattern "resolves name selectors against worktree display names"
pnpm run typecheck:node && pnpm run typecheck:cli
pnpm run build:cli
node out/cli/index.js worktree show --helpSame local notes as before: Node v25.2.1 emits package engine warnings for Node 24, and |
Jinwoo-H
left a comment
There was a problem hiding this comment.
Thanks Wolfie. I reviewed the selector path and verified it in a live dev runtime.
name:<displayName>resolves correctly for worktree lookup with a custom display name distinct from the branch.- The shared resolver path also works through terminal targeting.
- Missing-name behavior still returns
selector_not_found. - Checks passed locally: typecheck, lint, runtime tests, focused CLI/runtime tests, and CLI build.
Approving and merging.
Co-authored-by: Wolfgang Schoenberger <[email protected]>
Summary
Adds
name:<displayName>support for worktree selector resolution, matching the repo selector grammar and letting commands likeworktree show,terminal create, browser targeting, and file commands target a worktree by display name.Fixes #5695
Scope boundary
This is the first stable-selector slice for Agent Control Surface Parity (#5700) and the selector workstream (#5702). It does not complete control-surface parity. Broader target coverage, terminal/pane selectors, browser page/profile selectors, provider-session selectors, and remote-runtime selector safety remain tracked in #5702 and related workstream issues.
X handle: @wolfie_
Screenshots
No visual change.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildFocused checks run:
Notes:
pnpm installand script runs warned that this machine has Node v25.2.1 while package.json requests Node 24.pnpm run build:clicompleted the CLI build and verification, then could not create/usr/local/bin/orca-devbecause the symlink needs elevated permissions.AI Review Report
Reviewer pass. The review checked selector semantics, ambiguity behavior, regression coverage, and platform risks. It reported no Critical, Important, or Minor findings. Cross-platform review: this change compares display-name strings only and leaves existing path normalization, branch matching, shell behavior, shortcuts, labels, and Electron platform paths untouched.
Security Audit
Reviewed input handling and routing risk for the new selector branch.
name:is a selector string compared exactly against already-resolved worktree metadata; it does not execute commands, touch filesystem paths, alter auth, or change IPC trust boundaries. Existing ambiguous and not-found error behavior remains in place.Notes
name:matching is exact and can returnselector_ambiguousif multiple worktrees share a display name, consistent with existing selector resolution.