Skip to content

Comments

feat: Add snapshot functionality #268

Open
bitloi wants to merge 2 commits intotursodatabase:mainfrom
bitloi:feat/snapshot-57-232
Open

feat: Add snapshot functionality #268
bitloi wants to merge 2 commits intotursodatabase:mainfrom
bitloi:feat/snapshot-57-232

Conversation

@bitloi
Copy link

@bitloi bitloi commented Jan 20, 2026

  • Add snapshot() method to AgentFS SDK using checkpoint + file copy
  • Add 'agentfs snapshot' CLI command for manual snapshots
  • Add automatic snapshot on nested 'agentfs run' (detected via AGENTFS_SESSION env var)
  • Add Snapshot error variant
  • Add tests for snapshot functionality

closes #57, #232

@bitloi
Copy link
Author

bitloi commented Jan 20, 2026

running 2 tests
test tests::test_snapshot_is_independent ... ok
test tests::test_snapshot ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 100 filtered out; finished in 0.05s

@bitloi bitloi force-pushed the feat/snapshot-57-232 branch from 83dece2 to 6a77c34 Compare January 20, 2026 01:49
@bitloi bitloi force-pushed the feat/snapshot-57-232 branch from ef8454b to 06b7515 Compare January 23, 2026 09:18
@bitloi bitloi closed this Jan 30, 2026
@bitloi bitloi reopened this Jan 30, 2026
@bitloi
Copy link
Author

bitloi commented Feb 2, 2026

Hey @penberg, can you please check the pr?

…ase#232)

- Add snapshot() method to AgentFS SDK using checkpoint + file copy
- Add 'agentfs snapshot' CLI command for manual snapshots
- Add automatic snapshot on nested 'agentfs run' (detected via AGENTFS_SESSION env var)
- Add Snapshot error variant
- Add tests for snapshot functionality
@bitloi bitloi force-pushed the feat/snapshot-57-232 branch from 06b7515 to 9819bff Compare February 3, 2026 15:38
@penberg
Copy link
Collaborator

penberg commented Feb 18, 2026

Hey @bitloi! We had someone do this earlier #119 and I commented that I don't think the snapshotting logic is safe against concurrent writes.

@bitloi
Copy link
Author

bitloi commented Feb 18, 2026

Hi @penberg, thanks for the feedback!

You're right - the current implementation has a race window between the WAL checkpoint and file copy where concurrent writes could slip through. I noted this limitation when implementing it.

A few questions:

  1. Is the turso Connection::snapshot() API still planned? If so, I can update this PR to use it once available.

  2. For the auto-snapshot on nested run (Issue Automatic snapshot on nested agentfs run #232), the snapshot happens in the same process before spawning the nested session, so there shouldn't be concurrent writers at that moment. Would that specific use case be acceptable even with the current approach?

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.

Snapshotting

2 participants