on submidule-heavy repos, worktree create hangs ~30s → runtime_unavailable and orphans a git worktree on submodule-heavy repos under load (macOS 1.4.121)
Summary
orca worktree create intermittently fails on a repository that contains many git submodules: it hangs for ~30s, then returns runtime_unavailable (runtimeId: null), and leaves behind a git-level worktree that Orca never registers (an orphan). The identical operation on a repository with no submodules succeeds in under a second.
Environment
- Orca 1.4.121, macOS
- Invoked via the CLI:
orca worktree create … --json
Reproduction (controlled A/B, identical concurrent load)
Under moderate-to-heavy concurrent load (tens of worktrees/terminals active):
-
Submodule-heavy repo —
orca worktree create --repo <repo-with-many-submodules> …hangs ~30s (CPU-idle, i.e. I/O-blocked), then returns:{"error": {"code": "runtime_unavailable", "message": "runtime_unavailable"}, "_meta": {"runtimeId": null}}However, a git worktree + branch were created on disk and are not listed by
orca worktree list(orphaned — they must be cleaned up manually withgit worktree remove --force+git branch -D). -
Plain repo (no submodules) — the same command against a submodule-free repo, at the same moment under the same load, succeeds in ~0.7s and is registered cleanly.
The only variable that differs between the two arms is the target repo (submodule-heavy vs. plain), so the failure correlates with submodule handling during worktree creation, not with generic runtime load.
Impact
- The CLI reports failure while a real git worktree is left behind → orphan worktrees accumulate and need manual cleanup.
- Scripts/agents that create child worktrees on submodule repos cannot rely on the create call succeeding under load.
Notes
- No
blockedReasonfield appears in the failure response. - Not yet isolated to a specific submodule step (e.g. submodule init/checkout during create). Happy to provide additional detail or logs.
Additional context: submodule count and sizes (reproduction environment)
The affected repo has 19 git submodules (Orca 1.4.121, macOS).
Per-submodule checked-out sizes (MB), sorted ascending:
0, 1, 1, 1, 2, 3, 4, 5, 6, 6, 8, 10, 19, 34, 37, 44, 71, 167, 227
- min ≈ <1 MB, median ≈ 6 MB, max ≈ 227 MB, total checkout ≈ 646 MB
- The two largest are ≈227 MB and ≈167 MB; the rest are mostly under ~10 MB.
Combined submodule git histories (.git/modules — i.e. what a fresh worktree's submodule init/checkout has to materialize): ≈2.5 GB. Main-repo object store (.git/objects): ≈589 MB.
The submodule-free control repo (which succeeded in ~0.7 s under the same load) had 0 submodules and only a few KB of content. So the failure appears to scale with submodule count / combined submodule git-history size, consistent with worktree create blocking on submodule init/checkout rather than on generic runtime load.
thx for reporting. will get this resolved soon
Same failure mode on Windows, but with two data points that argue against submodules being the necessary cause — and that widen the scope beyond worktree create.
1. Reproduced with zero submodules
- Orca app
running, runtimeready/reachablebefore and after each attempt. git submodule statuson the affected repo returns 0 entries.- Single repo, single worktree registered, no heavy concurrent load (2 agent sessions).
So the submodule-heavy + under-load combination reproduces it, but is not required.
2. It is not limited to worktree create — it hits anything that touches the UI/browser layer
Measured across 8 CLI calls on the same runtime, back to back:
| Class | Commands | Result |
|---|---|---|
| Metadata / read | status, tab list, tab close, worktree list, worktree rm, repo set-base-ref |
ok: true |
| Touches UI/browser | worktree create, tab create, snapshot |
runtime_unavailable, runtimeId: null |
That split was stable — metadata calls kept succeeding immediately after each failure.
3. The work completes; only the response is lost
This is the part that costs users the most. tab create returned:
{"ok": false, "error": {"code": "runtime_unavailable",
"message": "The Orca runtime closed the connection before responding."}}
…and the very next tab list showed the tab created and live (correct URL and title). Same for
worktree create: the git worktree and branch existed on disk every time.
Because the error text describes a dropped connection rather than the outcome, it reads as "nothing happened". Retrying with different arguments produced four worktrees and four branches before I checked actual state — one per "failure". For non-idempotent operations this turns a transient transport error into repeated real side effects.
Suggestions
- Consider making the CLI re-query state on
runtime_unavailablefor create-style commands, or at minimum change the message to say the operation may have completed — e.g.runtime_unavailable: response lost; verify state before retrying. worktree rm --worktree name:<name>worked reliably for cleanup, including for entries created during failed calls — worth mentioning in the error hint.
Minor, possibly separate: the error suggests a flag that does not exist
Calling worktree create without a base ref returns:
Could not resolve a default base ref for this repo. Pass an explicit --base and try again.
But the parser rejects it:
Unknown flag --base for command: worktree create— withbase-branchlisted among valid flags.
Environment
- Windows 11, Orca desktop app, CLI via
resources/bin/orca.cmd - Runtime stayed
readyandreachablethroughout; the app never needed restarting to answer metadata calls - One residual empty directory from a failed
worktree createkept an open handle (removable only after restarting the app)
Came looking for this - this also occurs for us. We use a monorepo so it is quite large, but zero git submodules - I consistently have this issue where I get "runtime_unavailable" after a period of time waiting for the worktree to create. It always successfully does, but the spawning terminal doesn't see it and instead gets the runtime available error.
I think the PR open against this issue will resolve it - would love to see it come in!
Fixed by #29262: the socket no longer times out while a long worktree create is still running, which caused the runtime_unavailable error and the orphaned worktree.