feat: surface session fork in the TUI (/fork [backend])#17
Merged
Conversation
Branch the focused session into an independent one from the TUI, optionally
continuing it on a different backend — the third UI (after telegram + web) to
expose fork.
- protocol: add `ClientMessage::SessionFork { session_id, name?, provider_id? }`
mirroring the daemon's `session.fork` wire shape; register it in
`request_id` and `client_kind`.
- commands: parse `/fork` (keep parent backend) and `/fork <backend>` (continue
on another, lowercased); add a CATALOG entry. Drop the now-conflicting `fork`
alias for `/import` (import keeps its own name).
- app: `fork_focused` sends the fork frame and, on success, adds + focuses the
returned session so its tab goes active; the response-handling is extracted
into the pure, unit-tested `apply_fork_response`.
Tests: parser (with/without backend) + catalog presence; `apply_fork_response`
add-and-focus + no-payload error paths; `client_kind` fork mapping; builder
wire-shape; no-session and no-connection guard paths.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17 +/- ##
==========================================
+ Coverage 67.96% 68.24% +0.28%
==========================================
Files 32 32
Lines 7834 7976 +142
==========================================
+ Hits 5324 5443 +119
- Misses 2510 2533 +23
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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
Adds the
/forkslash command to the Rust TUI, so the terminal UI can branch the focused session into an independent one — optionally continuing it on a different backend. This is the third UI to expose fork (telegram + web already shipped in the codeoid repo'sfeat/fork-provider-ui)./fork— branch the focused session, keeping the parent's backend./fork <backend>— branch and continue on another backend (e.g./fork codex).On success the fork is added to the tab strip and focused so its tab goes active; the daemon validates fail-closed (unknown session →
not_found, unknown backend →invalid_request) and the error surfaces inline.Changes
codeoid-protocol): addClientMessage::SessionFork { session_id, name?, provider_id? }mirroring the daemon'ssession.forkwire shape; register it inrequest_idandclient_kind./forkand/fork <backend>(lowercased); add a CATALOG entry for autocomplete/help. Drop the now-conflictingforkalias for/import—/importkeeps its own name.fork_focusedsends the fork frame and, on success, adds + focuses the returned session. Response-handling is extracted into the pure, unit-testedapply_fork_response.Tests
apply_fork_response: add-and-focus on a valid payload; error on missing/unparseable payload (parent focus untouched)client_kindfork mapping;session_fork_messagewire-shapecargo test --workspace(258 tui tests pass),cargo fmt --all --check,cargo build --workspaceall clean.🤖 Generated with Claude Code