Repository navigation
Conversation
A folder workspace is a container directory that is not itself a git repo, with the real repos nested inside it. Every git op addressed to the workspace selector resolved against the container and failed with selector_not_found, so the Source Control list came up empty and every diff errored. Route path-addressed ops (diff, stage, unstage, discard) to whichever child repo owns the requested path, rebasing the path onto that repo. Bulk ops group their paths by owning repo so one request can span several repos, and reject the whole batch if any path is unowned rather than partially applying. Status has no path to route on, so it fans out across the child repos and merges their entries under workspace-relative paths — the same addressing the other ops then resolve. head/branch/upstream stay unset because no single child repo describes the workspace; every renderer consumer already treats them as optional. Fixes #6357
git.commit and the merge/rebase aborts carry no path, so the child-repo routing the rest of this PR uses had nothing to resolve against and they still failed with selector_not_found. That left the workspace Source Control able to list and stage files but not commit them — an affordance made reachable without being made to work. Commit fans out to every child repo with a staged index, which is exactly the set the merged status just showed the user as staged; repos with an empty index are skipped rather than reporting 'nothing to commit'. A partial failure names the repos that failed instead of collapsing to one blanket result. Abort targets only the child repos actually in that conflict state, so a no-op abort settles like it does for a single repo instead of erroring. Co-authored-by: Orca <[email protected]>
…d-bearing The two `..` tests both passed with the guard deleted: child repos are already filtered to those inside the folder root, so any path a match could accept is inside the folder anyway. Replace the tautological test with one that pins the real behavior (a `..` path normalizing back inside still routes) and label the guard as defense-in-depth against the candidate filter widening. Co-authored-by: Orca <[email protected]>
…allowing them A child repo whose status read fails silently vanished from the merged status (indistinguishable from clean) and from the commit set (a "success" that skipped staged files). A failed abort left a repo conflicted with no trail. Each now warns with the repo path. Also gives the test fixture a unique temp dir so concurrent runs stop rm -rf'ing each other mid-test. Co-authored-by: Orca <[email protected]>
The same directory can be registered twice (imported directly and picked up by a folder scan). Both copies fanned out, so the merged status listed every file twice and a commit ran against the repo twice. Also records the bulk-path grouping's real failure semantics: resolution is all-or-nothing, execution is not. Co-authored-by: Orca <[email protected]>
Round-1 findings closed — 4 commits since the last review
On MINOR 2 — the reviewer was right, and the first fix attempt was wrongDeleting the guard left 31/31 green, confirming the finding. My replacement test also passed with the guard deleted, so I probed instead of shipping it:
Regression evidence is now a measured comparison, not an assertionSame suite run at HEAD and at parent
+33 tests, zero new failures. Note for reviewers using this worktreeA Still draft — not for merge. |
…po instead of fanning out
Git has no cross-repo transaction. Fanning `git.commit` out across every staged
child repo could commit repos 1..k and fail on k+1, and neither {success,error}
nor {ok:true} can describe that half-done state. Three false-success paths came
out of it:
- an unresolvable or unreadable child was dropped to null and never reached the
summarizer, so another repo committed and the RPC returned success while the
user's staged files were never attempted
- a failed abort was logged and the method still returned {ok:true}, so the user
saw success on a still-conflicted repo
- merged status reported the first conflicted child's operation, offering one
abort button that silently meant whichever repo came first
Commit and abort now select exactly one child — by staged index and by live
conflict state respectively — and fail before mutating anything on 0, >1, or
any repo that could not be inspected. generateRuntimeCommitMessage routes the
same way; it previously threw selector_not_found for every folder workspace.
Also fixes deepest-first child ordering: it sorted on raw path length, so
\\wsl$\Ubuntu\work\repo\nested (30 chars) lost to its own ancestor
\\wsl.localhost\Ubuntu\work\repo (32) and the nested repo's files routed to
the ancestor. Sort on the normalized path instead.
Co-authored-by: Orca <[email protected]>
What the user seesThe two outcomes of the select-one policy. Rendered from the strings the code actually produces — not a live app capture, and I'd rather label that than imply I drove the real UI. Both strings are copied verbatim from Before this PR, both cases threw The right-hand case is the deliberate trade-off, not a limitation I overlooked: git has no cross-repo transaction, so a fan-out that commits repo 1 and then fails on repo 2 leaves a published commit that neither |
Fix proof — measured before/after, same suite run twiceBEFORE = the three impl files reverted to
16 tests flipped red → green. Every other behavioral row passed both times — the fix added routing without disturbing existing behavior.
31 rows are deliberately excluded from that table and from the flip count: they fail on main with Fixture: container
|
… index probe `getStatus` is built for display, and two of its display affordances make it wrong as a selection predicate: it catches a failed git read and resolves an empty result, and it caps entries at 1000. Under it, "no staged entry" means *not staged*, *unreadable*, or *truncated* — indistinguishable. Selection that cannot tell those apart commits a different child repo and reports success. Replace it for selection with `git diff --cached --quiet`: no entry cap, and a broken index exits 128 rather than looking clean. The abort path keeps reading `conflictOperation` from `getStatus` (its gitdir markers are the only reliable merge-vs-rebase discriminator — REBASE_HEAD survives a *completed* rebase) but now asserts the index is readable first, so an unreadable repo fails closed instead of handing the abort to a different one. Also route commit-message cancellation: generation re-enters by the child's own selector, so its cancel lane is keyed to that child's path. The folder selector resolved to no worktree and threw `selector_not_found`, and every caller is fire-and-forget — Cancel silently did nothing.
…robe Co-authored-by: Orca <[email protected]>
Round 4 resolved — all three MAJORs fixed in
|
| # | Finding | Confirmed at | Fix | Test |
|---|---|---|---|---|
| 1 | fail-closed never fired on a real status failure | status.ts:270-296 — catches a failed git read and resolves an empty result |
select on git diff --cached --quiet (rc 128 on a broken index) |
K6 |
| 2 | the 1000-entry cap could hide the staged file | status.ts:370 exposes didHitLimit; selection ignored it |
same probe — no entry cap | K7 |
| 3 | Cancel was silently dead | orca-runtime.ts:7168 bound straight through; folder selector → selector_not_found, callers fire-and-forget |
route to every child lane the selector could have started | M3 |
Measured, not assumed
Exit-code contract on real repos:
clean rc=0
staged rc=1
corrupt index rc=128 "fatal: .git/index: index file smaller than expected"
unborn HEAD + staged rc=1 (why not `diff --cached HEAD`, which errors here)
For #2, the cap only bites when >1000 entries sort ahead of the staged one. Built that fixture and measured it: the staged row lands at line 1201, outside the 1000-row window. See the image in the PR body.
Two things I got wrong and corrected
REBASE_HEAD is not a usable conflict probe. I intended to replace detectConflictOperation wholesale. Testing it against a real rebase-conflict fixture showed git rev-parse --verify REBASE_HEAD still returns rc=0 after the rebase completes — it would report a phantom rebase forever. So the abort path keeps getStatus for the merge-vs-rebase discriminator and adds the probe only for fail-loud (L5). Narrower change than planned, and correct.
My first K7 was a bad test. It staged all 1200 files, so a staged row still landed inside the cap — it passed under mutation, proving nothing. Rebuilt against measured git ordering, it now fails under mutation with success: false, which is the bug's actual signature: truncation makes the staged repo invisible, leaving zero candidates. The test also asserts its own premise (expect(rowIndex).toBeGreaterThan(1000)) so it can't silently stop exercising the cap.
Verification
- 2706 passed / 5 skipped / 0 failed across
src/main/runtime/(157 files); 56/56 in the three folder-workspace files - 3 mutations, 0 survivors — each kills exactly one test and nothing else, so no test is redundant
tsc -p config/tsconfig.node.jsonclean, oxlint clean- Git 2.25 baseline:
--quietimplies--exit-code, whose rc=1-on-differences contract predates git 2.x; the repo already uses the same idiom incommit-object-ref.tsandbranch-rename.ts - Cross-platform: the probe dispatches on
target.connectionIdlike every sibling op — SSH viaexecNonInteractive, native/WSL viagitExecFileAsyncwithlocalGitOptionsForTarget. On SSH a nullexitCode, timeout, or spawn error all throw rather than defaulting to 0, since defaulting would read as "nothing staged" — the exact false negative this module exists to prevent.
Still draft, not for merge.
…running in Cancel fanned out to every child repo in the workspace. Cancellation is keyed by cwd alone, with no notion of who asked, so a concurrent draft the user started from a sibling repo's own view was killed too — and the renderer keeps generation per-worktree precisely so navigating away does not cancel it, which makes that concurrent draft reachable rather than theoretical. Record the child selector each folder-workspace generation actually routed to and cancel only those. A stale Cancel with nothing in flight now signals no child at all, instead of acting as a kill switch for whatever runs there next.
Round-5 MAJOR — confirmed and fixed in
|
| link in the chain | evidence |
|---|---|
| the broadcast really does fan out | orca-runtime.ts mapped every listFolderWorkspaceChildRepos result to cancelRuntimeGenerateCommitMessage(id:…) |
| cancellation cannot tell callers apart | commit-message-text-generation.ts:515-535 — cancelTokensByLane keyed by localLaneKey('commit-message', cwd) only; the SSH side keys by (path, 'commit-message') |
| a concurrent sibling draft is reachable, not theoretical | SourceControl.tsx:1075 keeps generation state per-worktree with the comment "so navigating worktrees mid-generation never cancels the in-flight request" — that is precisely the state that survives navigating to the folder workspace |
So the doc comment's premise — "both cancel paths are cwd-keyed best-effort no-ops when nothing is in flight" — was only true when nothing else was in flight. It is exactly wrong in the case that matters.
Fix: record the child selector each folder-workspace generation actually routes to (folderWorkspaceCommitMessageLanes, keyed by normalized folder path, cleared in a finally), and cancel only those lanes. This also answers the original reason the broadcast existed — staging can move between generate and cancel, so re-selecting at cancel time can name the wrong repo. Remembering the lane sidesteps re-selection entirely.
Tests — you correctly noted M3 only spied routing and so could not see collateral cancellation. All three now hold a real in-flight generation open:
- M3 (rewritten) — cancel routes to exactly the lane generation started under
- M4 (new) — cancelling one child leaves a sibling untouched; each child carries a unique marker file so a routed selector can be named by repo
- M5 (new) — a stale Cancel with nothing in flight signals no child, so it can't act as a kill switch for whatever runs there next
Mutation-tested: restoring the pre-fix broadcast verbatim fails M3, M4 and M5 and nothing else (24 of 27 still pass).
Verification: 27/27 in the routing suite, 2708 passed / 5 skipped across all of src/main/runtime/, tsc -p config/tsconfig.node.json clean, oxlint clean.
Cross-platform: the lane key goes through normalizeRuntimePathForComparison, the same normalization the child-repo matcher already uses for WSL/UNC path spellings — no new platform assumption.
…-flight draft Co-authored-by: Orca <[email protected]>
Response — MAJOR confirmed and fixed in
|
…pace id and refcount Round-6 review found two ways the cancel-lane bookkeeping added in f5a11b3 could still reach the wrong draft. Keyed by container path, two folder workspaces that share a POSIX path on different SSH hosts collapse to one entry, so one host's Cancel resolves the other host's recorded child selector. FolderWorkspace already carries an `id`, which is host-unique, so key on that instead. Stored as a Set, two concurrent generations into the same child are one entry. The first to settle deletes it in its `finally` and the second draft is left with no lane at all — Cancel becomes a silent no-op. Refcount instead. M6 pins the multiplicity case, M7 pins the host-isolation case; each dies only under its own mutation.
Round 6 — all three findings verified at sourceTwo are this PR's regressions and are now fixed in ✅ Finding 2 — path keying conflates two SSH hosts — ACCEPTED, fixedCorrect. The lane map was keyed by container path, and two folder workspaces can share a POSIX path on different hosts (
- folderPath: folderWorkspace.folderPath,
+ folderWorkspaceId: folderWorkspace.id,Pinned by M7, which asserts the key list directly rather than probing a normalizer: expect([...lanes.keys()]).toEqual([FOLDER_WS_ID])
expect([...lanes.keys()].some((key) => key.includes(CONTAINER))).toBe(false)✅ Finding 3 —
|
| Mutation | Result |
|---|---|
Restore Set semantics (lanes.set(sel, 1) + unconditional delete) |
× M6 — 1 failed, 28 passed |
Restore path keying (folderWorkspace.folderPath) |
× M7 — expected [ Array(1) ] to deeply equal [ 'fw-1' ] — 1 failed, 28 passed |
M6 was also rewritten after it proved flaky on first authoring. The original awaited a named handle (await first) after releasing releases[0], but both generations resolve their target concurrently, so which one reaches the spy first isn't ordered — the release didn't reliably belong to the awaited promise. It now waits on releases reaching length 2 and awaits Promise.race, which pins "one has fully released its lane" without assuming an order. 3/3 clean runs in isolation.
Verification
folder-workspace-git-routing.test.ts— 29/29- Full
src/main/runtime/— 156 files, 2710 passed | 5 skipped tsc --noEmit -p config/tsconfig.node.json— cleanoxlint+oxfmt— clean
Cross-platform: no path-literal or separator logic added; the change actually removes a path-comparison dependency in favour of an opaque id, which is what makes the two-SSH-host case safe.
Perf: one Map lookup and one integer increment per generation, on a map bounded by open folder workspaces. Entries are deleted when the last lane drains, so no growth across sessions.
Still draft — not for merge.
|
Filed finding 1 as #10855 — it reproduces on the single-repo path too, so it's tracked independently of this PR. |
Round 7 — production logic clean; accepted the test-fidelity findingRound 7 found nothing wrong in ✅ MINOR — M7 asserted an implementation detail, not isolation — ACCEPTED, rewritten in
|
|
Follow-up: verified M7 is not vacuous. The obvious way the rewritten M7 could pass for the wrong reason is if Cancel through workspace B never reached the folder-workspace path at all — bailing out early would make A bail-out does not produce Probe removed; file restored to the committed state ( |
…'s spelling Round 7 was right that M7 asserted an implementation detail. It checked the lane map's key was the workspace id rather than a path, which holds any time the id is used as the key and says nothing about whether one workspace's Cancel can reach another's draft — there was only ever one workspace in the fixture to be isolated from. Now a second FolderWorkspace record shares the container path, and Cancel is driven through *it* while the first has a real generation in flight. Under path keying the mutation fails with `expected [Array(1)] to deeply equal []` — the other workspace's Cancel actually signalled the first one's child, which is the bug, rather than a key spelling mismatch. Two records sharing one folderPath is the cheapest fixture for that collision. A literal two-SSH-host version is reachable — project-group scoping keeps each host's repos out of the other's candidate set, so neither resolves ambiguous — but it would also need a registered IFilesystemProvider and faked remote git execution before staged-file detection ran, which buys no extra coverage of the lane keying this test is about. M6 also now asserts the refcount drains to zero once both generations settle.
c0d718c to
a0aceba
Compare
Round 8 — CLEAN on code; one NIT accepted against my commit messageRound 8 found no defect in the code. It independently reproduced both properties rather than taking my word for them, which is what I wanted from this round:
✅ NIT — my "not reachable" claim was an overclaim — ACCEPTED, commit message amendedThe reviewer is right and I was wrong. I claimed a literal two-SSH-host fixture was unreachable because With project-group scoping it does not. The practical conclusion stands — a working two-host M7 would additionally need a registered Amended as Loop status8 rounds. r3: 3 MAJORs → redesign · r4: 3 MAJORs · r5: 1 MAJOR (self-inflicted) · r6: 2 MAJORs (self-inflicted) + 1 declined as pre-existing (#10855) · r7: code CLEAN, 1 MINOR on test fidelity · r8: code CLEAN, 1 NIT on a commit message. The severity curve has flattened out — findings went from correctness bugs, to a test that proved less than it claimed, to prose in a commit message. Still draft — not for merge. |
One linkage change before this merges:
|
| 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) |
When the per-tab stamp points at an environment that lacks the worktree, status stays green off the workspace owner while every diff throws — exactly Bug 1. That's the #10859 ownership-translation mechanism, tracked separately (detail).
So: retitle the linkage to Part of #6357 and this is fine to ship on its own merits. Nothing else about the PR changes — it's a real, independently-reproducible fix, and #10859 doesn't affect it.
Two smaller notes while here:
- The description says the change is scoped to
folder-workspace-*.tsandorca-runtime-git.ts; it also substantially editssrc/main/runtime/orca-runtime.ts. Worth correcting so reviewers look in the right place. - The diff carries two
evidence/*.pngbinaries — probably want those out before merge.
The two-resolver split is read from source at the cited lines. Flagging the linkage rather than changing it, since it's your PR.
Independent round-9 review — verified at source, findings belowI re-verified this branch from scratch in a clean worktree rather than trusting the rounds 1–8 write-ups. The parts that were checked are solid; what nobody checked across 8 rounds is whether the routed code is reachable. It mostly isn't. What independently checks out
The test suite is genuinely stronger than typical — real on-disk git, MAJOR 1 — On desktop, none of this is reachable. The Source Control tab is hard-gated off for folder workspaces.This is the finding that decides the PR, and it's the one 8 rounds of review never asked.
So on desktop the Source Control panel never mounts for a folder workspace, and Issue #6357 Bug 2 says "the git changes list shows up empty." That's this gate — a renderer-side omission — not MAJOR 2 — A registered nested child repo is double-reported, and discarding the parent's row deletes itReproduced on real git, not reasoned about: $ git status --porcelain=v2 -uall # in parent A, with registered repo at A/B
? B/Merged status therefore contains both Routing makes it destructive. For path $ git clean -ffdx -- ':(literal)B'
Removing B/
$ ls B/work.txt
ls: B/work.txt: No such file or directory # nested repo gone, .git and uncommitted work includedA MAJOR 3 — Mobile is reachable, and half the surface still throws
Worse, MAJOR 4 — Zero SSH coverage on a fail-closed mechanismEvery fixture uses MINOR 5 — Status silently drops a child repo; commit hard-fails on identical state
MINOR 6 —
|
…g it to the ancestor An ancestor repo reports a registered nested repo as a single untracked directory row (`? vendor/sdk/`), so that path is reachable from the merged folder-workspace status. Matching tried the nested repo first, got an empty rebase, and fell through to the ancestor — where discard runs `git clean -ffdx -- ':(literal)vendor/sdk'` and deletes the nested repo wholesale, .git and uncommitted work included. An empty rebase means the path *is* a child repo root, which addresses no file in any repo. Refuse it rather than treating it as an ordinary path in the parent. Also here: - cover the probe's SSH branch, which had no tests at all. The `exitCode === null` guard exists precisely so a signal-killed probe cannot read as "nothing staged"; defaulting it to 0 now fails a test instead of silently committing another repo. - warn when status skips an unresolvable child. It dropped out of the merged list looking exactly like a clean repo, with no trace, while commit fails closed on that same state. - hoist the child-repo list out of the per-path loop in bulk routing; it re-filtered and re-sorted with a regex normalize per comparison on every path. - `git init -b` needs git 2.28, above the 2.25 baseline in AGENTS.md. Co-authored-by: Orca <[email protected]>
Fixed the data-loss bug and three smaller findings —
|
The code-quality gate on main flags import(no-duplicates); the new import duplicated a shared/types block already present in the file. Co-authored-by: Orca <[email protected]>
Sizing the desktop gate lift — the decision this PR is actually blocked onSince MAJOR 1 is the deciding question, I traced what it would take to lift the gate rather than leave it as "someone should look at this." Lifting the activity-bar gate alone gets you a broken panel
There's no synthetic- Two unrouted RPCs auto-fire on panel openNot just on user action:
Both auto-firing ones land in What would renderGiven the merge deliberately omits SizingNot contained. Gate flip + null guards yields a panel that renders a blank branch pill, throws on open, and shows buttons that can't work. The architectural call is: is a folder workspace a repo, or a new multi-repo mode?
My read: the merged-status shape chosen here (workspace-relative paths, no HEAD/branch/upstream) implicitly commits to a stage/commit-only panel. That's a coherent and genuinely smaller third option — flip the gate, add the synthetic repo, and hide the branch/upstream/PR/history/compare block entirely rather than null-guarding it. Roughly 8-12 files. It needs you to accept that folder-workspace Source Control is a changes list, not the full panel. That's a product decision, so I've stopped here rather than picking one. One pre-existing bug found while tracing
Traced statically. I did not runtime-confirm that |
Co-authored-by: Orca <[email protected]>
…der-workspace-git-routing # Conflicts: # src/main/runtime/orca-runtime.ts
Rebased onto current
|
| Check | Result |
|---|---|
src/main/runtime/ full suite |
3003 passed / 5 skipped / 0 failed (187 files) |
| Four folder-workspace files | 69/69 |
tsc --noEmit -p config/tsconfig.node.json |
0 errors |
| Conflict markers | none; all 7 folder-workspace method references intact |
Worth noting the earlier "merges cleanly" claim in my review was accurate when measured — main moved between then and now. That's the hazard of a branch this far behind, and it'll recur if this sits much longer.
CI is running on the merge commit now.
CI green on the merge commit —
|
| Finding | State |
|---|---|
| MAJOR 2 — nested repo deletion (data loss) | fixed 4870b75 |
| MAJOR 4 — no SSH coverage | fixed — 8 tests, mutation-verified |
MINOR 5/6/7 — silent status drop, O(N·R) match, git init -b |
fixed |
| static analysis failure | fixed 67c67b1 |
CONFLICTING after main moved |
fixed bbde718 |
| MAJOR 1 — desktop gate | open — product decision (sizing) |
| MAJOR 3 — mobile unrouted RPCs | open — needs an issue |
On the evidence/ NIT — declining my own suggestion
I started to remove the two PNGs and reverted. The PR body embeds them via raw.githubusercontent.com/.../nwparker/fix-6357-folder-workspace-git-routing/evidence/..., so deleting them from the branch breaks the body's images. If you want them out of the diff, they need re-hosting first (drag into a comment, swap the body URLs, then delete). Not worth doing unless you care — flagging so it isn't silently dropped.
What I'd do next
Land it as main-process infrastructure. It's correct, safe, tested, and merges clean — but it is not yet a user-visible fix for #6357, and I've amended the PR body to say that rather than leave the old framing standing. The gate flip is the follow-up that actually closes Bug 2.
If you'd rather this PR be the user-visible fix, say so and I'll take the stage/commit-only panel option (~8-12 files): flip the gate, mint the synthetic repo, hide the branch/upstream/PR/history block instead of null-guarding it.
Still draft — I haven't marked it ready, since which of those two it is changes what "ready" means.
|
Filed MAJOR 3 as #11153 — mobile retries That leaves MAJOR 1 (desktop gate) as the sole open item on this PR, and it's the scope call rather than a defect. |
Rewrote the description — and corrected my own "unreachable" claimThe description now leads with what the PR does, when it helps, and which part of #6357 it closes, instead of opening with a review-round changelog. One substantive correction to my round-9 review. I said this code was unreachable and implied that meant unreachable everywhere. That was too strong — I'd only checked the desktop GUI. Tracing the CLI shows it is reachable today: No gate anywhere on that path. The relay exposes the same So the accurate framing is per-surface, not a flat yes/no:
That makes this a real user-facing fix for the CLI/agent path, and backend groundwork for the GUI. Still Sorry for the earlier overstatement — the desktop finding was right, but I generalized it past what I'd actually checked. |
Tightening the CLI claim — two details I had wrongAn independent trace of the CLI surface confirmed the routing chain but corrected two things in my previous comment. Both narrow the claim; the direction holds. 1. Untouched by this PR. The genuinely-fixed CLI command is 2. Agents aren't currently steered here. I said "agents drive Orca through that CLI" as if this path were an established agent workflow. The skill guide documents What stands: the routing chain is real ( Description updated to say exactly that. |
…der-workspace-git-routing # Conflicts: # src/main/runtime/orca-runtime-git.ts
Merged
|
Part of #6357
What this fixes, in one sentence
Orca's git backend didn't know how to answer "which repo do you mean?" when a workspace is a folder containing several git repos instead of a single checkout — so every git operation on one threw
selector_not_found. This teaches it.The setup
Orca has two kinds of workspace:
#6357's reporter has the second kind: a container
fint/that is not a git repo, holdingfint_api,fint-admin,fint-portal,fint-sales. They opened the container so one agent could work across frontend + backend in a single session.Given that, the router looked up a worktree for the container, found nothing, and errored — instead of asking which repo inside the folder the operation meant.
How it decides
Two addressing schemes, chosen by whether the operation carries a file path:
diff,stage,unstage,discardcommit,abortMerge,abortRebase, commit-message generationstatusmerges every child repo into one list with workspace-relative paths (fint_api/src/app.ts), leavinghead/branch/upstreamunset because no single repo owns them.Why it refuses instead of fanning out
This is the design's real content, and the first version of this PR got it wrong (it committed every child repo with a staged index).
Git has no cross-repo transaction. If repo 1 commits and repo 2 fails, there is no rollback — repo 1's commit is a published fact. And neither return shape can describe that honestly:
git.commitreturns{success, error?}. Reportingsuccess: falseimplies nothing happened, when something did. Reportingsuccess: truehides a real failure.So it declines rather than half-committing:
The user keeps their index and picks. An uninspectable child fails the whole operation closed, because that child may be the one holding the staged work.
Where this is and isn't visible
Worth being explicit, because it's the difference between "fixes the reported bug" and "fixes part of it."
✅ Reachable today — but narrowly. The CLI passes selectors through verbatim (
normalizeWorktreeSelector,src/cli/selectors.ts:27-32) intogit.status(src/cli/handlers/file.ts:187), which dispatches to the exact method this PR patches (rpc/methods/git.ts:109-110→runtime.getRuntimeGitStatus). Soorca file open-changed --worktree folder:<id>goes fromselector_not_foundto a working merged status.Scoping that honestly: it's one command. There are no
git-namespaced CLI commands at all, andorca file open/file diffroute throughfiles.*→resolveRuntimeFileTarget, which already handled folder workspaces onmain(orca-runtime.ts:7390-7396) and is untouched here. The user must also pass--worktree folder:<id>explicitly —current/activeresolve fromworktree.list, which emits<repoId>::<path>ids, notfolder:keys. The id is obtainable (orca worktree ps --jsonemits it; terminals in a folder workspace exportORCA_WORKSPACE_ID=folder:<id>) but it isn't documented for this use: the skill guide listsfolder:<folderId>as valid forworktree create --parent-worktreeonly (skill-guides/orca-cli.md:126).The larger consumer is the
git.*RPC surface generally — the relay exposes all of it (src/relay/git-handler.ts:203-216), and mobile drives it directly.❌ Not reachable — desktop GUI. The Source Control tab is
gitOnly: true(right-sidebar/index.tsx:124) and folder workspaces setisFolder(:85), soright-sidebar-activity-visibility.ts:14-16filters the tab out entirely, anduseGitStatusPolling.ts:81never fetches the merged status. That gate is onmaintoo, so it isn't a regression — but it does mean this PR alone does not make the GUI's empty changes list populate. Lifting that gate is a separate product change (sizing): a folder workspace has no single branch or upstream, so the panel needs a genuinely different shape.git.status/git.diffstart working. ButbranchCompare,upstreamStatus,fetch/pull/push, andhistoryare still unrouted and throw into a retry loop — filed as #11153.So: which part of #6357 does this close?
#6357 reports two distinct bugs. This closes neither outright, and the linkage is
Part ofrather thanClosesdeliberately:file-explorer-runtime-owner.ts:5-12) while diff resolves from the per-tab stamp (useEditorPanelContentState.ts:243); when those disagree, status stays green and every diff throws. Tracked as [Bug]: Mirrored editor tabs carry the peer'sruntimeEnvironmentIduntranslated — a machine routes its own local files to a peer that doesn't have the worktree (selector_not_found) #10859.Verification
src/main/runtime/tsc --noEmit, oxlint, oxfmt clean; max-lines ratchet passesIntegration tests drive real git repos on disk — real
init/commit/mergeproducing real conflicts and realindex.lockcontention, not mocks. Mutation-tested: each mechanism disabled individually against the unchanged suite, 0 survivors, each killing a distinct test set.Representative cases:
Why selection uses a probe, not
getStatusgetStatusis built for display and two of its affordances make it unusable for deciding which repo to commit: it catches a failed git read and resolves an empty result (a corrupt index looks identical to a clean repo), and it caps entries at 1000. With >1000 files sorting ahead of the staged one, the staged row falls outside the window — measured at line 1201 on a real repo — and the commit silently goes to a different child repo reporting{success: true}.Selection instead asks git a yes/no question:
git diff --cached --quiet. No entry cap, and a broken index exits 128 instead of looking clean. Verified on real repos:The abort path deliberately keeps
getStatusas well, because its gitdir-marker check is the only reliable merge-vs-rebase discriminator —git rev-parse --verify REBASE_HEADstill returns rc=0 after a rebase completes and would report a phantom rebase forever. So abort runs both: the probe supplies fail-loud,getStatussupplies the discriminator.Trade-offs
head/branch/upstreamare unset on a merged status, andconflictOperationisunknownwhen two children conflict rather than reporting one child's state as the workspace's.Files touched
New
folder-workspace-child-repos.ts,folder-workspace-git-operation-routing.ts,folder-workspace-child-repo-probe.ts, plus their tests. Also substantially editssrc/main/runtime/orca-runtime.ts(routing entry points, child-repo resolution, commit-message cancel lanes) andorca-runtime-git.ts— that's where most of the review surface is.Cross-platform
Path handling routes through
normalizeRuntimePathForComparison, which folds Windows case and both WSL UNC aliases (wsl.localhost,wsl$) to one canonical key. No/or\assumptions; all joins go throughnode:path. SSH/remote hosts use the sameRuntimeGitTargetresolution as single-repo worktrees, and the probe dispatches ontarget.connectionIdexactly like every sibling operation — SSH viaexecNonInteractive, native/WSL viagitExecFileAsyncwithlocalGitOptionsForTarget. On the SSH branch a nullexitCode, a timeout, or a spawn error all throw rather than defaulting to 0, since defaulting would read as "nothing staged" — the precise false negative this module exists to prevent.Git baseline:
git diff --cached --quietis well under the 2.25 floor in AGENTS.md —--quietimplies--exit-code, whose rc=1-on-differences contract predates git 2.x. The repo already relies on the same idiom incommit-object-ref.tsandbranch-rename.ts.