Skip to content

feat(store): support invariant-safe session forks - #13

Merged
ZhiXiao-Lin merged 1 commit into
mainfrom
recovery/session-fork-rebind
Jul 19, 2026
Merged

ZhiXiao-Lin merged 1 commit into
mainfrom
recovery/session-fork-rebind

Conversation

@ZhiXiao-Lin

Copy link
Copy Markdown

Summary

  • add SessionSnapshotV1::fork_for_session for rebinding a complete persisted generation to a new session id and workspace
  • preserve artifacts, traces, run ids, verification reports, and child-session ids
  • rebind top-level run ownership and non-empty subagent parent ownership so the fork remains loadable under existing invariants
  • validate both the source and resulting snapshot, and reject empty destination session ids

Why

The CLI recovery work for /fork, isolated worktree forks, and conflict-safe /rewind needs one canonical Core operation. Copying only SessionData would silently discard or mis-own the rest of the atomic session snapshot.

Validation

  • cargo fmt --all -- --check
  • cargo test -p a3s-code-core snapshot_fork_rebinds_every_top_level_session_owner
  • git diff --check

A focused dependent CLI PR will follow separately after this Core seam is available.

@ZhiXiao-Lin
ZhiXiao-Lin merged commit 3d404de into main Jul 19, 2026
2 checks passed
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.

2 participants