feat: switch a worktree to another profile after creation - #302
Merged
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vx7XU35JjpJ26Rcn4jTKWB
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vx7XU35JjpJ26Rcn4jTKWB
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
webmux | 7bb7819 | Commit Preview URL Branch Preview URL |
Jul 29 2026, 10:04 AM |
diegoimbert
marked this pull request as ready for review
July 29, 2026 10:00
…profile # Conflicts: # bin/src/completions.ts # bin/src/webmux.ts # bin/src/worktree-commands.ts # frontend/src/App.svelte # frontend/src/lib/WorktreeList.svelte
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
Picking
full/frontendOnly/agentOnlyat creation time used to be permanent — the profile was baked into the worktree's metadata and never revisited. This adds a profile switch: change your mind later and the worktree is rebuilt with that profile's tmux layout and pane commands, resuming the agent conversation rather than starting it over.When the worktree is open, its tmux window is torn down and recreated from the new profile's pane templates (splits, sizes,
commandpanes and their startup commands). When it's closed, the metadata is updated and the new layout applies on the next open. Leaving a docker profile removes the container first — containers are keyed by branch and reused on launch, so a stale one would otherwise be re-adopted by the next profile.Changes
PUT /api/worktrees/:name/profilewithSetWorktreeProfileRequest/Response({ profile, restarted }).LifecycleService.setWorktreeProfile()— validates the profile (400 on unknown), requires managed metadata (409), persistsprofile+runtime, tears down a docker container when leaving a docker profile, and delegates to the existing open path so the layout rebuild and agent resume reuse one code path. No-ops when the profile is unchanged.WorktreeProfileDialog, opened from "Change profile…" in the sidebar row menu. Tells you whether the switch restarts the session now or applies on next open; remounts the terminal after a restart.webmux profile <branch> <profile>(also--profile=<name>), wired into help, dispatch, and bash/zsh completions./apiand/wsat the root, but since feat: serve all projects from one webmux dashboard on one port #271 every project's calls go to/<prefix>/api/.... Vite was servingindex.htmlfor those instead of proxying, breaking the dev dashboard for any project. The proxy contexts are now regexes matching both forms.Test plan
bun run test— 484 backend / 4 contract / 183 CLI / 141 frontend, all green;bun run --cwd backend checkandbun run --cwd frontend checkcleanagentOnly→fulland confirm the backend/frontend panes come up and the agent resumeswebmux profile <branch> full, thenwebmux profile <branch> agentOnly./dev.shand confirm the dashboard loads and the terminal WebSocket connects under/<prefix>/Note: the rebuild recreates the window, so panes split manually outside the profile are not preserved. A profile's
systemPromptstill only applies on a fresh agent launch, so a resumed agent isn't re-prompted.Generated with Claude Code
https://claude.ai/code/session_01Vx7XU35JjpJ26Rcn4jTKWB