goose icon indicating copy to clipboard operation
goose copied to clipboard

Add session forking capability

Open wpfleger96 opened this issue 1 month ago • 1 comments

This PR adds session forking across CLI, backend API, and desktop UI. Users can now fork a session to create an independent copy and explore different conversation paths.

Forking lets you preserve conversation history while trying different approaches. For example, when debugging an issue, you can fork at a decision point to test different solutions without losing your original thread. Similar to how Claude Code handles session forking.

  • Added POST /sessions/{id}/fork endpoint that uses SessionManager::fork_session() to copy sessions with the same name
  • Implemented --fork CLI flag (requires --resume) with support for session ID, name, or path identifiers
  • Fixed copy_session() to preserve provider_name and model_config when copying
  • Created useForkSession hook that handles errors, loading states, and passes correct params to createChatWindow
  • Added fork buttons in SessionListView and ChatInput that open forked sessions in new windows
  • Added test_fork_session() to verify conversation and metadata preservation

Addresses #5865

wpfleger96 avatar Nov 25 '25 23:11 wpfleger96

Just reiterating what @DOsinga said the desktop now has fork session support in chat

image

zanesq avatar Dec 11 '25 00:12 zanesq

@DOsinga @zanesq just simplified the PR based your feedback, what do y'all think now? I named this "fork" since that's what Claude Code calls the equivalent functionality I'm trying to implement, but I think I made it confusing since there's already a "Fork Session" in goose UI. what I want here is really "duplicate" instead of "fork"

truncate copy Result Use Case
false true Full session copy Duplicate for parallel work (my use case for this PR)
true false Edit in place Truncate current session (existing Edit in Place UI option)
true true Branch at point Copy + truncate at timestamp (exiting Fork Session UI option)

wpfleger96 avatar Dec 23 '25 20:12 wpfleger96