Skip to content

fix: support worktree name selectors - #5696

Merged
Jinwoo-H merged 1 commit into
stablyai:mainfrom
wolfiesch:wolfiesch/fix-worktree-name-selector
Jun 19, 2026
Merged

Jinwoo-H merged 1 commit into
stablyai:mainfrom
wolfiesch:wolfiesch/fix-worktree-name-selector

Conversation

@wolfiesch

@wolfiesch wolfiesch commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds name:<displayName> support for worktree selector resolution, matching the repo selector grammar and letting commands like worktree 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 lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

Focused checks run:

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 exec vitest run --config config/vitest.config.ts src/main/runtime/orca-runtime.test.ts --testNamePattern "resolves (branch|name)|exact path selector"
pnpm exec vitest run --config config/vitest.config.ts src/cli/index.test.ts --testNamePattern "normalizes active/current worktree selectors"
pnpm run typecheck:node && pnpm run typecheck:cli
pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/orca-runtime.test.ts
pnpm run build:cli
node out/cli/index.js worktree show --help
node out/cli/index.js --help

Notes: pnpm install and script runs warned that this machine has Node v25.2.1 while package.json requests Node 24. pnpm run build:cli completed the CLI build and verification, then could not create /usr/local/bin/orca-dev because 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 return selector_ambiguous if multiple worktrees share a display name, consistent with existing selector resolution.


Open in Stage

Copilot AI review requested due to automatic review settings June 18, 2026 10:47
@ghost

ghost commented Jun 18, 2026 •

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 3 individual chapters for you:

Title
1 Implement worktree name selector resolution
2 Verify name selector resolution with tests
3 Update CLI help and documentation
Open in Stage

Chapters generated by Stage for commit 2e4d127 on Jun 18, 2026 11:46am UTC.

@coderabbitai

coderabbitai Bot commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR introduces name:<displayName> as a new worktree selector. In orca-runtime.ts, resolveWorktreeSelector gains a branch that matches worktrees by exact displayName equality when the selector uses the name: prefix. A corresponding Vitest case in orca-runtime.test.ts verifies this resolution path. CLI help text in help.ts (two locations) and the RuntimeClientError message in selectors.ts are updated to include name:<name> in the documented selector examples. The SKILL.md skill documentation is updated similarly.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: support worktree name selectors' clearly and specifically describes the main change, which is adding support for name: worktree selectors.
Linked Issues check ✅ Passed All coding requirements from issue #5695 are met: name: selector matching in resolveWorktreeSelector, regression tests added, and CLI/skill documentation updated.
Out of Scope Changes check ✅ Passed All changes are within scope of adding name: selector support: runtime implementation, test coverage, help documentation, and error messages are all directly related to #5695.
Description check ✅ Passed The pull request description comprehensively covers all required template sections with high-quality detail.

✏️ 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.

❤️ Share

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

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

🧹 Nitpick comments (1)
src/main/runtime/orca-runtime.ts (1)

13967-13968: ⚡ Quick win

Document why name: uses exact displayName matching.

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.md
  • src/cli/help.ts
  • src/cli/selectors.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.resolveWorktreeSelector to support name: selectors against worktree displayName.
  • Add a runtime regression test covering name: selector resolution.
  • Update CLI/help/skill docs to mention name: for --worktree selectors.

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.

Comment thread src/cli/selectors.ts Resolved
Comment thread src/cli/help.ts Resolved
Comment thread src/cli/help.ts Resolved
@wolfiesch
wolfiesch force-pushed the wolfiesch/fix-worktree-name-selector branch from 4917e8c to 2e4d127 Compare June 18, 2026 11:46
@wolfiesch

Copy link
Copy Markdown
Contributor Author

Addressed review comments in 2e4d127:

  • Added a runtime comment documenting exact displayName matching for name: selectors.
  • Changed CLI help/error examples from name:<name> to name:<displayName>.

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 --help

Same local notes as before: Node v25.2.1 emits package engine warnings for Node 24, and build:cli cannot create /usr/local/bin/orca-dev without elevated permissions after completing CLI build verification.

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

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.

@Jinwoo-H
Jinwoo-H merged commit 1d5efeb into stablyai:main Jun 19, 2026
6 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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.

Worktree name selectors return selector_not_found

3 participants