Skip to content

feat: bugfix to snapshot pruning and allow snapshot config to accept positive integer for retention lifespan in days (resolves #10626, #10782, #6845, #3182, #10532)#10628

Closed
ariane-emory wants to merge 0 commit intoanomalyco:devfrom
ariane-emory:feat/configurable-snapshot-lifespan
Closed

Conversation

@ariane-emory
Copy link
Contributor

@ariane-emory ariane-emory commented Jan 26, 2026

What does this PR do?

This PR corrects a bug in the current implementation where old snapshots' directories are not being properly pruned: currently only individual objects inside the snapshot are pruned after their exceeds the retention time limit, not the folders in their entirety. This PR ensures that expired snapshots' folders are correctly pruned.

Additionally, this PR allows for the value of the snapshot setting in opencode.json to be either a boolean value (as is the case currently) or a positive integer controlling how many days snapshots should be retained for. A value of 0 is treated equivelantly to "snapshot": false, disabling the snapshots feature entirely.

This feature will allow users to better control how much space is ultimately used by OpenCode for the storage of snapshots.

Tests are included to make sure that valid configuration values for snapshot are parsed correctly.

Resolves #10626.
Resolves #10782.
Resolves #6845.
Resolves #3182.
Resolves #10532.

This feature should also provide a means to mitigate numerous other issues involving complaints about a huge snapshot folder consuming excessive disk space.

How did you verify your code works?

Manual testing plus bun test and bun typecheck: no new failing tests introduced relative to the current HEAD of dev. Dogfooding: I have been using this in my own fork since this PR's time of submission and it does appear to be working exactly as it was designed to. Yay!

@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@ariane-emory ariane-emory changed the title feat: allow snapshot config to accept positive integer for retention lifespan in days feat: allow snapshot config to accept positive integer for retention lifespan in days (resolves #10628) Jan 26, 2026
@ariane-emory ariane-emory changed the title feat: allow snapshot config to accept positive integer for retention lifespan in days (resolves #10628) feat: allow snapshot config to accept positive integer for retention lifespan in days (resolves #10626) Jan 26, 2026
@ariane-emory ariane-emory marked this pull request as ready for review January 26, 2026 17:01
@ariane-emory ariane-emory marked this pull request as draft January 26, 2026 17:01
@ariane-emory ariane-emory changed the title feat: allow snapshot config to accept positive integer for retention lifespan in days (resolves #10626) feat: allow snapshot config to accept positive integer for retention lifespan in days (resolves #10626, #10782) Jan 27, 2026
@ariane-emory ariane-emory marked this pull request as ready for review January 27, 2026 06:44
@ariane-emory ariane-emory changed the title feat: allow snapshot config to accept positive integer for retention lifespan in days (resolves #10626, #10782) feat: bugfix to snapshot pruning and allow snapshot config to accept positive integer for retention lifespan in days (resolves #10626, #10782) Jan 27, 2026
@ariane-emory ariane-emory changed the title feat: bugfix to snapshot pruning and allow snapshot config to accept positive integer for retention lifespan in days (resolves #10626, #10782) feat: bugfix to snapshot pruning and allow snapshot config to accept positive integer for retention lifespan in days (resolves #10626, #10782, #6845) Jan 28, 2026
@ariane-emory ariane-emory changed the title feat: bugfix to snapshot pruning and allow snapshot config to accept positive integer for retention lifespan in days (resolves #10626, #10782, #6845) feat: bugfix to snapshot pruning and allow snapshot config to accept positive integer for retention lifespan in days (resolves #10626, #10782, #6845, #3182) Jan 28, 2026
@ariane-emory ariane-emory changed the title feat: bugfix to snapshot pruning and allow snapshot config to accept positive integer for retention lifespan in days (resolves #10626, #10782, #6845, #3182) feat: bugfix to snapshot pruning and allow snapshot config to accept positive integer for retention lifespan in days (resolves #10626, #10782, #6845, #3182, #10532) Jan 28, 2026
@thdxr thdxr force-pushed the dev branch 4 times, most recently from f1ae801 to 08fa7f7 Compare January 30, 2026 14:37
@ariane-emory ariane-emory force-pushed the feat/configurable-snapshot-lifespan branch 2 times, most recently from 44d80d1 to c29f3e6 Compare February 6, 2026 19:23
@ariane-emory ariane-emory force-pushed the feat/configurable-snapshot-lifespan branch from 7b5f260 to dd1624e Compare February 9, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant