Skip to content

[Feature]: Workspace file checkpoint and rewind bound to message branches #921

Description

@carlkaub

Preflight checklist

  • I searched existing issues and discussions and this hasn't been proposed yet.

What problem does this solve?

Open Science can undo a conversation but not a workspace.

Editing a completed prompt forks a persistent message branch, and artifacts are immutable and versioned. But nothing snapshots the session working directory. If the agent overwrites a counts matrix, truncates an input CSV, or rewrites a script in place, switching back to an earlier message branch does not bring those files back. The conversation returns to a state the filesystem no longer matches.

For scientific work this is the highest-consequence failure mode in the app: the destroyed thing is often the user's own data, and Auto-approve edits exists precisely to let edits happen without a prompt.

To be explicit about scope: src/main/reviewer/scope-snapshot.ts snapshots transcripts for the reviewer, not files. This is a different capability from #352, which proposes checkpoints for auto-review timing.

Proposed solution

A workspace-checkpoint-owner.ts that captures the session working directory at turn boundaries and restores it on demand.

  • Storage: content-addressed, reusing the approach src/main/artifacts/storage-layout.ts already takes — checksummed blobs, so unchanged files across checkpoints cost nothing.
  • Binding: attach checkpoints to message-branch nodes in the conversation graph. Rewinding to a branch then means branch switch + file restore, one coherent operation rather than two half-undos.
  • Scope control: honor the existing workspace containment boundary; never checkpoint outside it. Large inputs (the 10 GB streaming-upload path) should be referenced, not copied.
  • UI: a rewind affordance on message branches, plus a diff of what a restore would change before it happens.

Restore must be explicit and previewable — never automatic.

Alternatives considered

  • A git repo per session. Attractive but leaky: binary scientific data, 10 GB files, and a .git directory visible to the agent inside its own workspace.
  • Rely on artifact immutability. Only covers generated artifacts. The gap is inputs and working files the agent mutates in place.
  • Snapshot on every tool call. Too expensive; turn boundaries plus an explicit "checkpoint now" is the right granularity.

Additional context

This is one of three substrate items in #917 that serve both near-term usability and the longer-term goal — full-fidelity session replay needs exactly this file-state capture.


Part of #917 (preserve-the-backend blend plan). This proposal is additive: it does not change the ACP runtime, artifact/provenance store, notebook execution semantics, or the Prisma schema.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions