refactor(worktrees): replace the sidebar surface with a session toggle - #1798
Merged
Merged
Conversation
Managed worktrees were exposed as a WORKTREES group in the workspace list, plus a launcher dialog, a manager modal, and four workspace menu entries. That put an execution detail at the same level as projects and assistants, which is not where the concept belongs. Worktree isolation is now a property of a session: a checkbox chip next to the branch in the chat input strip, shown for Git workspaces. Turning it on creates a managed worktree and rebinds the session; turning it off returns the session to the project checkout and removes the worktree when it is clean, keeping it (with the path reported) when it still holds local work. The toggle is locked once a session has a transcript, since the history describes work done in one specific directory. Worktree sessions now appear directly in the project's session list instead of a separate group, so the removed `localSessionsOnly` filter no longer hides them. Also fixed while here: - the strip labelled worktree sessions with the worktree directory basename, which is a generated id; it now keeps the owning project's name - useGitState only auto-refreshes on mount, so the branch went stale when the execution root moved; the strip now refetches on a path change - dropped the `defaultTarget` setting, whose only consumer was the launcher
…ession Every command in generate_handler! must appear in REMOTE_WORKSPACE_COMMAND_POLICIES. RemoteUnsupported matches the other worktree commands and what the binding already does: load_binding_context rejects remote sessions and remote project paths up front.
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
Managed worktrees were exposed as a
WORKTREESgroup in the workspace list, plus a launcher dialog, a Worktree Manager modal, and four workspace menu entries. That places an execution detail at the same level as projects and assistants, which is not where the concept belongs — neither Claude Code nor Codex surfaces worktrees there.Worktree isolation becomes a property of a session: a checkbox chip next to the branch in the chat input strip, shown for Git workspaces.
HEADand rebinds the session to it.The toggle is locked once a session has a transcript, since that history describes work done in one specific directory.
Removed:
ProjectWorktrees,WorktreeManagerModal,WorktreeLauncherModal,worktreeUIEvents, the nav top-action button, the four workspace menu entries, andworktreeWorkspaceService(which already had no production callers).Added:
worktree_bind_sessioncommand backed byWorktreeService::bind_session, which performs the worktree create/release and the session rebind as one step. Session storage stays keyed onproject_workspace_path, so a session keeps its transcript identity across the move, and a failed rebind rolls the new worktree back.Fixes #
Type and Areas
Type: Refactor / UI-UX
Areas: web UI, Rust core (
assembly/coreworktree + session manager), desktop/Tauri commands, stable contracts, locales, E2EMotivation / Impact
The worktree list competed for attention with the project list while describing something users rarely browse. The thing they actually want is per-session: run this agent somewhere that will not collide with my other agents. Putting the control next to the branch — where the session's execution location is already displayed — expresses exactly that, and removes an entire sidebar surface plus two modals.
Worktree sessions now appear directly in their project's session list rather than in a separate group. The
localSessionsOnlyfilter that hid them from the project row was only there to avoid duplicating theWORKTREESgroup, so it is gone.User-facing: the launcher and manager are no longer available. Existing managed worktrees are unaffected — they remain in the registry, sessions bound to them keep working, and the deferred
Worktreeagent tool still lists, creates, branches, and removes them.Verification
Not run: the E2E suite.
tests/e2e/specs/l1-worktree.spec.tsandl1-worktree-restart.spec.tswere rewritten to drive the new toggle (chat-input-worktree-toggle) instead of the launcher dialog, and type-check clean, but they were not executed against a built desktop binary.Pre-existing and unrelated:
bitfun-relay-server'slibrary_compattest fails to compile onupstream/main(missing field page_browser_auth). Confirmed against a clean tree.Reviewer Notes
Three latent problems surfaced while wiring this up and are fixed in the same commit:
useGitStateonly auto-refreshes on mount; moving the execution root under a live strip left the previous directory's branch on screen. The strip now refetches when the path changes (regression test added).defaultTargethad exactly one consumer, the launcher. Dropped fromWorktreeSettingsand from theWorktreeDefaultTargetcontract. Root path, branch prefix, and copy-local-changes are kept — the toggle still uses all three.Ordering detail worth a look:
disable_session_worktreerebinds the session before attempting removal, becausevalidate_removalcounts sessions still pointing at the worktree and would otherwise reject its own caller withworktree_busy.Checklist