Repository navigation
feat(native): fork a session, here or into a worktree - #801
Merged
Merged
Conversation
The card menu gains Fork > Here and Fork > Worktree... for the providers whose CLI branches a conversation (Claude Code, Codex, opencode); the others keep a dead row saying they only resume. Here opens the copy in a new card right under the original, in its checkout; Worktree... opens the worktree dialog in a fork mode, on the original's branch with its uncommitted work coming along. The copy is named after the original with the next free number above its own, and wears a fork mark with "Forked from" in its tooltip. A new sessions.forked column (schema version 10) tells a fork apart from a delegate or a subagent card, which carry an origin too; the window writes it with the row.
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.
Brings fork to the native window, redesigned rather than ported: the web's "Fork to worktree…" always made a worktree, and forking in the same checkout did not exist.
What changes
Fork ▸ Here/Worktree…, for the providers whose CLI branches a conversation (Claude Code, Codex, opencode). The other five keep a disabled row reading "resume only"; a shell, or a card with no conversation yet, gets no row.terminal.Startwithfork(--fork-session,codex fork,opencode --fork). A one-shot queue interminalscarries the parent conversation to that start, as the web's fork queue did.auth-refactor→auth-refactor 2;auth-refactor 2→auth-refactor 3, or 4 if 3 exists).sessions.forkedcolumn (schema version 10). The origin columns could not tell a fork from a delegate or a subagent card. The window writes the mark with the row, so the card draws it on its first frame. Carried through park/reopen.api-types.tsmirrors it as optional; the web does not read it.ResumeAvailable, so a pruned one is refused with a sentence instead of dying in a new card or worktree.Strings in all seven native locales; CHANGELOG entry; README provider row updated in every language.
Verification
forkedround-trips and survives a reopen, delegates and subagents stay unmarked), native (forkLabel,canFork,placedAfter, the menu entry per provider,takeCardkeeping fork requests).go vet/go test ./..., nativegofmt/go vet/go test ./...green. Frontend not run locally (only an optional field inapi-types.ts; nonode_modulesin this worktree).claude --resume <id> --fork-sessionunder the original with the mark and tooltip; Worktree… created the worktree, carried the uncommitted file and spawned the fork inside it. The rig caught two bugs fixed here:takeCarddropped the new fields, and the mark landed only after a reload when written at spawn.