Skip to content

feat(mobile): Add project from the phone (+ sheet: clone / create / add existing) - #21698

Closed
dudupii wants to merge 12 commits into
stablyai:mainfrom
dudupii:feat/mobile-clone-from-url
Closed

dudupii wants to merge 12 commits into
stablyai:mainfrom
dudupii:feat/mobile-clone-from-url

Conversation

@dudupii

@dudupii dudupii commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

On the phone, the + button used to jump straight into the "new workspace" form. Now it first asks what you want: a New workspace in a project the host already has, or Add project to bring a new project onto the host — clone it from a URL, create an empty one, or point at a folder that already exists on the host. After adding, you land in the new project's default checkout session, same as the desktop.

What Changed

Before: mobile's + opened the Create worktree sheet directly. The only way to get a new repository onto a paired host was the desktop app.

After: + opens a two-choice sheet — New workspace / Add project — mirroring the desktop + area's two buttons. Add project shows the desktop Add-project start rows minus SSH:

  • Browse folder — type a host path; the host registers it via repo.add (it must be an existing git repository).
  • Clone from URL — repo.clone; the host picks the destination from its own default projects folder. Large clones get a 10-minute budget.
  • Create new project — repo.create; an empty git repository with an initial commit in the host's default projects folder.

A successful add closes the sheet and opens the added repository's default checkout session (its main worktree) — the desktop standalone Add project's landing. The initial cut reused the composer-nested flow's continuation (selectAddedProjectRepo, which returns to a composer with the repo preselected); follow-up commit 6ca196383 corrects the handoff: the phone awaits the refreshed worktree catalog (concurrent fetches now share the in-flight request instead of returning empty-handed), finds the repo's main worktree, and opens its session. If the catalog has no main row for the repo, the user stays on the refreshed host list.

Mechanism, across the three commits:

  1. shared: default clone destination / create parent resolution moved into a shared pure module (repo-default-locations); repo.clone's destination and repo.create's parentPath become optional (a wire loosening — old hosts ignore nothing, new hosts resolve defaults). Desktop behavior is unchanged and now goes through the same shared policy.
  2. main: repo.add / repo.create / repo.clone allowed for mobile runtime RPCs, and hosts advertise repo.add-project-mobile.v1 via status.get so old hosts never show a dead entry point.
  3. mobile: the + routes through a capability check — hosts without the capability keep the old one-tap behavior. The Add project sheet is a single BottomDrawer whose content swaps in place; the handoff fires from the drawer's onAfterClose, so iOS never presents two native modals in the same beat; the follow-up commit redirects that handoff to the default-checkout session (above). The worktree-actions recording adapter gained the hostCapabilities argument, so the five goldens pinning its digest were repinned — their traces are byte-identical.

Why

Mobile users could only create workspaces inside projects the host already knew; adding a repository meant walking to the desktop. The chooser and the three rows mirror the desktop Add project dialog (same labels, same copy, minus the SSH row mobile does not support) so there is one mental model across surfaces. Destination defaults resolve host-side, so the phone never needs to know the host's filesystem layout. Capability gating was chosen over showing the entry unconditionally so paired older hosts see exactly what they support.

Linked Issue

Fixes #21669

Visual Proof

UI change — screenshots/video from a paired phone are pending the integration build (this needs a fork host build + APK; manual E2E was deliberately sequenced after this PR in the design spec). The rendered structure is pinned by component tests (the three start rows with their desktop copy, per-form fields, busy/error rows).

Testing

  • I manually tested these changes locally — deferred to the integration build (see Visual Proof); not claimed yet.
  • Automated tests added/updated
    • repo-add-project-operations.test.ts — wire shapes (URL-only clone with the 10-min budget, name+kind create, path-only add), refusal surfacing, incompatible-reply rejection, create's soft-error arm.
    • AddProjectModal.test.tsx — desktop start rows minus SSH; clone/create/add flows; the handoff fires only after the drawer's onAfterClose; a repo.create soft error renders in-sheet without closing; submit disabled until input.
    • NewWorktreeModal.test.tsx — a repo the phone just added is upserted and selected over the last-visited default.
    • Full mobile suite green (708 files) except two order-dependent static-scan tests that pass standalone and are untouched by this diff; recording suites (397 + 392) green after the digest repin.
  • Platforms: React Native only; no platform-specific code paths added. iOS native-modal sequencing handled via onAfterClose rather than timers.

AI Disclosure

Built with Claude Code (Anthropic), pair-directed by @dupi against the approved design spec (dudupii#7, v4).

Review

Start at mobile/src/components/AddProjectModal.tsx (the sheet), then use-host-worktree-actions.ts (capability gate + handoff), then src/main/runtime/rpc/methods/repo.ts + src/shared/git/repo-default-locations.ts (host-side defaults).

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security: no new IPC surface beyond three already-existing runtime RPCs, now allowlisted for mobile; no path traversal (paths resolve host-side under host policy).
  • Cross-platform: shared default-resolution is pure and unit-tested; mobile UI is RN cross-platform; no hard-coded shortcuts.
  • SSH/remote: runtime guards keep refusing ssh:* hosts for these flows — SSH destinations are recorded as out of scope in the spec.
  • Backwards compatibility: old host + new app → capability absent → + behaves exactly as before; new host + old app → nothing new advertised that old decoders choke on (optional fields only, no new stream opcodes).

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason — pending integration build (stated above)
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred) — lint/typecheck/tests run locally; build covered by CI

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The mobile host screen adds capability-gated repository clone, create, and host-path actions. Added repositories are handed off after the drawer closes, inserted into the new-worktree repository list, and selected. Worktree refresh calls now return results and share concurrent requests. Shared runtime helpers resolve default clone and create locations. Repository RPC paths are optional, and the mobile allowlist includes the repository methods. Tests and adapter golden hashes were updated.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is detailed and covers the change, rationale, linked issue, testing, compatibility, and checklist. However, the required visual proof for this UI change is missing; the description sta… Attach before-and-after screenshots or a video from the paired phone. Update the Visual Proof section and checklist after adding the evidence. Do not use N/A because this pull request changes the UI and interaction flow.
Linked Issues check ⚠️ Warning The PR satisfies the transport requirements in [#21669]. The mobile flow sends the clone URL, uses the host-side repo.clone RPC, applies REPO_CLONE_TIMEOUT_MS, resolves an omitted destination on t… After a successful clone, pass the repository into the existing New workspace flow and preserve the name, agent, setup-script, and launch steps required by [#21669]. Place the clone entry in that flow, or implement an equivalent entry that …
Docstring Coverage ⚠️ Warning Docstring coverage is 24.39% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 41 functions across 40 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)

Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding mobile project creation and addition flows through the plus sheet.
Out of Scope Changes check ✅ Passed The changes remain within the mobile project-add flow associated with [#21669]. The empty-project and existing-host-repository rows reuse the same modal, host repository RPC surface, default-location …
Full details: Description check

Explanation

The description is detailed and covers the change, rationale, linked issue, testing, compatibility, and checklist. However, the required visual proof for this UI change is missing; the description states that screenshots or video are pending.

Full details: Linked Issues check

Explanation

The PR satisfies the transport requirements in [#21669]. The mobile flow sends the clone URL, uses the host-side repo.clone RPC, applies REPO_CLONE_TIMEOUT_MS, resolves an omitted destination on the host, and gates the entry with REPO_ADD_PROJECT_MOBILE_RUNTIME_CAPABILITY. The PR does not satisfy the required post-clone flow. handleProjectAdded refreshes the catalog and opens the repository main worktree directly. It does not continue through the existing workspace flow for name, agent, setup script, and launch. The clone entry is also in the standalone Add project sheet instead of the New workspace project picker described in [#21669]. The added tests confirm the direct default-checkout handoff and do not cover the required post-clone flow.

Resolution

After a successful clone, pass the repository into the existing New workspace flow and preserve the name, agent, setup-script, and launch steps required by [#21669]. Place the clone entry in that flow, or implement an equivalent entry that reaches the same flow. Add automated coverage for the complete post-clone path. Keep the capability gate and long-request timeout.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

ℹ️ Recent review info

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 1cad69de-cb0c-48cb-9a4b-a134f1186145

📥 Commits

Reviewing files that changed from the base of the PR and between 6ca1963 and 8cee3cc.

📒 Files selected for processing (2)

  • mobile/src/host-screen/host-screen-action-error.test.tsx
  • mobile/src/host-screen/host-worktree-catalog-action-error.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)

  • mobile/src/host-screen/host-screen-action-error.test.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 5359e4bb-118a-4207-92ce-7b2d6a711b8b

📥 Commits

Reviewing files that changed from the base of the PR and between 3ad6b7e and da62fd053d0b5a077b0f9ec9fd4680da93aeed1e.

📒 Files selected for processing (39)
  • mobile/rpc-foundation/goldens/host-worktree-actions-pin-open-delete.json
  • mobile/rpc-foundation/goldens/host-worktree-delete-refused.json
  • mobile/rpc-foundation/goldens/matrix-host.worktree-actions-worktree.activate-1.json
  • mobile/rpc-foundation/goldens/matrix-host.worktree-actions-worktree.rm-1.json
  • mobile/rpc-foundation/goldens/matrix-host.worktree-actions-worktree.set-1.json
  • mobile/src/components/AddProjectModal.test.tsx
  • mobile/src/components/AddProjectModal.tsx
  • mobile/src/components/NewWorktreeModal.test.tsx
  • mobile/src/components/NewWorktreeModal.tsx
  • mobile/src/components/NewWorktreeModalController.tsx
  • mobile/src/components/new-worktree-modal-types.ts
  • mobile/src/components/use-new-workspace-repositories.ts
  • mobile/src/host-screen/host-screen-action-error.test.tsx
  • mobile/src/host-screen/host-screen-header.tsx
  • mobile/src/host-screen/host-screen-overlays.tsx
  • mobile/src/host-screen/host-workspace-list.tsx
  • mobile/src/host-screen/use-host-screen-controller.ts
  • mobile/src/host-screen/use-host-screen-state.ts
  • mobile/src/host-screen/use-host-worktree-actions.ts
  • mobile/src/tasks/repo-add-project-operations.test.ts
  • mobile/src/tasks/repo-add-project-operations.ts
  • mobile/src/tasks/repo-add-project-reply-schema.ts
  • mobile/src/tasks/workspace-create-timeout.ts
  • mobile/src/test-support/rpc-recording/adapters/host-worktree-action-mount-adapters.ts
  • src/main/ipc/repos-create.test.ts
  • src/main/ipc/repos/repo-creation-handlers.ts
  • src/main/runtime/rpc/methods/repo.test.ts
  • src/main/runtime/rpc/methods/repo.ts
  • src/main/runtime/runtime-repository-clone-controller.test.ts
  • src/main/runtime/runtime-repository-clone-controller.ts
  • src/main/runtime/runtime-repository-registration-controller.test.ts
  • src/main/runtime/runtime-repository-registration-controller.ts
  • src/main/runtime/runtime-rpc/runtime-rpc-mobile-method-allowlist.ts
  • src/renderer/src/components/sidebar/clone-defaults.test.ts
  • src/renderer/src/components/sidebar/clone-defaults.ts
  • src/shared/git/repo-default-locations.test.ts
  • src/shared/git/repo-default-locations.ts
  • src/shared/protocol-version.ts
  • src/shared/rpc-contract/repo-params.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment on lines +68 to +74
<BottomDrawer visible={visible} onClose={onClose} onAfterClose={fireHandoff}>
<AddProjectModalContent
key={session.openEpoch}
client={client}
onAdded={(repo) => {
handoffRef.current = repo
onClose()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1,280p' mobile/src/components/AddProjectModal.tsx
sed -n '1,140p' mobile/src/components/BottomDrawer.tsx
sed -n '1,280p' mobile/src/components/AddProjectModal.test.tsx

Repository: stablyai/orca

Length of output: 18494


🏁 Script executed:

fd -i 'mounted-bottom-drawer|bottom-drawer' mobile/src/components mobile/src --type f
rg -n --glob '*.ts' --glob '*.tsx' 'AddProjectModal|onAfterClose|onHidden|handleHidden|visible=.*BottomDrawer|BottomDrawer' mobile/src/components mobile/src | head -220

Repository: stablyai/orca

Length of output: 24185


🏁 Script executed:

cat -n mobile/src/components/mounted-bottom-drawer.tsx | sed -n '35,145p'
cat -n mobile/src/components/bottom-drawer-close-lifecycle.test.ts | sed -n '1,130p'
cat -n mobile/src/components/bottom-drawer-mount-state.ts | sed -n '1,80p'

Repository: stablyai/orca

Length of output: 8870


Bind late completions to their submitting drawer session.

If the drawer closes while run() is pending, onAfterClose can consume an empty handoffRef before the RPC resolves. The late completion then stores its repository without another close transition. A later session can consume that stale repository. Block dismissal while busy, or associate each completion with its openEpoch and reject results from closed or earlier sessions.

const reply = repoCloneRun.interpret(
await repoCloneRun.request(
client,
{ url: cloneUrl.trim() },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- modal and clone references ---'
rg -n -C 5 --glob '!node_modules' --glob '!dist' 'repo\.clone|cloneUrl|AddProjectModal' mobile src . 2>/dev/null | head -240
printf '%s\n' '--- clone definitions and URL validation ---'
rg -n -C 4 --glob '!node_modules' --glob '!dist' 'clone\s*\(|cloneRepo|clone_url|cloneUrl|ssh://|git@|https?://|url.*clone|clone.*url' . 2>/dev/null | head -320
printf '%s\n' '--- tracked candidate files ---'
git ls-files | rg '(^|/)(AddProjectModal|.*repo.*|.*clone.*|.*project.*modal.*)' | head -160

Repository: stablyai/orca

Length of output: 50371


🤖 get_repo_knowledge executed:

get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/conventions

Length of output: 23989


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- bound host repo RPC ---'
if [ -f src/main/runtime/rpc/methods/repo.ts ]; then
  cat -n src/main/runtime/rpc/methods/repo.ts | sed -n '1,190p'
else
  printf '%s\n' 'src/main/runtime/rpc/methods/repo.ts not found'
  fd -i 'repo.ts' src mobile | head -40
fi
printf '%s\n' '--- RepoClone declaration ---'
rg -n -C 8 'type RepoClone|interface RepoClone|const RepoClone|RepoClone\s*=' src/shared mobile
printf '%s\n' '--- modal submit flow ---'
cat -n mobile/src/components/AddProjectModal.tsx | sed -n '80,130p'

Repository: stablyai/orca

Length of output: 10403


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- cloneRepo definitions and calls ---'
rg -n -C 12 --glob '!node_modules' --glob '!dist' 'cloneRepo' src mobile
printf '%s\n' '--- git clone operation definitions ---'
rg -n -C 10 --glob '!node_modules' --glob '!dist' 'spawn.*clone|git.*clone|clone\s*:\s*|clone\(' src/main src/shared | head -260

Repository: stablyai/orca

Length of output: 50369


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- clone controller binding ---'
rg -n -l --glob '!node_modules' --glob '!dist' 'class RuntimeRepositoryCloneController|RuntimeRepositoryCloneController|Invalid repository name derived from URL' src/main
printf '%s\n' '--- focused clone implementation ---'
rg -n -C 20 --glob '!node_modules' --glob '!dist' 'class RuntimeRepositoryCloneController|clone\s*\(.*url|Invalid repository name derived from URL|gitSpawnAfterWindowsEnvironmentReady' src/main/runtime src/main | head -360

Repository: stablyai/orca

Length of output: 44939


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- runtime-repository-clone-controller.ts ---'
wc -l src/main/runtime/runtime-repository-clone-controller.ts
cat -n src/main/runtime/runtime-repository-clone-controller.ts | sed -n '1,260p'
printf '%s\n' '--- repo-clone-path.ts ---'
wc -l src/main/git/repo-clone-path.ts
cat -n src/main/git/repo-clone-path.ts | sed -n '1,220p'

Repository: stablyai/orca

Length of output: 14464


Restrict mobile clone sources to HTTP and HTTPS. repo.clone accepts any non-empty string. The host derives a clone path, then passes the raw value to git clone, so ssh://, SCP-style git@host:path, and local paths can reach Git instead of being rejected. Validate the URL scheme before sending the RPC.

Comment on lines +149 to +152
label: 'Browse folder',
icon: FolderOpen,
hint: 'Existing Git repository or folder on this host',
onPress: () => setView('addExisting')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '81,247p' mobile/src/components/AddProjectModal.tsx
rg -n "repo\.add|addRepo|add.*Repo|Existing Git repository|Existing.*folder" src/main src/shared mobile/src | head -160

Repository: stablyai/orca

Length of output: 21168


🏁 Script executed:

#!/bin/bash
printf '%s\n' '--- exact run symbol and imports ---'
rg -n -S "repoAddExistingRun|repo\.add|repo.add|addExisting" mobile/src src/main src/shared packages 2>/dev/null | head -240
printf '%s\n' '--- likely RPC definitions ---'
rg -n -S "AddExisting|add existing|existing.*path|path.*git|isGit|git.*repository|not a git|repository.*path" src/main src/shared mobile/src 2>/dev/null | head -240

Repository: stablyai/orca

Length of output: 50369


🏁 Script executed:

#!/bin/bash
printf '%s\n' '--- mobile operation binding ---'
cat -n mobile/src/tasks/repo-add-project-operations.ts
printf '%s\n' '--- host repo RPC implementation ---'
rg -n -S "repo.add|function.*add|add.*repo|RepoPath|nested-repo-import|repo-creation" src/main/runtime src/main/ipc src/shared/rpc-contract | head -160
printf '%s\n' '--- likely implementation slices ---'
for f in src/main/runtime/rpc/methods/repo.ts src/main/ipc/repos/nested-repo-import-handler.ts src/main/ipc/repos/repo-creation-handlers.ts; do
  if [ -f "$f" ]; then
    echo "--- $f ---"
    sed -n '1,240p' "$f"
  fi
done

Repository: stablyai/orca

Length of output: 48036


🏁 Script executed:

#!/bin/bash
printf '%s\n' '--- runtime addRepo declarations and implementation ---'
rg -n -S "addRepo\s*[:=]|async addRepo|addRepo\(" src/main/runtime src/main | grep -v '\.test\.' | head -160
printf '%s\n' '--- local path registration ---'
rg -n -S "function addLocalRepoFromPath|const addLocalRepoFromPath|export .*addLocalRepoFromPath|isGitRepo\(" src/main/ipc/repos src/main/runtime | head -160

Repository: stablyai/orca

Length of output: 12981


🏁 Script executed:

#!/bin/bash
printf '%s\n' '--- runtime repository registration controller ---'
sed -n '1,215p' src/main/runtime/runtime-repository-registration-controller.ts
printf '%s\n' '--- repo path contract ---'
sed -n '1,80p' src/shared/rpc-contract/repo-params.ts

Repository: stablyai/orca

Length of output: 10601


Use repository wording for this action.

This row opens a host-path text field. It does not open a filesystem browser. The mobile repo.add call defaults to Git mode and rejects paths that are not existing Git repositories.

Rename the action to “Add existing repository” and change the hint to “Enter the absolute path of an existing Git repository on this host.”

@@ -237,7 +237,7 @@ export function HostScreenHeader({ controller }: { controller: HostScreenControl
styles.embeddedToolbarIconButton,
connState !== 'connected' && styles.toolbarIconDisabled
]}
onPress={actions.openNewWorktreeModal}
onPress={actions.openPlusActionSheet}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Update the accessible names for the new + action. Both buttons can now open choices for creating a workspace or adding a project, but screen readers still announce “New workspace.”

  • mobile/src/host-screen/host-screen-header.tsx#L240-L240: change the adjacent accessibility label to describe the general + action.
  • mobile/src/host-screen/host-workspace-list.tsx#L199-L199: update NewWorkspaceFab or pass an accessible label that describes the general + action.
📍 Affects 2 files
  • mobile/src/host-screen/host-screen-header.tsx#L240-L240 (this comment)
  • mobile/src/host-screen/host-workspace-list.tsx#L199-L199

return workspaceDir
}

const separatorIndex = Math.max(trimmed.lastIndexOf('/'), trimmed.lastIndexOf('\\'))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Only parse backslashes as separators for Windows paths.

On POSIX, /home/li/orca\workspaces is a valid path with one literal-backslash segment. This code treats it as a workspaces suffix and returns /home/li/orca, so clone defaults can target the wrong parent. Use the same Windows-path predicate as normalizeRuntimePathForComparison, and add a POSIX literal-backslash test.

Source: Learnings

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — a few minor suggestions inline.

Reviewed changes

Read the full 39-file diff at da62fd0.

  • Shared default-location policy — repo-default-locations.ts moves getDefaultCloneParent out of the renderer (verbatim) and adds resolveDefaultCloneDestination / resolveDefaultCreateProjectParent; the desktop clone-defaults module re-exports the shared helper and the local IPC create handler delegates to the shared resolver.
  • Host-side defaults — RepoClone.destination and RepoCreate.parentPath become optional (OptionalString), and the runtime clone/registration controllers resolve a host default when they are absent, so a phone never types a host path.
  • Mobile add-project — new AddProjectModal (start rows plus clone/create/browse forms) backed by checked repo-add-project-operations; the + button routes through a repo.add-project-mobile.v1 capability gate, and a successful add closes the sheet and hands the repo to the New workspace form from the drawer's onAfterClose.
  • Tests/recordings — new host and mobile unit tests; the five worktree-action recordings repin adapterSha256 only.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

{
label: 'Browse folder',
icon: FolderOpen,
hint: 'Existing Git repository or folder on this host',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hint (copied verbatim from the desktop start row) promises folder support, but the mobile Browse folder form sends only { path } — no kind — and the host validates it as a git repository and rejects a plain folder. Either trim the copy to Existing Git repository on this host to match what v1 actually supports, or send kind: 'folder' and gate it the way desktop does.

Comment thread src/shared/protocol-version.ts Outdated
// Why: repo.add/create/clone were desktop-only RPCs; mobile gates its Add project
// entry on this capability so an older host (no allowlisted methods, required
// destination/parentPath) never receives a call it would reject.
export const REPO_ADD_PROJECT_MOBILE_RUNTIME_CAPABILITY = 'repo.add-project-mobile.v1' as const

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every other runtime capability has a companion test asserting membership in RUNTIME_CAPABILITIES (e.g. src/shared/worktree/archive-failure-blocking-capability.test.ts). This one doesn't, so the constant could later be dropped from the array with nothing failing. A one-line test keeps the convention.

Comment on lines +192 to +195
'repo.add',
'repo.baseRefDefault',
'repo.clone',
'repo.create',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runtime-rpc-mobile-method-allowlist.test.ts is the suite that pins the mobile-reachable surface, but it isn't extended for these three methods. Adding a dispatch case for one of them (or a small assertion over the new entries) would pin the intent rather than leaving the allowlist change unverified.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No new issues in this delta — the three earlier suggestions remain open.

This delta (commit 115d82d) is a test-only typecheck fix for the two runtime-controller store fakes: updateRepo now returns null, getAllWorktreeMeta returns {}, getWorktreeMeta returns undefined, setWorktreeMeta returns a filled-out WorktreeMeta, and getGitHubCache is added. No product behavior changes. The prior minor findings aren't repeated here; they're still open on the earlier review.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 84ac59bd-67b8-49b8-b215-a5dcea002376

📥 Commits

Reviewing files that changed from the base of the PR and between 619ecc4 and 6ca1963.

📒 Files selected for processing (22)
  • mobile/rpc-foundation/goldens/host-worktree-refresh-stream.json
  • mobile/rpc-foundation/goldens/live-worktree-name-stream.json
  • mobile/rpc-foundation/goldens/matrix-host-worktree-refresh-runtime.clientevents.subscribe-1-1.json
  • mobile/rpc-foundation/goldens/matrix-host-worktree-refresh-runtime.clientevents.subscribe-1-2.json
  • mobile/rpc-foundation/goldens/matrix-host-worktree-refresh-runtime.clientevents.subscribe-1-3.json
  • mobile/rpc-foundation/goldens/matrix-host-worktree-refresh-runtime.clientevents.subscribe-2-1.json
  • mobile/rpc-foundation/goldens/matrix-live-worktree-name-runtime.clientevents.subscribe-1-1.json
  • mobile/rpc-foundation/goldens/matrix-live-worktree-name-runtime.clientevents.subscribe-1-2.json
  • mobile/rpc-foundation/goldens/matrix-live-worktree-name-runtime.clientevents.subscribe-2-1.json
  • mobile/rpc-foundation/goldens/matrix-live-worktree-name-worktree.show-1.json
  • mobile/rpc-foundation/goldens/matrix-live-worktree-name-worktree.show-2.json
  • mobile/rpc-foundation/goldens/matrix-live-worktree-name-worktree.show-3.json
  • mobile/src/components/AddProjectModal.tsx
  • mobile/src/host-screen/host-project-added-handoff.test.tsx
  • mobile/src/host-screen/host-screen-overlays.tsx
  • mobile/src/host-screen/host-worktree-catalog-action-error.test.ts
  • mobile/src/host-screen/use-host-screen-state.ts
  • mobile/src/host-screen/use-host-worktree-actions.ts
  • mobile/src/host-screen/use-host-worktree-catalog.ts
  • mobile/src/test-support/rpc-recording/adapters/client-event-stream-mount-adapters.ts
  • mobile/src/transport/use-worktree-resync.ts
  • mobile/src/worktree/host-worktree-refresh.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • mobile/src/components/AddProjectModal.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one minor suggestion inline.

Reviewed changes

Re-reviewed the delta since the prior pullfrog review at 115d82d; the substantive change is 6ca1963 (fix(mobile): land Add project on the repo's default checkout).

  • Add project lands on the default checkout — handleProjectAdded awaits the refreshed catalog, finds the added repo's main worktree, and opens its session; a catalog with no main row for the repo leaves the user on the refreshed list.
  • Concurrent catalog fetches share the in-flight request — fetchWorktrees now returns the shared Promise<Worktree[] | undefined> instead of resolving empty-handed, and the signature threads through the refresh/resync callers.
  • Recordings and tests — the five worktree-action goldens repin adapterSha256 only; new handoff and in-flight-sharing tests were added. The earlier 115d82d → 619ecc4 rebase delta was type-only.

ℹ️ Nitpicks

  • The PR description still says a successful add opens the New workspace form with the repo preselected, but 6ca1963 changed the landing to the default checkout. Worth updating so the description matches the code.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment on lines +80 to +86
useEffect(() => {
if (visible && preselectedRepo) {
// Why: this hook's effects run after useNewWorkspaceRepositories' own, so a repo
// just added from the phone overrides the last-visited default in the same commit.
upsertRepo(preselectedRepo)
}
}, [visible, preselectedRepo, upsertRepo])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6ca1963 reroutes onProjectAdded to handleProjectAdded (which opens the default checkout) and nothing else calls openNewWorktreeModal(repo), so this preselection path is now unreachable in production: preselectedRepo is always null and upsertRepo never runs. Either remove the now-dead plumbing or wire it up as the fallback when the refreshed catalog has no main worktree for the added repo.

Technical details
# Unreachable add-project preselection plumbing

## Affected sites
- `mobile/src/components/NewWorktreeModal.tsx:80-86` — this `useEffect` calls `upsertRepo(preselectedRepo)`, but `preselectedRepo` is never supplied in production.
- `mobile/src/components/NewWorktreeModalController.tsx:42,48-51` — `preselectedRepo` state and the `open(repo)` argument; `openNewWorktreeModal` is only ever called with no argument (`use-host-worktree-actions.ts:80`, `host-screen-overlays.tsx:223`).
- `mobile/src/components/use-new-workspace-repositories.ts:36-52,110` — `upsertRepo` is only consumed by the unreachable effect above.
- `mobile/src/components/new-worktree-modal-types.ts:27` — `preselectedRepo` prop field.
- `mobile/src/components/NewWorktreeModal.test.tsx:544-582` — the new test feeds the prop directly, so it covers only the dead wiring.

## Required outcome
- The added repo still joins the New workspace list and is selected when that form is opened for it, OR the plumbing is deleted with the test that only exercises the prop.

## Suggested approach (optional)
- If the no-main-worktree case should fall back to the create form, call `openNewWorktreeModal(repo)` there instead of doing nothing; otherwise delete the controller state/prop/effect/`upsertRepo` and the prop-only test.

…ion / create parent

Move the clone-default-parent helper into shared code and add two host-side
default resolvers (clone destination, create parent) that both the desktop IPC
handlers and the runtime controllers now share, so mobile callers can omit
destination/parentPath and get the same defaults the desktop flows use.
repo.clone's destination and repo.create's parentPath become optional (a wire
loosening), and a repo.add-project-mobile.v1 runtime capability is declared for
mobile gating.
Add repo.add, repo.create, and repo.clone to the mobile RPC allowlist and let
the runtime controllers resolve the clone destination and create parent from
host settings when the caller omits them, so a paired phone can add a project
(clone from URL, create empty, add existing path) without typing host paths.
The desktop create-default IPC handler now delegates to the same shared policy.
…e + sheet

The + button now opens a two-choice sheet — New workspace / Add project —
mirroring the desktop + area's two buttons. Hosts without the
repo.add-project-mobile.v1 capability skip the sheet and open the create
form directly, as before.

Add project mirrors the desktop start steps minus the SSH row: Browse
folder (repo.add with a typed host path), Clone from URL (repo.clone with
the host-side default destination, 10-minute budget), and Create new
project (repo.create, git init + initial commit). A successful add closes
the sheet and opens the New workspace form with the new repo upserted and
selected — the handoff fires from the drawer's onAfterClose so iOS never
presents two native modals in the same beat.

The worktree-actions recording mount adapter passes no capabilities
(hostCapabilities: []), so the + entry falls back to the create form in
recordings, matching legacy hosts.
The standalone Add project flow opened the create-worktree sheet after a
clone because it reused the composer-nested flow's continuation, which
returns to the composer with the new repo selected. The desktop
standalone Add project instead opens the added repo's default checkout
(main worktree) session.

Await the refreshed worktree catalog and find the repo's main worktree,
then open its session; with no main row for the repo, stay on the
refreshed host list. On upstream's query-backed catalog this awaits the
refetch (joining any read in flight, then reading once more so the rows
cannot predate the call), and the handoff plus the + sheet's openers live
in host-project-admission-actions to keep the actions hook under the
max-lines ratchet.
Upstream moved under this branch again: the low-value test sweeps deleted
the five harness files this commit used to re-fit, and what survives is
the Add project handoff test — its graph now reaches the host-catalog
removal lifecycle and haptics (both stubbed), the actions hook reads the
shared query client (the probe mounts inside a QueryClientProvider with a
minimal connection surface), and its state fake carries the empty
server-workspace list the handoff's session open consults.
…iled

The awaited fetchWorktrees dropped the pre-rebase guards when it moved
onto the query-backed catalog: it would fire a doomed read while the
host is not connected, and a failed read answered with the cache's last
good rows, which can predate the change the read was for — a weaker
promise than the "confirmed rows" the handoff lands on.

Skip the read while no client or the connection is down, and answer
undefined when the query settled in error, so the handoff stays on the
list exactly where it used to. Prove the join-then-read-again ordering
(the rows cannot predate the call), the single idle read, and both
stays-put answers with the catalog hook's first direct test — the ones
covering the old in-flight dedup went with upstream's test sweeps.
…superseded

The Add project flow first landed by opening the create-workspace sheet
with the added repo upserted and selected; landing on the repo's default
checkout replaced that path, but the plumbing stayed — openNewWorktreeModal's
optional repo, the preselected sheet state, and upsertRepo's
list-and-catalog write-through had no caller passing a repo anymore.

Delete the chain outright rather than keep lines a reviewer must prove
unused: the sheet still reopens on the last-visited default, and its own
repo.list read now carries the added repo either way.
@dudupii
dudupii force-pushed the feat/mobile-clone-from-url branch from a1509e1 to ae9d882 Compare November 15, 2026 07:36
…ile-clone-from-url

# Conflicts:
#	mobile/src/host-screen/host-screen-overlays.tsx
#	src/main/ipc/repos/repo-creation-handlers.ts
Absorbs 3254 upstream commits since the November merge. Conflict
resolution:

- shared layout moves followed upstream (execution-host/, repository/,
  repository/appearance/, orca-profiles/constants, file-access/)
- the desktop default-create-project-parent helper replaced the deleted
  shared/git/repo-default-locations (registration controller, clone
  controller's defaultDestination, repo-creation handlers; the local
  wrapper was dropped in favor of the runtime helper)
- mobile-runtime-capabilities keeps both the repo.add-project-mobile.v1
  and notifications.push-coverage.v1 entries
- host-screen keeps the Add Project entry (FolderPlus icon,
  handleProjectAdded) alongside upstream's row writes; en.json keeps
  both sides' strings
- runtime-repository-registration-controller.test.ts kept (upstream
  deleted it in stablyai#46786's suite cut) with imports moved to the upstream
  layout: it holds the mobile repo.add/create host-side-defaults
  assertions this PR adds
@dudupii

dudupii commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Visual proof — real device

Screenshots from a real Android phone (not an emulator) running the fork's personal build: the + sheet offering Add project, the three add-project entries, and each flow — Browse folder, Clone from URL, Create new project.

Step Screenshot
+ → New workspace / Add project plus sheet
Add project entries entries
Browse folder browse
Browse folder (path) browse2
Clone from URL clone
Create new project create

Context: #21669 / #24018.

@AmoabaKelvin

Copy link
Copy Markdown
Collaborator

Thanks for working on this, it pushed this forward. We've shipped it as part of a broader set of phone changes in #51814 (with #51817 and #51819), built on the same host methods, so I'm closing this one. If anything you covered here is still missing, please open an issue and we'll pick it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Mobile - clone a new repository from a GitHub URL

2 participants