Repository navigation
Closed
Labels
enhancementNew feature or requestin-progressImplementation started, work still incompletepriority: mediumNon-blocking V1 work and polishsharedShared or cross-platform implementation
Description
Worktrees can be switched off, New session starts on the main checkout without asking, and the project picker stays short and reorderable however many worktrees a project has.
Follow-up to #780. Feedback after it shipped:
- Being asked where to run every time is noise when you just want main. Start on main, and move to a worktree later when you need one.
- With every worktree listed inline, the picker can't be reordered properly.
- With many worktrees (10, say) you have to scroll to reach the next project.
Prototype variant A · Collapsed, expand on demand was chosen. The prototype source is on branch prototype/worktree-mode.
Behaviour (iOS and Android)
Worktrees setting
- Settings → Home → Worktrees, on by default, so the current behaviour is kept. Copy: "Show each project's worktrees and branches on Home, and let New session pick a worktree when you hold it."
- Off: rows show the project without branch or folder; the picker lists projects only; there are no worktree scopes; New session never asks; Session Chat's "Move to worktree…" is disabled with the hint "Turn on Worktrees in Settings". Sessions from every worktree stay listed under their project. Grouping by project ID from Group worktrees under one project on Home #780 doesn't change.
New session
- Tap: start on the main checkout of the current project. If Home is filtered to a worktree, start in that worktree. Nothing is asked. In the All scope, keep today's project choice.
- Hold: opens the New session sheet. For a project with more than one worktree (and Worktrees on), it shows the Run in list from Group worktrees under one project on Home #780. Reconcile this with the existing long-press project chooser so one hold gesture covers both.
Project picker (variant A)
- Projects only, as before Group worktrees under one project on Home #780. A project with more than one worktree shows a "N worktrees ⌄" pill on its row.
- Tapping the pill expands that project's worktrees inline, under the project. Opening another project's worktrees closes the first (one open at a time).
- With more than 5 worktrees, show 5 and a "Show all N" row.
- Tapping a project row (not the pill) selects the whole project; tapping a worktree row selects that worktree, as in Group worktrees under one project on Home #780.
- Edit in the sheet header enters reorder mode: everything collapses and projects get drag handles. Worktrees stay with their project. Swipe-to-remove stays on project rows.
Dock
- Swiping the dock scope walks All and projects only. Worktrees are reached from the picker. In Group worktrees under one project on Home #780 it also walked worktrees.
Move to worktree
- Session Chat ⋯ → Move to worktree… lists the project's worktrees (branch, "main checkout" or folder name), with the current one checked.
- v2:
POST /api/session/:id/movewith the target location. The session's directory, header and Home row update afterwards. Server note: "Move a session to another project directory at the requested delivery boundary". Confirm whether a running turn finishes first. - v1 has no move endpoint: show the item disabled with "Needs an opencode v2 server" (controls stay visible).
- Creating a new worktree stays in Create worktrees from the apps #752.
Acceptance
- The Worktrees setting exists on both platforms. Turning it off removes worktree rows, branches and scopes, and New session never asks. Turning it back on restores them.
- Tapping New session starts on the main checkout, or in the filtered worktree, without a sheet. Holding it opens Run in for multi-worktree projects.
- The picker collapses worktrees behind the pill, one project open at a time, with "Show all N" above 5.
- Edit reorders projects, with worktrees collapsed, and the order persists.
- The dock swipe skips worktrees.
- Move to worktree works on v2 and updates Session Chat and Home. It is disabled with an explanation on v1.
- Unit tests cover the setting's effect on Home state, the New session target, the picker's expand/collapse and reorder state, and the move action on both platforms.
- Real-app evidence on iOS and Android, v1 and v2, attached here.
Remaining:
- iOS implementation
- Android implementation
- Real-app evidence on v1 and v2
- Android: Session Chat follows
session.movedin place (same ViewModel). The timeline and scroll stay, the header and branch update in about 1 s, and fast consecutive moves end in the right worktree. Before, a route replace reloaded the chat and could drop moves. - Back after a move once exited the app instead of returning to Home. It did not reproduce: clean path, entry through the closing picker, a new session, and nine fast moves from another client all returned to Home. The route replace it went through is gone.
Related: #780 (worktree grouping), #783 (Session Chat header), #752 (create and remove worktrees).
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestin-progressImplementation started, work still incompletepriority: mediumNon-blocking V1 work and polishsharedShared or cross-platform implementation
Activity
ivanfenenko commentedon Oct 21, 2026
Real-app evidence (PR #786)
Real apps against the real opencode v1 (1.19.1) and v2 (
dev4d5965762e) through the scenario harness. The fixture isacme-invoiceswith 8 worktrees, plusbilling-api, and harness data only. v2 was tested cold, right after a server restart. iOS ran on an iPhone 17 simulator and Android on a Pixel 9a emulator, both built from the merged branchbcf935f2.session.moved; header ~1 s; Home row regroupssession.moved; header 4–8 s; Home row regroups"–" = not run on that protocol; the behaviour does not depend on the protocol, and unit tests cover it on both platforms.
iOS
Android
Found during the run (also listed in the PR's Risks):
session.moved, because it reopens the session through the session-replace route. iOS updates in about 1 s.#785 Android: follow session.moved in place in Session Chat
#785 Worktrees setting and a collapsible project picker (#786)
Finish the region split for Home and Session Chat on both platforms (#…