Skip to content

feat(serve): fork a session and read its tree over serve - #957

Merged
ajianaz merged 2 commits into
developfrom
feat/serve-fork-tree
Nov 19, 2026
Merged

ajianaz merged 2 commits into
developfrom
feat/serve-fork-tree

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What

POST /sessions/{id}/fork {"at"?: <seq>} and GET /sessions/{id}/tree in tole serve (part of #947, step 5 of #941).

Why

A graphical client (#527) and the chat gateway could not fork a session or read its family tree; the TUI (/fork, /tree) and tole branch could.

Changes

  • fork: calls the same JsonlStorage::fork as the TUI and tole branch. at is the entry seq as GET .../entries shows it (default: the last settled entry). Answers 200 {"id", "forkedFrom", "at", "seq"}. Writes only the new session file and the session-index line the TUI writes too; the source is untouched. The fork is not made live (POST /sessions {"resume": id} opens it).
  • 404 unknown session, 409 while a turn runs (busy flag, and the storage turn lock is held across the fork as the TUI does), 400 for a malformed at, an unknown seq, or an entry that is not a settled point.
  • tree: the same family reader as tole sessions --tree and the TUI /tree (session_index::family), read from the session files so it answers during a turn.
  • docs/mobile-control.md route table and a CHANGELOG entry (Behavior Change).

Testing

New in-process test fork_and_tree_routes_answer_success_404_409_and_bad_at (success shape, default and explicit at, 404, 409, bad at leaving no file, tree shape and depth, tree during a busy turn). cargo fmt --all, cargo clippy -p tole-cli --all-targets -- -D warnings in the default, --no-default-features and --no-default-features --features shell-tools profiles pass locally; the full cargo test -p tole-cli exited 0 locally and CI runs it again.

Parent: #941. Issue: #947 (first slice).

@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit a5fe5cb into develop Nov 19, 2026
19 checks passed
@ajianaz
ajianaz deleted the feat/serve-fork-tree branch November 20, 2026 08:37
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