Skip to content

[Bug] Worktree in a monorepo, can not see files and git changes #6357

Open

Description

@orca-discord-issues

Gabriel Gabriel via Discord

Why I'm using this setup
I open the container folder (with all related projects inside) so a single agent can work
across frontend + backend —or several related projects— at the same time, end-to-end in one
session. That's the main reason I went with the monorepo/project-group option instead of
opening each repo separately.

Also worth saying upfront: it's entirely possible this is on me and not the right way to
handle this situation. If so, I'd love to hear how you all handle this case (multiple related
repos that you want one agent to work across at once) — happy to change my workflow.

Environment

  • OS: macOS (Darwin 24.6.0)
  • Orca version: Current version: 1.4.98
  • Setup: a container folder ~/work/fint/fint that is NOT a git repo, with 4
    independent git repos inside: fint_api (master), fint-admin (p360), fint-portal (p360),
    fint-sales (main). On import, I accepted the option to treat it as a monorepo →
    it created a "project group" with a folder workspace.

Bug 1 — Diff viewer: selector_not_found on EVERY file
In the primary repo view (e.g. fint_api on master), Orca does list the git changes
(24 files: staged, unstaged and untracked), but opening the diff of any file —including
brand-new/created files— renders a single line:
Error loading diff: RuntimeRpcCallError: selector_not_found
It happens on 100% of files. (screenshot attached)

