Repository navigation
fix(mobile): use desktop's setup config and trust rules when creating workspaces - #33942
Conversation
2da8d9c to
c9c9ff9
Compare
352c1d6 to
a29a712
Compare
Walkthrough
Priority: Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 3

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
36ce4aa1-1818-4357-81d7-c3b8421f1e1e
Files selected for processing: 39-
mobile/src/components/NewWorktreeModal.tsxmobile/src/components/new-workspace-reply-schema.tsmobile/src/components/use-new-workspace-create-submit.tsmobile/src/components/use-new-workspace-repositories.tsmobile/src/components/use-new-workspace-setup-script.test.tsmobile/src/components/use-new-workspace-setup-script.tsmobile/src/tasks/mobile-tasks-dependencies.tsmobile/src/tasks/setup-hook-trust.test.tsmobile/src/tasks/setup-hook-trust.tsmobile/src/tasks/use-mobile-tasks-client-settings-actions.tsxmobile/src/tasks/use-mobile-tasks-workspace-create-actions.tsxmobile/src/tasks/use-mobile-tasks-workspace-ssh-state.tsxmobile/src/tasks/workspace-source-reply-schema.test.tsmobile/src/tasks/workspace-source-reply-schema.tsmobile/src/test-support/rpc-recording/adapters/workspace-settings-mounts.tsmobile/src/worktree/new-workspace-dialog-repo-selection.test.tsmobile/src/worktree/new-workspace-dialog-repo-selection.tssrc/main/effective-hook-config.tssrc/main/ipc/hooks/worktree-hook-execution-host.test.tssrc/main/runtime/orca-runtime-test-mocks/setup.spec.tssrc/main/runtime/runtime-repository-hooks-commands.tssrc/renderer/src/components/automations/automation-setup-decision.tssrc/renderer/src/components/new-workspace/new-workspace-composer-card-props.tssrc/renderer/src/hooks/composer-state/derived-composer-state.tssrc/renderer/src/hooks/composer-state/derived-model.tssrc/renderer/src/hooks/composer-state/linked-item-lookup-effects.tssrc/renderer/src/hooks/composer-state/quick-submit-preparation.tssrc/renderer/src/lib/ensure-hooks-confirmed.tssrc/renderer/src/lib/launch-work-item-direct-preflight.tssrc/renderer/src/lib/launch-work-item-direct.test.tssrc/renderer/src/lib/new-workspace.test.tssrc/renderer/src/lib/new-workspace.tssrc/renderer/src/lib/orca-hook-trust.tssrc/renderer/src/store/slices/ui/ui-slice-trust-actions.tssrc/shared/new-workspace-dialog-repo.tssrc/shared/orca-hook-setup-config.test.tssrc/shared/orca-hook-setup-config.tssrc/shared/orca-hook-trust-entries.test.tssrc/shared/orca-hook-trust-entries.ts
Files with no reviewable changes: 5-
- src/renderer/src/lib/launch-work-item-direct.test.ts
- src/main/runtime/orca-runtime-test-mocks/setup.spec.ts
- src/renderer/src/lib/new-workspace.test.ts
- src/main/effective-hook-config.ts
- src/renderer/src/lib/new-workspace.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
-
…he phone The host's repo.hooks reply now carries desktop's setup config, so the phone gates the Run/Skip choice and the trust prompt on defaultTabs commands too.
2cc44b6 to
ddd506b
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

Minor · Filter the run-both local fallback from automation setup… · automation-setup-decision.ts:24-34
src/renderer/src/components/automations/automation-setup-decision.ts:24-34
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winFilter the
run-bothlocal fallback from automation setup resolution.For
commandSourcePolicy: 'run-both', a local setup script with no YAMLsetupordefaultTabscommand now returns a localsetupConfig.getAutomationSetupSourceexposes that config, sonew_per_runreceivesrunorskipinstead of no setup decision. Withrun-by-default, saving the automation also entersensureHooksConfirmed.The merge-base automation resolver returned no config for this case. Filter
setupConfig.source === 'local'when the effective policy is explicitlyrun-bothingetAutomationSetupSource. Keep the shared fallback for workspace creation.Suggested fix
if (!setupConfig) { return null } + if (setupConfig.source === 'local' && hookSettings?.commandSourcePolicy === 'run-both') { + return null + } return {

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e89e3aa0-2bf2-493e-b47a-aca2e2198ebe
Files selected for processing: 3-
mobile/src/components/NewWorktreeModal.tsxsrc/renderer/src/lib/launch-work-item-direct-preflight.tssrc/renderer/src/lib/launch-work-item-direct.test.ts
Files with no reviewable changes: 1-
- src/renderer/src/lib/launch-work-item-direct.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
-
ELI5
When you create a workspace from the phone, it now asks before running the commands in a project's orca.yaml, the same way the desktop does. Before, the phone only knew about the
setupscript. Commands listed underdefaultTabseither ran with no trust prompt or were silently skipped.What Changed
The phone now uses the desktop's rules for setup and trust when it creates a workspace:
defaultTabscommands (workspaces Fix Ctrl+Backspace not deleting word in terminal #2). Desktop'sgetSetupConfigmoved from the renderer tosrc/shared/orca-hook-setup-config.ts. The host'srepo.hooksreply now includessetupConfig(the command preview and its kind), worked out by that shared function. The composer and Tasks create on the phone gate the Run/Skip choice and the trust prompt on it.defaultTabscommands and noscripts.setup, the phone sentinherit. Under "run by default" the host ran the commands with no trust prompt. Under "ask" it skipped them with no message.setupTrust(workspaces Fix Ctrl+Backspace not deleting word in terminal #2). There were three copies of the "setup plus defaultTabs" trust text: the host,ensure-hooks-confirmed, and insidegetSetupConfig. They are now one sharedgetSetupTrustContent. The host buildssetupTrustfrom the shared config, so a repo that is implicitly local-only (no policy set, plus a local script) no longer gets a trust prompt for yaml commands that won't run. The desktop already skipped that prompt.canUseRepoWideTrust(including the duplicate-repo-id guard) and the trust entry builders moved tosrc/shared/orca-hook-trust-entries.ts. The desktop store actions and the phone both use them.getDefaultSetupDecision(hasConfig, policy)replaces the policy ternaries inderived-composer-state,quick-submit-preparation,linked-item-lookup-effects,launch-work-item-direct-preflightand the phone's Tasks create. The automation path keeps its own rule on purpose (askmeans skip there).src/shared/new-workspace-dialog-repo.tsis deleted. The picker now lists onlygetNewWorkspaceDialogEligibleRepos, so hidden runtime-owned SSH repos (per-workspace environment VMs) and repos with no path no longer appear. Host ids are compared through the sharedgetRepoExecutionHostId.run-bothrepo with a local setup script and no orca.yaml commands used to get no setup config. Under "ask" the host then refused the create ("Setup decision required"). The shared rule now returns the local script for that case, on both desktop and phone.Why
Part of the mobile/desktop parity audit. Desktop logic is the reference. Each rule above now has one copy in
src/shared, used by the desktop renderer, the host and the phone. The phone can't compute the setup config itself, becauserepo.hooksstripsdefaultTabsfromhooks. So the host computes it with the shared function, and the phone reads the answer.Linked Issue
Part of the mobile/desktop parity audit
Visual Proof
No device captures for this fleet. The change adopts desktop's existing behavior:
getSetupConfigplus the setup trust prompt (ensure-hooks-confirmed),canUseRepoWideTrust, andgetNewWorkspaceDialogEligibleRepos.Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Moved desktop's
getSetupConfigtests tosrc/shared/orca-hook-setup-config.test.ts, plus arun-bothlocal-only regression test.Moved the trust entry builder tests to
src/shared/orca-hook-trust-entries.test.ts. The duplicate-id guard stays covered byensure-hooks-confirmed.test.ts.Added a phone test for a defaultTabs-only
setupConfig(use-new-workspace-setup-script.test.ts).Deleted the phone tests that only pinned the deleted repo-selection mirror; the shared tests cover them.
Ran the focused desktop, host and mobile tests, the mobile RPC-recording suite,
check:code-quality:changedandcheck:react-doctor:changed.AI Disclosure
Review
Agent skill upstream boundary
Notes
setupConfigis a new optional field onrepo.hooks. An old phone ignores it. A new phone on an old host falls back tohooks.scripts.setup(the old behavior).setupRunPolicyfrom a newer host now reads asskip-by-defaultin the Tasks path. It already skipped before, but the raw string is no longer kept.run-bothlocal-only fix above.repo.hooksstill reports no hooks for them.setupConfigis null and nosetupTrustis sent, matching the desktop composer, which only computes setup for git repos.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)