stablyai / stablyai/orca

[Bug][Mobile]: Create-workspace surfaces list no agents for a WSL-hosted repo (detectAgents sent without a distro)

Open
#20,060 1 comment 0 reactions 1 assignee Claimed by @AmethystLiang View on GitHub
Dominant language
TypeScript
Stars
69.7k
Forks
4.5k
Avg merge
16h 8m
Merged PRs (30d)
451

Description

## Summary

Mobile's **create-workspace** surfaces still detect agents without naming a WSL distro, so a paired client on a Windows host lists no agents for a WSL-hosted repo. This is the same defect class as #19885, which PR #19886 fixed only for the New Tab drawer; #19886 deliberately left these two call sites out of scope because they need a different distro source.

## Where

Both take the local branch and call the RPC with no params, so the host answers from its own Windows PATH:

- `mobile/src/components/use-new-workspace-execution-target.ts:88` — the hook behind `NewWorktreeModal` (`mobile/src/components/NewWorktreeModal.tsx:80`).
- `mobile/src/tasks/use-mobile-tasks-workspace-ssh-state.tsx:122` — the workspace-create draft in the tasks screen.

```ts
const response = connectionId
? await client.sendRequest('preflight.detectRemoteAgents', { connectionId })
: await client.sendRequest('preflight.detectAgents') // no target named -> host-local probe
```

## Impact

On a Windows host whose repos live under `\\wsl.localhost\\...` with the agent CLIs installed inside the distro, opening "New Workspace" on the phone shows an empty agent selection — identical to the New Tab symptom in #19885. SSH-hosted repos are unaffected (they resolve through `preflight.detectRemoteAgents`), as are non-Windows hosts, where `getPreflightWslTarget` returns `null`.

## Why it was not folded into #19886

The New Tab loader could read the distro out of the existing worktree id (`${repoId}::${path}`). These two surfaces run *before* a worktree exists, so the distro has to come from the selected target repo's path instead:

- `useNewWorkspaceExecutionTarget` currently receives only `{ client, connectionId, visible }`, so `NewWorktreeModal` would have to pass the target repo (or its path) down.
- The tasks hook already holds `workspaceCreateTargetRepo`, so its path is available in place.

## Suggested fix

The host side already accepts the parameter after #19886 (`preflight.detectAgents` / `preflight.refreshAgents` take an optional `{ wslDistro?, wslDefault? }`). The client change is to derive the distro from the target repo path with the shared `parseWslUncPath` and send it, exactly as `mobile/src/session/mobile-new-tab-agent-loader.ts` now does:

```ts
const wslDistro = repoPath ? (parseWslUncPath(repoPath)?.distro ?? null) : null
await client.sendRequest('preflight.detectAgents', wslDistro ? { wslDistro } : undefined)
```

A non-WSL path yields `null` and the request stays byte-identical to today's, so hosts that predate the parameter are unaffected.

## Related

- #19885 — the reported bug (New Tab drawer)
- #19886 — the fix for the drawer plus the RPC parameter this issue would reuse

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.