Repository navigation
feat(serve): fork a session and read its tree over serve - #957
Merged
Merged
Conversation
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
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
POST /sessions/{id}/fork {"at"?: <seq>}andGET /sessions/{id}/treeintole 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) andtole branchcould.Changes
fork: calls the sameJsonlStorage::forkas the TUI andtole branch.atis the entryseqasGET .../entriesshows it (default: the last settled entry). Answers200 {"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).404unknown session,409while a turn runs (busy flag, and the storage turn lock is held across the fork as the TUI does),400for a malformedat, an unknown seq, or an entry that is not a settled point.tree: the same family reader astole sessions --treeand the TUI/tree(session_index::family), read from the session files so it answers during a turn.docs/mobile-control.mdroute 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 explicitat, 404, 409, badatleaving no file, tree shape and depth, tree during a busy turn).cargo fmt --all,cargo clippy -p tole-cli --all-targets -- -D warningsin the default,--no-default-featuresand--no-default-features --features shell-toolsprofiles pass locally; the fullcargo test -p tole-cliexited 0 locally and CI runs it again.Parent: #941. Issue: #947 (first slice).