Bug 2 — File viewer: "Unable to load file / selector_not_found"
In the folder-workspace session, the git changes list shows up empty, and opening any file
from the file tree shows:
Unable to load file — selector_not_found (with a Retry button that doesn't help).
e.g. .../fint-portal/.eslintrc.json. (screenshot attached)
image.pngimage.pngimage.png

Activity

  1. added
    bug
    on Jun 25, 2026
  2. orca-discord-issues commented on Jun 25, 2026

    @orca-discord-issues
    Author

    Gabriel Gabriel via Discord

    Bug 3 — The folder workspace didn't isolate changes into worktrees
    The folder-workspace task ran with cwd = the original imported folder
    (~/work/fint/fint), so the agent edited directly on each repo's primary branch
    (master / p360 / p360 / main) instead of creating isolated worktrees. For contrast, a
    per-repo task DID create a real worktree at
    ~/orca/workspaces/fint_api/import-de-pagos-.... I expected a folder workspace to create
    one worktree per repo and leave the primary branches untouched.

    Steps to reproduce

    1. Have a folder that is NOT a git repo, with ≥2 independent git repos inside.
    2. Import it into Orca and accept treating it as a monorepo/project group.
    3. Run a task (folder workspace) that modifies files across the repos.
    4. Open the diff of any file → Error loading diff: ... selector_not_found.
    5. Open any file from the file tree → Unable to load file / selector_not_found.
  3. orca-discord-issues commented on Jun 25, 2026

    @orca-discord-issues
    Author

    Gabriel Gabriel via Discord

    **Multi-repo project group: diff/file viewer fails with selector_not_found + folder workspac

  4. orca-discord-issues commented on Jun 25, 2026

    @orca-discord-issues
    Author

    Gabriel Gabriel via Discord

    Multi-repo project group: diff/file viewer fails with selector_not_found + folder workspace

  5. orca-discord-issues commented on Jun 25, 2026

    @orca-discord-issues
    Author

    Gabriel Gabriel via Discord

    I can open a GitHub issue if needed, but I also think I might be doing something wrong on my side, and it's not a bug jajaj , although the error messages are a bit weird.

  6. orca-discord-issues commented on Jun 25, 2026

    @orca-discord-issues
    Author

    Gabriel Gabriel via Discord

    Now I realized that that proyect is not working anymore for tracking the changes, I closed and reopened Orca again, but it is not working, so I will come back to Visual Studio Code to review the diffs for now
    image.png

  7. orca-discord-issues commented on Jun 25, 2026

    @orca-discord-issues
    Author

    Gabriel Gabriel via Discord

    Oh I realized all the projects are broken now jajaj, all the ideas and git diff are totally broken with the error Error loading diff: RuntimeRpcCallError: selector_not_found

  8. added
    size/l
    on Jun 25, 2026
  9. orca-discord-issues commented on Jun 25, 2026

    @orca-discord-issues
    Author

    Jinjing Jinjing via Discord

    hi Gabriel, thank you for the detailed report. will get it fixed asap!

  10. orca-discord-issues commented on Jun 25, 2026

    @orca-discord-issues
    Author

    Gabriel Gabriel via Discord

    <@1230924083454152794> Let me know if I can do something to help. If I create a new project, the IDEA and the diffs work, but all the previos proyects are "broken"

  11. orca-discord-issues commented on Jun 26, 2026

    @orca-discord-issues
    Author

    Brennan Brennan via Discord

    The idea for the multi-repo setup is to place the agents at the top directory, but instruct them to create worktrees in the sub-repos, where the real work should be done. I.e. top-level agents should not edit the working directory, it should create worktrees and edit them in there. Today, when it does that, you'll be able to see all of the child worktrees at a glance from the top-level workspace like in picture 1 and 2.

    However, we could try to make it so that when you create a new top-level workspace, it'll create new worktrees for every child and check those out by default.
    The large risk for this method is that your disk space may get filled up with unnecessary worktrees (but we'll do a good job cleaning them up 😀). Do you think that would suit your workflow <@411639035233304604> ?
    image.pngimage.png

  12. orca-discord-issues commented on Jun 26, 2026

    @orca-discord-issues
    Author

    Brennan Brennan via Discord

    I'll get those other issues fixed ASAP as well!

  13. orca-discord-issues commented on Jun 26, 2026

    @orca-discord-issues
    Author

    Gabriel Gabriel via Discord

    To be complety honest i was not working with worktrees before ORCA, i was always using the top directory and a specific branch on each repo, but now the idea of using a worktree for having agents working at the same projects on different things is hitting me jaja so i kind of like it, i woud love to have both options tough, maybe to create worktrees on each repo and also just work on the branch that each repo is on

  14. 8 remaining items

  15. nwparker commented on Jul 27, 2026

    @nwparker
    Contributor

    Repro status: cannot_repro as a single deterministic monorepo defect

    Reviewed multi-repo/project-group + selector_not_found surfaces. Synthetic multi-git folder under a non-git parent can be created, but full Orca project-group import + diff viewer path needs the live app session state the Discord thread describes (and later “all projects broken” may be a separate regression).

    Not able to pin a single failing selector from CLI alone on c3a9a5e8a6. Pending: minimal project-group export / exact worktree id that throws selector_not_found on latest.

  16. added
    pending_repro
    on Jul 27, 2026
  17. khdkkhdd commented on Jul 27, 2026

    @khdkkhdd

    Possibly relevant to the cannot_repro status: I hit the same selector_not_found symptom without any monorepo/folder-workspace setup, traced it to editor tabs being stamped with a remote runtimeEnvironmentId, and filed it separately with full analysis in #10859.

    It would also explain why this can't be reproduced from the CLI — RuntimeClient always talks to the local runtime, which resolves every selector fine. The failing requests are the ones routed to a paired remote environment carrying a local worktree selector, which only happens through the renderer's per-tab runtime owner.

  18. nwparker commented on Jul 28, 2026

    @nwparker
    Contributor

    👀 — picking this back up because of the "new movements" around #10819.

    The new activity is #10859, filed against mirrored editor tabs. It presents with the same selector_not_found symptom as this issue, so it's worth stating plainly whether it's the same bug: it isn't.

    I verified #10859's three claimed defects independently (details in my comment there) — all three reproduce. But the cause is disjoint from this one:

    Same error string, different mechanism. Fixing either leaves the other intact. I'd keep #10819 scoped to folder-workspace selector routing rather than widening it to cover the mirroring path — they'd need different fixes in different layers, and merging them would make #10819 much harder to review.

    Status of #10819: still draft, mergeable/clean at a0aceba6b3, 8 review rounds, code clean. Nothing in #10859 invalidates it. My read is that it's independently mergeable on its own merits whenever someone wants to take it off draft; #10859 should get its own fix.

    One related item from reviewing this area earlier: #10855, a real defect that reproduces on origin/main, which I filed rather than folding silently into #10819's diff.

  19. nwparker commented on Jul 28, 2026

    @nwparker
    Contributor

    Correcting my comment above: #10859's mechanism does reach Bug 1 here

    I said #10859 and this issue have disjoint causes and should stay fully separate. That's right for Bug 2 and wrong for Bug 1, and the distinction matters for how #10819 gets linked.

    The tell is in the report itself

    Bug 1: "Orca does list the git changes (24 files) … but opening the diff of any file" fails.
    Bug 2: "the git changes list shows up empty."

    A folder-workspace selector that can't be routed breaks status and diff together — that's Bug 2's signature, and that's what #10819 fixes. Bug 1 has status succeeding while diff fails 100% of the time, so something must be resolving ownership differently for the two calls.

    It is. Read from source:

    path ownership input
    git status getSettingsForWorktreeRuntimeOwner(store, worktreeId) — the workspace owner (file-explorer-runtime-owner.ts:5-12)
    file diff settingsForRuntimeOwner(activeSettings, file.runtimeEnvironmentId) — the per-tab stamp (useEditorPanelContentState.ts:243)

    Same asymmetry #10859 is about: one side derives ownership from real workspace state, the other trusts a per-tab runtimeEnvironmentId. When that stamp points at an environment lacking the worktree, status stays green off the workspace owner and every diff throws selector_not_found — Bug 1's exact surface, including the screenshot.

    So the two issues are not disjoint. They share the per-tab-stamp mechanism; #6357 additionally has a folder-workspace routing bug (Bug 2) that #10859 doesn't.

    What this changes for #10819

    #10819's Closes #6357 overclaims and should be Part of #6357. It fixes folder-workspace selector routing — six git RPCs (getRuntimeGitStatus, getRuntimeGitDiff, commitRuntimeGit, abortRuntimeGitMerge, abortRuntimeGitRebase, getRuntimeGitHistory) all throwing selector_not_found, reproduced locally with no networking. That's Bug 2, and it's a real fix worth shipping.

    But merging it as-is auto-closes this issue while Bug 1 — the headline symptom, the one with the screenshot — is still live. Bug 1 needs the ownership-translation work tracked in #10859.

    Also correcting a scoping detail from my earlier comment: #10819 does not touch only folder-workspace-*.ts and orca-runtime-git.ts; it substantially edits src/main/runtime/orca-runtime.ts as well.

    Suggested disposition

    • Retitle fix(git): route git operations for folder-workspace selectors #10819's linkage to Part of #6357 before merge, so this issue survives to cover Bug 1.
    • fix(git): route git operations for folder-workspace selectors #10819 otherwise stands on its own merits — my earlier read that it's independently mergeable is unchanged.
    • The pending_repro label can come off: two executed repro paths now exist — (1) any git RPC against a folder-workspace selector id:folder:<id>, and (2) an editor tab with non-null file.runtimeEnvironmentId pointing at a peer lacking the worktree while global activeRuntimeEnvironmentId is null, which reproduces status = OK 24 entries | diff = THREW selector_not_found.

    The two-resolver asymmetry above is read from source at the cited lines; the repro paths came from an adversarial reviewer that contradicted my earlier "disjoint causes" comment, and I verified the ownership split directly before posting rather than taking it on trust. Correcting my own comment above.

  20. nwparker commented on Jul 28, 2026

    @nwparker
    Contributor

    The CLI can reproduce this — RuntimeClient is not always local

    One correction on a point that's shaping how this gets triaged. From a comment above:

    It would also explain why this can't be reproduced from the CLI — RuntimeClient always talks to the local runtime, which resolves every selector fine.

    That isn't how the client works, and it's ruling out a working repro path.

    RuntimeClient's constructor reads a selector straight from the environment (src/cli/runtime/client.ts:37):

    environmentSelector = process.env.ORCA_ENVIRONMENT ?? null

    which feeds resolveRemotePairing(...) at :42, and isRemote at :45-47 is simply this.remotePairing !== null. So a plain new RuntimeClient() is remote whenever ORCA_ENVIRONMENT is set.

    Executed just now against the installed orca at /usr/local/bin/orca on this machine — same binary, same cwd, only the env var differs:

    $ orca status
    appRunning: true
    pid: 12350
    desktopWindowStatus: available
    exit=0
    
    $ ORCA_ENVIRONMENT=zz-nonexistent-env-9f3a orca status
    Unknown environment: zz-nonexistent-env-9f3a
    exit=1
    

    The selector is consulted before any local fallback. Point it at a real paired environment that lacks the worktree and you get the routing failure this issue is about, from the CLI, with no GUI involved.

    Worth noting the #10859 body already contains exactly this: driving the CLI and observing files.read local → OK versus ORCA_ENVIRONMENT=<peer> → selector_not_found. That's the same asymmetry, reported from the CLI.

    Why this matters for triage: "not reproducible from the CLI" makes this look GUI-specific and hard to isolate. It isn't — ORCA_ENVIRONMENT gives a scriptable repro with no Electron window, which should make both the fix and its regression test considerably easier.

    Both commands above were run against the installed public CLI and the outputs are verbatim; the source lines are read from src/cli/runtime/client.ts. Correcting a teammate's claim, not the issue report — the report itself is accurate.

  21. nwparker commented on Jul 28, 2026

    @nwparker
    Contributor

    Correcting my correction: Bug 1 is a routing-helper class, and #10859 is only one member of it

    My comment above says Bug 1 (status lists 24 files, every diff fails) is #10859's per-tab-stamp mechanism. An adversarial verifier refuted that, and after reproducing it myself I agree: the signature does not require a peer, a mirror, or #10859 at all.

    The control that settles it

    Driving the real getSettingsForWorktreeRuntimeOwner and the real settingsForRuntimeOwner:

    scenario status route diff route
    local repo, focused env-1, unstamped tab — no peer, no mirror LOCAL ✅ env-1 ❌
    #10859 shape: no focused env, tab stamped env-B LOCAL ✅ env-B ❌
    no focused env, unstamped tab LOCAL LOCAL
    legacy repo (null host), focused env-1, unstamped env-1 env-1

    Row 1 and row 2 are indistinguishable at the surface, and row 1 involves no second machine. So "status OK / every diff fails" is the fingerprint of a class of routing disagreements, not of #10859 specifically.

    The mechanism for row 1 is settingsForRuntimeOwner's undefined branch (runtime-client-target.ts:12-21): a null stamp forces LOCAL, but an undefined stamp falls through to the global focused runtime, while getSettingsForWorktreeRuntimeOwner resolves the same worktree to its actual owner. Any focused runtime env then sends diff remote while status stays local.

    Two more things I got wrong

    The status side does not use raw global settings. I implied a global-vs-owner split. Every production caller of refreshGitStatusForWorktree already passes owner-routed settings — SourceControl.tsx:1254 (getRepoOwnerRoutedSettings), useGitStatusPolling.ts:122 (getSettingsForWorktreeRuntimeOwner), SourceControl.tsx:1359 (captured runtimeTargetSettings). The only raw-global caller is WorkspaceSpaceManagerPanel.tsx:1354, a status-bar disk panel, not the sidebar list. git-status-refresh.ts itself takes settings as a parameter and never derives routing — citing it as a participant was wrong.

    The Source Control click path is immune. openDiff stamps getExplicitRuntimeEnvironmentIdForWorktree(...) ?? null (editor.ts:296-306), and that ?? null forces LOCAL — measured status=env-1 diff=LOCAL for a legacy repo under a focused env. The comment at that line says so explicitly ("null forces LOCAL, undefined would inherit the focused runtime → wrong host (#6957, #8484)"). So the exposed surface is edit-mode tabs in Changes view, stamped by openFile's fallback at editor.ts:1637-1644 (s.settings?.activeRuntimeEnvironmentId?.trim() ?? undefined) — not diffs opened by clicking a file in Source Control.

    What survives

    • The two-resolver asymmetry is real and is the cause of Bug 1's shape. That part of my comment stands.
    • #10819 should still be Part of #6357, not Closes. Unchanged and, if anything, stronger: Bug 1 has more possible causes than I credited, so auto-closing this issue on a Bug 2 fix is more clearly premature.
    • Bug 2 / folder-workspace routing — unchanged, and independently reproduced: all six git RPCs throw selector_not_found for id:folder:fw-1 because resolveRuntimeGitTarget (orca-runtime.ts:7154) omits the resolveFolderWorkspaceLaunchScope branch that resolveRuntimeFileTarget (:7173) has.

    What I should have said

    Bug 1 is not diagnosed. It is a status/diff routing divergence with at least two sufficient causes — a focused runtime env leaking into an unstamped edit-mode tab (no peer required), and #10859's peer stamp. Distinguishing them needs the reporter's actual state, which I don't have. My earlier "the tell is in the report itself" reasoning correctly identified that two resolvers disagree; it does not identify which disagreement.

    One more caveat worth recording: the reporter later says the diff error vanished without an update, which fits a transient focused-runtime state better than it fits a persistent stamp.

    I did not find this — an adversarial verifier refuted my own comment above. I reproduced the counter-hypothesis from scratch against the real helpers before posting; the table is my own executed output, scratch test deleted, worktree clean. Still have not run the diagnostic snippet from #10859's body.

  22. nwparker commented on Jul 28, 2026

    @nwparker
    Contributor

    A diagnostic that narrows Bug 1 without needing the reporter's state

    Following my correction above — Bug 1 has at least two sufficient causes and I can't distinguish them from the report — there is actually a discriminator sitting in the reported string itself.

    Bug 1's error text preserves the error class; Bug 2's does not.

    render site code class name survives?
    Bug 1 (diff) useEditorPanelContentState.ts:332 `Error loading diff: ${err}` yes — ${err} stringifies via Error.prototype.toString, which prefixes name
    Bug 2 (file) useEditorPanelContentState.ts:213 → EditorContent.tsx:90-113 err instanceof Error ? err.message : String(err) no — bare .message

    So Error loading diff: RuntimeRpcCallError: selector_not_found is meaningfully different from Error loading diff: Error: selector_not_found. RuntimeRpcCallError is constructed only in unwrapRuntimeRpcResult (runtime-rpc-result.ts:17) and exists nowhere outside src/renderer — so seeing it proves the call went out over RPC rather than local IPC.

    What that buys us. Every desktop-renderer git function short-circuits to local IPC before callRuntimeRpc (all 33 call sites sit behind target.kind === 'local' || !context.worktreeId, and those guards were already present at v1.4.98, the version in this report). A RuntimeRpcCallError therefore proves the diff call was environment-routed — which is precisely the routing divergence, and rules out a plain local failure that merely shares the message.

    Two limits, so this isn't oversold:

    1. It does not prove a per-file or per-worktree owner was set. The guard is an ||, and settingsForRuntimeOwner only forces LOCAL on an explicit null — undefined and '' both inherit the global. So the error proves global activeRuntimeEnvironmentId was non-empty and worktreeId was truthy, nothing more granular. That's consistent with the no-peer row of my table, not with a peer stamp specifically.
    2. It applies to Bug 1 only. Bug 2's "Unable to load file — selector_not_found" strips the class name, so a RuntimeRpcCallError and a plain new Error('selector_not_found') render identically there. Bug 2's string carries no remoteness signal at all.

    Concretely: if anyone can still reproduce Bug 1, the full text of the diff-pane error distinguishes the two causes I listed. RuntimeRpcCallError: present → an environment was focused and the diff was routed to it. Absent → a local failure sharing the message, and my routing analysis doesn't apply.

    Both render sites read at the cited lines; the class-name asymmetry follows from ${err} vs .message and I confirmed FileLoadErrorView renders message bare. The 33-call-site guard audit and the v1.4.98 check came from a verifier; I confirmed the two render sites and the RuntimeRpcCallError construction site directly.

  23. added
    has_repro
    and removed
    pending_repro
    on Jul 28, 2026
  24. orca-discord-issues commented on Aug 29, 2026

    @orca-discord-issues
    Author

    Brennan Brennan via Discord

    Thanks for the detailed feedback, I'm working on the fixes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bughas_reprosize/l

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions