Repository navigation
#752 Create worktrees from the apps - #788
Merged
Merged
Conversation
…ository v2 POST /api/worktree (projectID, from, name, optional branch) and GET /api/vcs/branch; v1 POST /experimental/worktree?directory= with the name. The repository routes by protocol, keeps the server's words for errors, and treats a v1 404 as a server that cannot create worktrees. Co-Authored-By: Claude Opus 5.5 <[email protected]>
WorktreeCreateModel holds one immutable form state (prefilled name, validation, read-only branch, v2 base list, submit and error) shared by the Run in and Move sheets. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Hold on New session opens Run in whenever Worktrees is on, so a single-checkout project reaches New worktree…. Run in creates, refreshes the project's checkouts and starts a session there; Move creates from the session's checkout and moves the session. Move to worktree… is enabled for a single checkout when a worktree can be created. Co-Authored-By: Claude Opus 5.5 <[email protected]>
v2 POST /api/worktree (projectID, from, name, optional branch) and GET /api/vcs/branch for base refs; v1 POST /experimental/worktree with the server's answered name and branch. A v1 404 marks the server as unable to create until the connection changes. Errors use the server's message, else the plain body, else the HTTP status. Co-Authored-By: Claude Opus 5.5 <[email protected]>
WorktreeCreateForm holds one immutable form state (name, v1 branch, v2 base list, submit, error) with explicit actions, shared by Run in and Move. NewWorktreeAvailability orders the disabled reasons for both rows. HomeProject keeps hasVcs so a git folder without a commit says so. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Hold on New session (or a hold pick) opens Run in whenever Worktrees is on, also for one checkout, with "New worktree…" after the checkouts. The form replaces the list in the same sheet; a create lists the new checkout on Home and starts a session there. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Move sheet ends with "New worktree…": create a checkout from the session's one, then move there. Move to worktree… is enabled for a single-checkout project while a worktree can be created. Home relists the project's worktrees after the create. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The read-only branch and base notes, the Move row subtitle and the unsupported-server reason were cut off on iPhone list rows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Session Chat opened by New session (or Run in → New worktree) keeps the optimistic placeholder as its route id. On session.moved the view model was rebuilt with that placeholder, which created a second, empty session in the destination worktree. Rebind with the id the server gave the created session. Co-Authored-By: Claude Opus 5.5 <[email protected]>
9 of 11 tasks
This was referenced Oct 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Create a git worktree from the phone on opencode v1 and v2, on iOS and Android:
POST /experimental/worktree) always creates branchopencode/<name>from the current checkout, so both fields are read-only with a note.POST /api/worktree) only takes a start ref: the checkout is detached ("No branch (detached)"), and the base comes from/api/vcs/branch.worktree.updated; v1 reload of the project's list).Checks
./gradlew :app:testDebugUnitTest :app:assembleDebug: 2635 tests, 0 failures (1 skipped), build OK.OpenCode MobileTeststarget, UI tests skipped: 2582 tests in 251 suites passed.dev(cold restarts), checked withgit worktree list(table below, also on Create worktrees from the apps #752).Issue
#752. Worktree removal and naming a branch on v2 remain open on the issue.
Risks / Follow-ups
git worktree add --detach, and no v2 endpoint creates a branch. The form says so. This is recorded on Create worktrees from the apps #752.HomeProject.hasVcsfor the no-commit case.Real-app evidence: create worktrees (iOS + Android, opencode v1 + v2)
Real apps against the scenario harness: real
opencode servev1 1.19.1 and v2dev4d5965762e, throwaway git projectacme-invoices, harness data only. The v2 runs started right after a server restart (cold/api/vcs). Each worktree was checked with git afterwards.opencode/<name>and base read-only; v2 "No branch (detached)" with a base picker from/api/vcs/branchopencode/gentle-meadowtidy-lynx(baseopencode/lucky-panda)opencode/lucky-pandazesty-falcon(baseopencode/gentle-meadow)brave-pebble→zesty-cometzesty-falcon→tidy-panda/project)Git after the runs (full output): v1 checkouts are on branches
opencode/gentle-meadowandopencode/lucky-panda; the six v2 checkouts are(detached HEAD), as the v2 API does.Found and fixed during the run (iOS): moving a chat opened by New session (e.g. right after Run in → New worktree) created a second, empty session in the destination, because the view model was rebuilt with the optimistic placeholder id. Fixed in this PR; the rerun shows only
POST …/movethen…/view.Android
iOS
* Taken before the read-only notes were shortened (they were cut off at one line on iPhone); the later shots show the final copy.
Not checked on device: Worktrees setting off, a server error shown inline (e.g. a bad base ref), tablet/split layouts, dark mode. These are covered by unit tests or unchanged.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmithwith what you need.