Repository navigation
#833 Remove a worktree - #979
Conversation
Search covers Home's pane: a search field (focused, keyboard up), a scope chip that starts at Home's project scope, and Home's rows for sessions whose title matches, with the match highlighted. Ctrl+F opens it; Esc clears the query, then closes. - Domain: SessionRepository.searchSessions sends `search` on v1 (`/session`, `roots=true`) and v2 (`/api/session`, `parentID=null`, `archived=false`), then filters the reply locally so servers that ignore `search` still give correct results. - SessionSearchViewModel: Home rows match on every keystroke; the server search runs after a 250 ms debounce, merges server-only sessions, and keeps local results when it fails. - Design system: Search text input kind (spinner while busy, clear button), list item title highlight, new OpenCodeMenuChip. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Home's Settings button becomes a ⋯ menu that holds Settings for now. HomeMenu (iOS and Android) puts feature entries first, in order, and adds Settings last behind a divider, so Search sessions, Archived sessions and Worktrees each add one entry. The shared overflow menu gains a dividerAbove slot, and on iOS a whole menu row now takes the tap, not just its icon and text. ⌘, / Ctrl+, still open Settings. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add an Archived sessions screen on Android and iOS: Home's scope, grouped
This week / Earlier by archive time, with one-tap Unarchive (snackbar with
Undo), an actions sheet (Unarchive, Open, Delete…) and a live refresh on
session.archived / unarchived / deleted. Session Chat shows an "Archived
<time>" banner with Unarchive.
v2 lists with ?archived=true and restores with PATCH {archived: false}.
v1 can archive but cannot clear time.archived, so a new
supportsArchivedSessions capability hides the feature there.
ArchivedSessionList is shared so search can reuse it for archived results.
The Home ⋯ menu entry lands after the #929 menu foundation.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Search covers Home's pane: field with scope chip, Home's own rows with the title match highlighted, server search per added path (v1 search/roots, v2 search/parentID=null/archived=false, both re-filtered locally), Cmd-F in the Go menu, and Esc clearing the query before closing. Design system: search text input kind with busy spinner and clear button, list item title highlight, below placement for the anchored overflow menu, and OpenCodeMenuChip, each with gallery entries. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n Back Co-Authored-By: Claude Opus 5.5 <[email protected]>
Worktrees screen on iOS and Android: every worktree of Home's projects
grouped under the main checkout, with sessions, a Running pill and the
server's uncommitted change count. Its actions sheet shows the sessions
on Home, starts a new session there, or removes the worktree after a
confirmation that warns about lost changes and kept sessions. A running
session blocks removal.
- v2: DELETE /api/worktree {projectID, directory, force}; a forceRequired
400 asks again before forcing. v1: DELETE /experimental/worktree.
- Change counts from vcs/status on both protocols.
- Home and the screen share an app-scoped feed: Home publishes projects
and sessions, the screen sends scope, new-session and removed requests.
- Sessions of a removed worktree stay on Home with the folder struck
through and "worktree removed" (v1 keeps their last list).
- OpenCodeDialog notes and a Removed list subtitle tone on both platforms.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The Worktrees view built a Screen Model on every parent render and each one fetched VCS status; loading now starts on appear (iOS). - Rows put the session count above the path so long server paths no longer hide it. - Dialog notes wrap on iOS. - Compact Home rows strike a removed worktree through, with the removed note for screen readers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…into claude/929-search-sessions-17ace1 # Conflicts: # ios/OpenCode Mobile/OpenCode Mobile/UI/Main/ProjectListHomeView.swift
Both apps add Search sessions above Settings in the Home ⋯ menu once Home has loaded; it opens search on Home's scope, like ⌘F / Ctrl+F. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…into feature/833-restore-archived-sessions
The ⋯ menu lists "Archived sessions" with "N in <scope>", counted when the menu opens and left out on servers that cannot restore archived sessions. It opens the Archived sessions screen for Home's current scope. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Third feature entry in Home's ⋯ menu (#976), subtitle "N across M projects" or "None". Opens the Worktrees screen on both apps. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@cursor review |
There was a problem hiding this comment.
Automated review: no finding that 2+ of 3 passes agreed on.
10 finding(s) from a single pass, not posted
android/app/src/main/java/dev/opencode/mobile/ui/worktrees/WorktreesViewModel.kt:220high: V1 dirty worktree removed without warning when VCS status unknown (muse-spark-1.3-contributor)ios/OpenCode Mobile/OpenCode Mobile/UI/Worktree/WorktreesViewModel.swift:153high: V1 dirty worktree removed without warning when VCS status unknown (muse-spark-1.3-contributor)android/app/src/main/java/dev/opencode/mobile/ui/worktrees/WorktreesViewModel.kt:179high: Show sessions / New session here close the screen before Home can act (deepseek-v4.1-flash)android/app/src/main/java/dev/opencode/mobile/ui/main/MainScreenViewModel.kt:1701medium: Race drops v1 removed-worktree sessions instead of retaining them (muse-spark-1.3-contributor)android/app/src/main/java/dev/opencode/mobile/ui/worktrees/WorktreesViewModel.kt:315medium: VCS change counts never reset, stale across servers (muse-spark-1.3-contributor)android/app/src/main/java/dev/opencode/mobile/ui/worktrees/WorktreesViewModel.kt:1757medium: Forced retry after ForceRequired is stuck as 'Remove anyway' with no uncommitted change data (deepseek-v4.1-flash)android/app/src/main/java/dev/opencode/mobile/ui/worktrees/WorktreesViewModel.kt:1806medium: Removed-row bookkeeping is dropped as soon as Home regroups, unmarking the sessions (deepseek-v4.1-flash)ios/OpenCode Mobile/OpenCode Mobile/UI/Worktree/WorktreesViewModel.swift:4226medium: confirmRemove reads the dialog after clearing it (deepseek-v4.1-flash)ios/OpenCode Mobile/OpenCode Mobile/UI/Worktree/WorktreesViewModel.swift:4297low: Change-count tasks are unstructured and can publish after the view goes away (deepseek-v4.1-flash)android/app/src/main/java/dev/opencode/mobile/ui/components/list/SessionList.kt:783low: Removed note segment repeats the separator when the removed part is not last (deepseek-v4.1-flash)
opencode pr-review · passes: muse-spark-1.3-contributor, glm-5.3-flash, deepseek-v4.1-flash · $0.104 · 1 pass(es) stopped early
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a398746. Configure here.
…sions' into claude/929-search-sessions-17ace1 # Conflicts: # android/app/src/main/java/dev/opencode/mobile/domain/session/V2SessionRemote.kt # android/app/src/main/java/dev/opencode/mobile/ui/components/list/SessionList.kt # android/app/src/main/java/dev/opencode/mobile/ui/main/MainScreen.kt # ios/OpenCode Mobile/OpenCode Mobile/Components/List/SessionList.swift # ios/OpenCode Mobile/OpenCode Mobile/UI/Main/ProjectListHomeView.swift
Both branches add a Home route, menu entry, analytics names and a Container factory; all kept. Menu order: Archived sessions, Worktrees. Co-Authored-By: Claude Opus 5.5 <[email protected]>
On servers that list archived sessions (#833), search lists every Home project's archived sessions once on open and matches their titles locally. An "Include archived · N" toggle chip (N in scope) adds them in their own Archived section with an Archived tag; with no match, the empty state offers Include archived when it would find something. The search chip gains a Toggle variant (no chevron, switch semantics). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Home menu: recount the Archived sessions entry once Home's server probe finishes, so it shows on the first open after launch (both apps). - Android overflow menu: size the panel to its widest entry; a divider no longer stretches it to the window. Gallery gains the Home menu shape. - iOS: archived rows drop the long-press overlay that covered the trailing Unarchive button; a tap still opens the actions. - Delete confirmation names the session and says it is deleted from the server for good, from a target the closing sheet cannot clear. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…anges - Android: one failed path no longer drops the other paths' server matches; when every path fails the last answer stays (as on iOS). - Android: a new keystroke keeps the previous server matches until the next answer replaces them, instead of hiding them for the debounce. - Both: when Home's lists in scope change (a project added or removed, or the scope falls back to All projects), search drops the removed projects' server rows and searches again at once. Live updates that keep the same lists do not search again. - Android: switching server closes search, as on iOS. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A worktree whose change count could not be read (still loading, or the status request failed) no longer confirms as clean: the dialog says changes can't be checked and the button reads Remove anyway. v2 still sends force only when changes are known, so a dirty checkout comes back as forceRequired; v1 always forces, so the warning comes first. - A forceRequired answer forgets the stale count. - Cached change counts reset when Home clears for another server. - iOS keeps a removed worktree's v1 extra sessions when they carry only their worktree directory; Android records the removed worktree on Home before reloading, so the extra-session sync keeps them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Undo the overflow menu width change; #976 fixes the divider there. - Session Chat: session.unarchived clears the banner directly, and an archive change since a session read began wins over that read, so a lagging GET no longer brings the banner back (both apps). iOS also clears the banner on rebind. - Archived list: unarchived or deleted rows stay gone while a list still carries their old archive time; Undo rows keep their project, so an unknown directory no longer drops them; one failing project keeps the others listed (both apps). - iOS: subscribe to events before the first load, and report cancellation from ArchivedSessionList. Co-Authored-By: Claude Opus 5.5 <[email protected]>
HorizontalDivider fills the width it is offered, and the panel offered the popup window's width, so a divider stretched the menu across the screen. The panel column now takes its widest row's intrinsic width, and every row fills it, so the whole row takes the tap as on iOS. Adds a grouped preview (subtitles plus divider) on both platforms and an instrumented layout test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Device run: a project added through a symlinked path (/tmp vs /private/tmp) showed its own folder as a removable "main" worktree. - v2 worktree lists drop entries without a strategy: the project's own directory, which the server cannot remove. Home adds the main checkout itself. - Home passes the server-listed worktree directories (minus every main checkout) to the Worktrees screen; only those become rows. An added path the server does not list stays out, on both apps. - Android: the footer animates with the list, so it no longer sits under a row that is leaving. - Android: the ⋯ menu subtitle counts from projects only instead of rebuilding the session snapshot on every Home state change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Triage of the 10 single-pass findings from the automated review, fixed in 3ce7220 where real:
Also from the device run, in 0ff9f4e: only worktrees the server listed become removable rows (a symlinked project path no longer shows its own folder as a "main" worktree), the Android footer animates with the list, and the ⋯ menu counts from projects only. |
…into feature/833-restore-archived-sessions
…sions' into claude/929-search-sessions-17ace1 # Conflicts: # ios/OpenCode Mobile/OpenCode Mobile/UI/Archived/ArchivedSessionsViewModel.swift
Home's Done pill is server unread state. Unarchive from the Archived screen must not acknowledge it; only opening the session does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Search's chips sit in a row that scrolls sideways. There the title's `weight(1f, fill = false)` had no width to share and collapsed, so the scope and Include archived chips showed only their icons. The title now has a width cap instead of a weight. Adds an instrumented Compose test that puts both chips in a sideways scrolling row and checks their titles show. Co-Authored-By: Claude Opus 5.5 <[email protected]>
main's only new commit is the #976 squash, whose tree matches fa295aa, already merged here in a9d2fac, so this branch's tree is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
v1 device run on macOS: a worktree listed as /tmp/… also reached Home as /private/tmp/…, so the Worktrees screen showed it twice and counted 2. - Worktree folders compare with /tmp, /var and /etc treated as the same as their /private targets: one row per folder (the server's spelling, used for the remove request), session counts under either spelling, the main checkout excluded under either spelling, and Home's removed marks match either spelling. Both apps, both protocols. - Rows, sheet, dialogs and snackbars name the worktree by its folder, as on v2, instead of the v1 branch (opencode/<name>). - A remove that gets no answer says "Couldn't remove “x”. Check the connection and try again."; the transport text goes to the diagnostic log. - The ⋯ menu shows no Worktrees subtitle until Home has listed worktrees, instead of "None". Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Automated review: no finding that 2+ of 2 passes agreed on.
1 finding(s) from a single pass, not posted
android/app/src/main/java/dev/opencode/mobile/data/remote/WorktreesApi.kt:96high: v2 remove sends projectID where the server expects projectID, but body key likely mismatches spec? (deepseek-v4.1-flash)
opencode pr-review · passes: muse-spark-1.3-contributor, glm-5.3-flash, deepseek-v4.1-flash · $0.110 · 1 pass(es) stopped early · 1 pass(es) failed
- Dedupe archived sessions after sorting, so a duplicate keeps its newest copy. - A row Undo put back settles against any archive time when unarchived again, since the app never saw the server's time for it. - Android: capture the archive generation before launching the read; the v2 project lookup rethrows cancellation. - iOS: recheck the menu entry with Home's current projects. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> # Conflicts: # android/app/src/main/java/dev/opencode/mobile/domain/session/V2SessionRemote.kt
main's tree equals #977's final commit f30175e, merged in the parent. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Menu entries kept in order: Search sessions, Archived sessions, Worktrees; Localizable.xcstrings merged by key. Co-Authored-By: Claude Opus 5.5 <[email protected]>
On v1, iOS Home folds the sessions of a project's non-added worktrees into the added path's section, but search only asked the added paths, so a server match in such a worktree was missed (Android already asks these lists). Home now passes those directories to search, which asks them too and files their matches under the added path's section, the way Home shows them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
main's tree equals #978's final commit 032ee67, already merged here in a6e1364, so this branch's tree is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
On the single-pass finding at ff6bd07 ( |




















Summary
Part 2 of #833: remove a worktree, on iOS and Android, for v1 and v2 servers. Targets
main; #976 and #977 are merged. This branch also merges #978 (Search sessions), so until #978 lands the diff includes it. Merge #978 first.OpenCodeBottomSheet): Show sessions on Home (sets Home's scope picker to the worktree), New session here (the existing new-session flow), Remove worktree….OpenCodeDialog):Server
DELETE /api/worktree {projectID, directory, force}(204). Withoutforce, a dirty checkout fails with 400WorktreeErroranddata.forceRequired; the app then asks again before forcing.POST /api/worktree/refreshafterwards.DELETE /experimental/worktree?directory=<main checkout>with{directory}; the server always forces, so the warning comes first. A 404 means the server has no remove route.GET /vcs/status?directory=, v2GET /api/vcs/statusat the worktree's location.Architecture
RemoveWorktreeRequest,WorktreeRemoveError(forceRequired,unsupported,failed),WorktreeRemote.removeV1/removeV2,WorktreeRepository.remove.HomeWorktreesFeed(app-scoped): Home publishes its projects and sessions; the Worktrees Screen Model sends Show sessions / New session / Removed back. Keeps the Home Screen Model edits small.WorktreesViewModelon both apps (immutable state + explicit actions).OpenCodeDialoggainsnotes(Info / Warning, drawn as banner inline notices; gallery toggle and preview). List subtitle toneRemovedand a removed state on the compact path.worktrees.*andsession_list.worktree_removedon both platforms (check-string-keys.mjspasses).Checks
:app:testDebugUnitTest3337 tests, 0 failures after merging #833 Restore archived sessions #977 (newWorktreesViewModelTest, remove tests inDefaultWorktreeRepositoryTestandWorktreesApiTest, removed-row cases inCrossProjectSessionListSessionsTest).build-for-testingsucceeds after merging #833 Restore archived sessions #977. Before the device-run freeze,WorktreesViewModelTests,WorktreesAPIClientCreateTests,ProjectListHomeViewModelTestsandHomeWorktreeMarksTestspassed (128).WorktreesViewModelTests.menuSubtitleCountsWorktreesAcrossProjectswas added after that and is compiled, not yet run.Evidence
Screenshots in the evidence comment: both apps on v2 through the scenario harness, captured before the menu entry existed (temporary hook). The menu entry and v1 are left for the shared-device run.
Issue
Fixes #833
Part 1 (restore archived sessions) is #977, below this in the stack; with both merged the issue is done.
Risks / Follow-ups
🤖 Generated with Claude Code