Skip to content

fix(agent-launch): find a repo's project the way the window does - #28237

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/conv-c1-s5-project-repo-id
Oct 15, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
brennanb2025/conv-c1-s5-project-repo-id

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 0
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1

ELI5

Orca's window and its background service each look up which project a repo belongs to, to read that project's runtime setting (Windows or WSL). The window takes a project that lists the repo, or a project whose id is the repo's id. The background service only takes one that lists the repo. With unusual saved data the two can pick different projects, and then a launch from the window and one from the background service can run in different places. This PR makes the background service look it up the way the window does.

What Changed

Built on #28236, now merged into main (941a0f2); this PR targets main. #27692 kept main's lookup; this PR replaces it. Last PR of the #27692 split.

The problem. Only for saved data where a project's id equals a repo's id but that project no longer lists the repo (for example after the repo was moved to another project by hand). There, the window reads the first project's runtime and the background service the second's. Projects Orca builds itself from repos have ids like repo:<id>, github:… or git:…, never a bare repo id, and always list their repo, so normal data never hits this.

Before → after. For that data, agents the background service starts (and the agent list) use the same project's runtime the window uses. Nothing else changes.

Mechanism. A new projectMatchesRepo (src/shared/project-repo-match.ts) says whether a project is a repo's project: named after the repo, or listing it as a source repo. resolveLocalWorkspaceRuntime (local-project-runtime-resolution.ts) now uses it, and so does the window's getLocalRuntimeProject (src/renderer/src/lib/local-preflight-context.ts), which keeps its extra project-id check around it. So the window and the background service share one match instead of two copies; the window's behaviour does not change.

Why

The launch-convergence plan has the background service read like the window, so both sides always agree on where an agent runs. Sharing the window's match is the smallest way that leaves one definition; changing the window to drop its id match would change the window, which this step doesn't touch. Other host lookups still match by source repos only (plain terminals, allowed roots, worktree probes, the phone's runtime); moving them onto projectMatchesRepo changes their behaviour and is a follow-up.

Size. Production +11 −4 (net +7: the shared matcher file and its two callers), tests +3 −3 (net 0).

Linked Issue

Part of the launch-convergence plan (split out of #27692).

Visual Proof

N/A: no UI; affects only hand-made project data, described above.

Testing

Run on this branch: tc:node, tc:web and tc:cli pass; Vitest on 45 named files (every test that imports a module the launch-split touched, the agent-launch request tests and the launch characterization suites): 607 tests pass; orca-ci-checks --no-typecheck is clean except its typecheck:ci step, which fails to start under bun locally ("Script not found check"); the typechecks above cover it, and CI runs it.

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change 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

  • SSH: unchanged (remote repos have no local project runtime).
  • Wire: no change.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason (no new UI)
  • 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)

@brennanb2025
brennanb2025 force-pushed the brennanb2025/conv-c1-s4-opencode-wsl-model branch from 35fdb7d to 5929f98 Compare October 13, 2026 09:40
@brennanb2025
brennanb2025 force-pushed the brennanb2025/conv-c1-s5-project-repo-id branch from c4658e8 to 266fdf1 Compare October 13, 2026 09:40
@brennanb2025

brennanb2025 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Status: ready for review (head 33f50e7, base main)

#28236 is merged (941a0f2). This PR had its one rebase onto main (patch identical), then one new commit: the window and the background service now share one projectMatchesRepo instead of two copies of the match (no behaviour change on either side). Last PR of the #27692 split.

Review. Part of the split of #27692 (one thing per PR). A review of the whole stack found nothing in this PR: it does one thing, its description matches its diff, and its test was run on this PR (passes) and against the PR below (fails).

Not exercised live: it needs hand-made project data (a project named after a repo that no longer lists it). Covered by its test.

CI: green on 33f50e7 against main, including the required "PR checks passed"; no open review threads (the CodeRabbit note about other lookups is answered: moving them onto the shared match is a follow-up). Re-checked: node and web typechecks, its tests, the neighbouring launch tests and the window's launch-preflight tests (63) pass, and the launch runtime rule is unchanged from main.

Not verified: macOS, Linux and SSH hosts live (nothing changes there).

@brennanb2025
brennanb2025 marked this pull request as ready for review October 13, 2026 10:38
@brennanb2025
brennanb2025 force-pushed the brennanb2025/conv-c1-s4-opencode-wsl-model branch from 5929f98 to 6a055cc Compare October 14, 2026 19:14
@brennanb2025
brennanb2025 changed the base branch from brennanb2025/conv-c1-s4-opencode-wsl-model to main October 14, 2026 20:13
The host now also takes a project named after the repo as that repo's project, as the window
does, so both pick the same project row and runtime even when a repo was moved out of the
project named after it.
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 30203cf8-36f2-4363-961e-4e091f21cc12
📥 Commits

Reviewing files that changed from the base of the PR and between 266fdf1 and 33f50e7.

📒 Files selected for processing: 4
  • src/main/local-project-runtime-resolution.ts
  • src/main/runtime/agent-launch-scope-runtime.test.ts
  • src/renderer/src/lib/local-preflight-context.ts
  • src/shared/project-repo-match.ts

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

📝 Walkthrough

A shared projectMatchesRepo function matches a project when its ID equals the repository ID or its sourceRepoIds list contains that ID. Local runtime resolution and local preflight use the function. A runtime test changes its expected platform for a project matched by ID.

Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to 33f50

With unusual saved project data, agents and related Git/worktree operations can use different runtimes. Resolve or explicitly accept this mismatch before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 54.55% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 44 functions across 50 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
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.
Title check Passed The title clearly and concisely describes the main change: aligning background-service repository project lookup with the window’s lookup.
Description check Passed The description is mostly complete. It explains the problem, user-visible behavior, implementation, rationale, testing, visual impact, scope, and checklist status. It references issue #27692, but it d…
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • 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

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


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d96a5140-e86b-422f-95cb-6a780502f438
📥 Commits

Reviewing files that changed from the base of the PR and between 941a0f2 and 266fdf1.

📒 Files selected for processing: 50
  • src/main/ipc/pty-launch-parity-host.test-cases.ts
  • src/main/ipc/pty/runtime/spawn-preflight.ts
  • src/main/ipc/pty/runtime/spawn-state.ts
  • src/main/local-project-runtime-resolution.ts
  • src/main/opencode/opencode-model-startup-plan.test.ts
  • src/main/preflight/workspace-agent-detection.test.ts
  • src/main/runtime/agent-launch-scope-runtime.test.ts
  • src/main/runtime/agent-launch-scope-runtime.ts
  • src/main/runtime/opencode-wsl-folder-launch-host.test.ts
  • src/main/runtime/orca-runtime-activate-managed-worktree.ts
  • src/main/runtime/orca-runtime-create-agent-session.ts
  • src/main/runtime/orca-runtime-create-managed-worktree.ts
  • src/main/runtime/orca-runtime-create-runtime-owned-mobile-session-terminal.ts
  • src/main/runtime/orca-runtime-create-terminal-dependencies.ts
  • src/main/runtime/orca-runtime-create-terminal.ts
  • src/main/runtime/orca-runtime-get-agent-session-execution-namespace.ts
  • src/main/runtime/orca-runtime-get-terminal-interactive-wait.ts
  • src/main/runtime/orca-runtime-perform-mobile-session-pty-records-refresh.ts
  • src/main/runtime/orca-runtime-resolve-mobile-session-terminal-command.ts
  • src/main/runtime/orca-runtime-resolve-worktree-removal-target.ts
  • src/main/runtime/orca-runtime-restore-structured-agent-session-tabs-once.ts
  • src/main/runtime/orca-runtime-run-create-mobile-session-terminal.ts
  • src/main/runtime/orca-runtime-terminal-create-deduplication.ts
  • src/main/runtime/qoder-terminal-command-resolution.ts
  • src/main/runtime/rpc/errors.ts
  • src/main/runtime/rpc/methods/agent-launch-execution-outcome.ts
  • src/main/runtime/rpc/methods/agent-launch-failure-code.ts
  • src/main/runtime/rpc/methods/agent-launch-pane-reservation.test.ts
  • src/main/runtime/rpc/methods/agent-launch-replay.ts
  • src/main/runtime/rpc/methods/agent-launch.ts
  • src/main/runtime/runtime-agent-launch-resolution.ts
  • src/main/runtime/runtime-agent-terminal-startup.test.ts
  • src/main/runtime/runtime-agent-terminal-startup.ts
  • src/main/runtime/runtime-folder-worktree-create.ts
  • src/main/runtime/runtime-local-worktree-terminal-startup.ts
  • src/main/runtime/runtime-pty-controller-contract.ts
  • src/main/runtime/runtime-terminal-contracts.ts
  • src/main/runtime/runtime-worktree-agent-startup.test.ts
  • src/main/runtime/runtime-worktree-agent-startup.ts
  • src/main/runtime/terminal-shell-override-host-support.test.ts
  • src/main/runtime/terminal-shell-override-host-support.ts
  • src/renderer/src/components/settings/ProjectWindowsRuntimeSetting.tsx
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/project-runtime-repair-message.test.ts
  • src/renderer/src/lib/launch-agent-background-session.ts
  • src/shared/agent-launch-runtime.ts
  • src/shared/agent-startup-plan-inputs-extra-agent-args.test.ts
  • src/shared/agent-startup-plan-inputs.test.ts
  • src/shared/agent-startup-plan-inputs.ts
  • src/shared/project-runtime-repair-message.ts
💤 Files with no reviewable changes: 1
  • src/main/runtime/qoder-terminal-command-resolution.ts

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

The host's agent-launch lookup and the window's launch preflight now call one projectMatchesRepo
instead of each writing the match out. No behaviour change on either side.
@brennanb2025
brennanb2025 force-pushed the brennanb2025/conv-c1-s5-project-repo-id branch from 266fdf1 to 33f50e7 Compare October 14, 2026 23:46
@brennanb2025
brennanb2025 merged commit d78363a into main Oct 15, 2026
32 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/conv-c1-s5-project-repo-id branch October 15, 2026 00:54
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