Repository navigation
fix(agent-launch): find a repo's project the way the window does - #28237
Conversation
35fdb7d to
5929f98
Compare
c4658e8 to
266fdf1
Compare
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 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). |
5929f98 to
6a055cc
Compare
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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🟡 Moderate · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
d96a5140-e86b-422f-95cb-6a780502f438
📒 Files selected for processing: 50
src/main/ipc/pty-launch-parity-host.test-cases.tssrc/main/ipc/pty/runtime/spawn-preflight.tssrc/main/ipc/pty/runtime/spawn-state.tssrc/main/local-project-runtime-resolution.tssrc/main/opencode/opencode-model-startup-plan.test.tssrc/main/preflight/workspace-agent-detection.test.tssrc/main/runtime/agent-launch-scope-runtime.test.tssrc/main/runtime/agent-launch-scope-runtime.tssrc/main/runtime/opencode-wsl-folder-launch-host.test.tssrc/main/runtime/orca-runtime-activate-managed-worktree.tssrc/main/runtime/orca-runtime-create-agent-session.tssrc/main/runtime/orca-runtime-create-managed-worktree.tssrc/main/runtime/orca-runtime-create-runtime-owned-mobile-session-terminal.tssrc/main/runtime/orca-runtime-create-terminal-dependencies.tssrc/main/runtime/orca-runtime-create-terminal.tssrc/main/runtime/orca-runtime-get-agent-session-execution-namespace.tssrc/main/runtime/orca-runtime-get-terminal-interactive-wait.tssrc/main/runtime/orca-runtime-perform-mobile-session-pty-records-refresh.tssrc/main/runtime/orca-runtime-resolve-mobile-session-terminal-command.tssrc/main/runtime/orca-runtime-resolve-worktree-removal-target.tssrc/main/runtime/orca-runtime-restore-structured-agent-session-tabs-once.tssrc/main/runtime/orca-runtime-run-create-mobile-session-terminal.tssrc/main/runtime/orca-runtime-terminal-create-deduplication.tssrc/main/runtime/qoder-terminal-command-resolution.tssrc/main/runtime/rpc/errors.tssrc/main/runtime/rpc/methods/agent-launch-execution-outcome.tssrc/main/runtime/rpc/methods/agent-launch-failure-code.tssrc/main/runtime/rpc/methods/agent-launch-pane-reservation.test.tssrc/main/runtime/rpc/methods/agent-launch-replay.tssrc/main/runtime/rpc/methods/agent-launch.tssrc/main/runtime/runtime-agent-launch-resolution.tssrc/main/runtime/runtime-agent-terminal-startup.test.tssrc/main/runtime/runtime-agent-terminal-startup.tssrc/main/runtime/runtime-folder-worktree-create.tssrc/main/runtime/runtime-local-worktree-terminal-startup.tssrc/main/runtime/runtime-pty-controller-contract.tssrc/main/runtime/runtime-terminal-contracts.tssrc/main/runtime/runtime-worktree-agent-startup.test.tssrc/main/runtime/runtime-worktree-agent-startup.tssrc/main/runtime/terminal-shell-override-host-support.test.tssrc/main/runtime/terminal-shell-override-host-support.tssrc/renderer/src/components/settings/ProjectWindowsRuntimeSetting.tsxsrc/renderer/src/i18n/en-runtime-required.jsonsrc/renderer/src/i18n/project-runtime-repair-message.test.tssrc/renderer/src/lib/launch-agent-background-session.tssrc/shared/agent-launch-runtime.tssrc/shared/agent-startup-plan-inputs-extra-agent-args.test.tssrc/shared/agent-startup-plan-inputs.test.tssrc/shared/agent-startup-plan-inputs.tssrc/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.
266fdf1 to
33f50e7
Compare
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:…orgit:…, 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'sgetLocalRuntimeProject(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
projectMatchesRepochanges 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
I manually tested these changes locally (not exercised live: it needs hand-made project data)
Automated tests added/updated
agent-launch-scope-runtime.test.ts: the test Host plans agent launches with the window's runtime rule and one runtime fact (C1) #27692 pinned to main's lookup (two projects, one named after the repo with WSL, one listing it with Windows host → Windows) is flipped: the window's match picks the WSL project.Run on this branch:
tc:node,tc:webandtc:clipass; 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-typecheckis clean except itstypecheck:cistep, 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
Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reason (no new UI)pnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)