You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: orca tab create ignores ORCA_WORKTREE_ID and silently uses the UI-active worktree when cwd is not in a managed worktree #37899
orca tab create (and probably other worktree-scoped browser commands) decides the target worktree only from the caller's current directory. If the directory is not inside an Orca-managed worktree, the CLI does not fail. It silently opens the tab in whichever worktree is currently active in the Orca window. The ORCA_WORKTREE_ID / ORCA_WORKSPACE_ID variables that Orca exports into agent terminals are ignored. An agent that runs cd /tmp && orca tab create ... therefore puts its tabs in an unrelated repo, which changes with whatever the user is looking at.
Version
Orca 1.4.247 (orca --version), macOS, Orca desktop with local runtime.
Steps to reproduce
Open an Orca terminal in worktree A (here: /Users/me/GitHub/personal). The shell has ORCA_WORKTREE_ID=<repoId>::/Users/me/GitHub/personal.
Run cd /tmp && orca worktree current --json. It fails: No Orca-managed worktree contains the current directory: /private/tmp.
Run cd /tmp && orca tab create --url about:blank --json, then orca tab list --json and read worktreeId of the new tab.
Change the active worktree in the Orca window to worktree B and repeat step 3.
worktree B (the one active in the window; earlier the same command gave another repo when that one was active)
/tmp
unset
worktree B
inside worktree A
unset
worktree A
So the cwd decides. The environment is not used. When the cwd is unmanaged, the choice depends on UI state.
Expected
One of these:
Use ORCA_WORKTREE_ID (or ORCA_WORKSPACE_ID) when the cwd is not in a managed worktree. A terminal that Orca itself started knows which worktree it belongs to.
Or fail with a clear error, as orca worktree current already does, and tell the caller to pass --worktree.
A silent fallback to the active worktree is the worst choice for agents. The tabs appear in a repo the user did not expect, and nothing reports it.
Workaround
Pass --worktree "id:$ORCA_WORKTREE_ID" explicitly. With it, the tab lands in the right worktree from any cwd (tested from /tmp).
Impact
Agents often cd to a scratch directory such as /tmp before running scripts. Eight tabs of one task ended up in a different repo's workspace. The user has seen this several times. It is hard to notice because the CLI output does not name the worktree.
Possible fix
Resolve the worktree in this order: explicit --worktree, then cwd inside a managed worktree, then ORCA_WORKTREE_ID, then error. Also print the resolved worktree in the tab create result.
Activity
fix(cli): respect ORCA_WORKTREE_ID in tab create when cwd is unmanaged (
fix(cli): respect ORCA_WORKTREE_ID in tab create when cwd is unmanaged (