Repository navigation
feat(session): branch or fork a session to try approach B without losing approach A - #497
Merged
Merged
Conversation
| ) -> Result<Self, StorageError> { | ||
| let new_id = new_id.into(); | ||
| let from = Self::open_read_only(src)?; | ||
| let settled = |
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
A fork cut at an assistant message that has tool calls hanging off it copied an unfinished tool lineage and then forced pc to Final. Settled now also requires the assistant message to have no children.
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 (description of the change)
Session forking (#210, first slice):
JsonlStorage::fork(src, dir, new_id, at)copies the source's lineage up to a settled entry into a NEW session file; the source is untouched. The new file's header recordsforkedFrom: {session, entry}(additive field — older files replay unchanged).tole branch <id> [--at <entry>]creates the fork, printsbranched: <new-id>and thetole resume <new-id> "<prompt>"continuation command, and records the fork in the session index.tole sessions --treenests forks under the session they were cut from.Why (the problem you're solving)
Closes #210 — try approach B without losing approach A. Implemented as the first slice: fork-as-new-file, NOT the in-file branching design sketch (deferred; rationale in the commit and below). Every reader folds
entries()linearly and most messages are written as root entries, so in-file leaves would touch many modules and break write-once storage simplicity.Testing (how you verified this works)
session_forkfailed to compile (nofork/forked_from); the CLI e2e failed withunrecognized subcommand 'branch'.crates/tole-core/tests/session_fork.rs4/4 (fork copies the settled prefix, source untouched,forkedFromrecorded, todo hydration on a fork vs its source) andcrates/tole-cli/tests/session_branch_e2e.rs1/1 (real binary:tole branchoutput, resume of the fork works).cargo fmt --all -- --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace --no-fail-fast(968 passed / 0 failed, 57 binaries),cargo test -p tole-core --no-default-features(387 passed / 0 failed),cargo build -p tole-cli --no-default-features: all pass. cora pre-commit: "No issues found".Finalwith a CLEAN ledger (usage rows andfact/*registers are not copied into forks); nobranch --name.