orca icon indicating copy to clipboard operation
orca copied to clipboard

[Bug]: SSH worktree creation times out after 30s on large repositories

Open lyonDan opened this issue 4 months ago • 2 comments

Short summary

Creating a worktree for a large repository over SSH always fails in Orca after 30 seconds, even though git worktree add is still doing normal checkout work on the remote host.

The observed error is deterministic:

Request "git.addWorktree" timed out after 30000ms

The repository in this reproduction has approximately 130,000 tracked files and uses Git LFS, so a cold checkout legitimately takes longer than 30 seconds.

What happened?

Orca reports the worktree creation as failed after exactly 30 seconds. This is an RPC timeout rather than a Git failure.

The SSH multiplexer uses a fixed 30-second default:

The timeout sends rpc.cancel, but the relay registration does not pass request context to the handler:

this.dispatcher.onRequest('git.addWorktree', (p) => this.addWorktree(p))

The relay then calls addWorktreeOp without a cancellation signal. Consequently, the remote Git process may continue after Orca has reported failure. A retry can then collide with a directory, branch, or worktree created by the first request.

How can we reproduce it?

  1. Run Orca 1.4.149 on macOS.
  2. Connect to a remote host through Orca SSH.
  3. Register a large Git repository on the remote host. The reproduction repository has approximately 130,000 tracked files and Git LFS objects.
  4. Create a new Orca worktree from a remote-tracking branch.
  5. Let the remote checkout run for more than 30 seconds.
  6. Orca reports Request "git.addWorktree" timed out after 30000ms, even though the checkout duration is expected for the repository size.

Running the equivalent git worktree add directly in a remote terminal succeeds when allowed to finish.

Expected behavior

Worktree creation should remain active while the remote Git process is making progress. Large repositories should not be treated as failed solely because checkout exceeds 30 seconds.

If the user explicitly cancels creation, Orca should terminate the remote Git process and reconcile any partially created branch, directory, or worktree registration.

Actual behavior

  • Orca reports failure at exactly 30 seconds.
  • The fixed RPC timeout is shorter than a normal checkout for large repositories.
  • The remote operation may outlive the failed request because git.addWorktree does not consume the request cancellation context.
  • Retrying can produce branch/path conflicts or leave an external worktree that Orca did not finish registering.

Proposed fix

  1. Give git.addWorktree a method-specific timeout of at least 5-10 minutes, or use an inactivity timeout refreshed by progress instead of a fixed wall-clock timeout.
  2. Pass an AbortSignal through SshGitProvider.addWorktree, the relay handler, addWorktreeOp, and the Git subprocess.
  3. Stream or notify checkout progress from Git stderr (Updating files) and Git LFS.
  4. After a timeout or connection interruption, run git worktree list and reconcile a late successful creation before presenting a terminal failure.
  5. Optionally expose a configurable worktree-create timeout for unusually large repositories.

Workaround

Create the worktree manually in an Orca remote terminal, wait for git worktree add to complete, and then let Orca discover/import the external worktree. Before retrying a timed-out create, always check git worktree list and the target branch/path.

Environment

  • Orca: 1.4.149
  • Client OS: macOS
  • Execution: SSH remote workspace
  • Remote repository: approximately 130,000 tracked files, Git LFS enabled

lyonDan avatar Jul 22 '26 05:07 lyonDan

Reproduction status: env_blocked (SSH worktree create 30s timeout)

Needs large remote repo over SSH and timed create path; not available here.

Not labeling cannot_repro.

nwparker avatar Jul 27 '26 05:07 nwparker

Thanks @lyonDan for the thorough write-up. The 30-second limit came from the old SSH relay's request channel, which has been removed (#27214, #27215). Worktree creation on SSH hosts now runs inside the host's managed Orca server: the desktop waits up to 10 minutes, and git worktree add on the host uses its own longer timeout, which you can raise with ORCA_WORKTREE_ADD_TIMEOUT_MS. Closing — please reopen if a large checkout still times out on 1.4.224 or later.

OrcaWin avatar Oct 11 '26 06:10 OrcaWin