Skip to content

feat: surface session fork in the TUI (/fork [backend])#17

Merged
saucam merged 1 commit into
mainfrom
feat/tui-fork-command
Jul 10, 2026
Merged

feat: surface session fork in the TUI (/fork [backend])#17
saucam merged 1 commit into
mainfrom
feat/tui-fork-command

Conversation

@saucam

@saucam saucam commented Jul 10, 2026

Copy link
Copy Markdown
Owner

What

Adds the /fork slash 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's feat/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

  • protocol (codeoid-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 and /fork <backend> (lowercased); add a CATALOG entry for autocomplete/help. 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. 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 on a valid payload; error on missing/unparseable payload (parent focus untouched)
  • client_kind fork mapping; session_fork_message wire-shape
  • guard paths: no focused session, no live connection

cargo test --workspace (258 tui tests pass), cargo fmt --all --check, cargo build --workspace all clean.

🤖 Generated with Claude Code

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

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.91608% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.24%. Comparing base (c519852) to head (f187098).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
crates/codeoid-tui/src/app.rs 81.35% 22 Missing ⚠️
crates/codeoid-protocol/src/client.rs 0.00% 1 Missing ⚠️
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     
Flag Coverage Δ
tui 68.24% <83.91%> (+0.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
crates/codeoid-client/src/connection.rs 23.34% <100.00%> (+1.80%) ⬆️
crates/codeoid-tui/src/commands/mod.rs 95.85% <100.00%> (+0.20%) ⬆️
crates/codeoid-protocol/src/client.rs 29.62% <0.00%> (-1.14%) ⬇️
crates/codeoid-tui/src/app.rs 38.84% <81.35%> (+3.33%) ⬆️

@saucam saucam merged commit 7e6b453 into main Jul 10, 2026
3 of 6 checks passed
This was referenced Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant