feat(tui): add Claude Code-style --fork flag to duplicate sessions before continuing (resolves #11137)#11340
Open
ariane-emory wants to merge 18 commits intoanomalyco:devfrom
Open
feat(tui): add Claude Code-style --fork flag to duplicate sessions before continuing (resolves #11137)#11340ariane-emory wants to merge 18 commits intoanomalyco:devfrom
ariane-emory wants to merge 18 commits intoanomalyco:devfrom
Conversation
- Add --fork CLI flag for session forking with --continue or --session - Forked sessions get automatic (fork #N) title suffix via existing Session.fork() - Validate that --fork requires --continue or --session - Applies to both attach mode and bootstrap mode Fixes anomalyco#11137
- Add fork option to Args interface - Add --fork-session flag to TUI command (thread.ts) - Add validation that --fork-session requires --continue or --session - Fork session before navigating when --fork-session is set
Replace verbose if/else if blocks with ternary expressions to match repo style guide preference for const over let. -8 lines total
When using --session with --fork, the app would briefly show the forked session then navigate to a blank screen. Root cause: race condition where reconcile overwrites the newly forked session from the store. Fix: Wait for sync.status to be "complete" before forking, ensuring session list is fully loaded before the fork operation.
Contributor
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
Contributor
Author
|
A few comments exchanged between @IdrisGit and myself on the topic of this PR can be found alongside my initial dummy PR, located here: ariane-emory#147 |
1 task
opencode-agent bot
added a commit
that referenced
this pull request
Jan 30, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Jan 30, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Jan 30, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Jan 30, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Jan 30, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Jan 30, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Jan 30, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Jan 30, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Jan 30, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Jan 30, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Jan 30, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Jan 30, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Jan 30, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Jan 30, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Jan 30, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 1, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 1, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 1, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 1, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 1, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 1, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 1, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 1, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 1, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 1, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 1, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 1, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 1, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 1, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 1, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 1, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 1, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 1, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 1, 2026
… to duplicate sessions before continuing (resolves #11137)
opencode-agent bot
added a commit
that referenced
this pull request
Feb 2, 2026
… to duplicate sessions before continuing (resolves #11137)
71151ae to
4410d8b
Compare
Remove the alias and make --fork the primary CLI option name. Update args.forkSession references to args.fork.
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.
What does this PR do?
--fork-sessionswitch offer familiarity to converts from Claude Code./forkcommand or TUI message modal receive--forkis correctly paired with either--continueor--sessionopencode runcommandsResolves #11137.
Supported syntax examples:
opencode --continue --forkStart the TUI, continuing and forking (duplicating) the last session
opencode run --continue --fork "tell me a better joke"Run one prompt, continuing and forking (duplicating) the last session
opencode run --fork "tell me a better joke"Same as previous, but using terse syntax for the --continue switch
opencode --fork --session ses_3f2424a04ffeu0ZUiE12HfD2OIFork a particular session.
opencode --fork --session ses_that_doesnt_existFails gracefully: OpenCode starts, but displays a
Failed to fork sessiontoast.opencode run --fork --session ses_that_doesnt_exist "I'm not gonna work."Fails gracefully: an
Error: Session not foundmessage is written to STDERR and an exit code of 1 is used.How did you verify your code works?
Manual testing,
bun test,bun typecheck