fix(agent): bound local snapshot retention and never fill the disk #604

Open
gmackie wants to merge 1 commit from fix/snapshot-local-retention into main
Owner

fix(agent): bound local snapshot retention and never fill the disk

hetzner-master kept the full tiered snapshot retention (7 daily + weekly +
monthly) on its 75 GB root disk at ~11 GB/night. On 2026-09-21 the disk
filled mid-dump, wedged the ForgeGraph Postgres for days, and left a
truncated truecomps dump that the already-dumped-today check then refused
to redo.

  • snapshot.local_keep_days caps local copies; S3 keeps the tiers.
  • Prune local before dumping, not after.
  • Skip a dump when free space < 1.5x the previous dump (floor 1 GiB).
  • Write to .partial and rename on success; clean abandoned partials.

Rollout

After the next agent release, set "local_keep_days": 2 in hetzner-master /etc/forgegraph/agent.json under snapshot, then remove the stopgap /etc/cron.d/fg-snapshot-local-trim + /usr/local/bin/fg-snapshot-local-trim.sh.

Verification

  • go test ./internal/snapshot/ ./internal/agentcfg/ ./internal/cmdexec/: pass
  • Mutation control: disabling keep-days makes TestPruneLocalKeepDaysKeepsOnlyRecentDailies fail

🤖 Generated with Claude Code

fix(agent): bound local snapshot retention and never fill the disk hetzner-master kept the full tiered snapshot retention (7 daily + weekly + monthly) on its 75 GB root disk at ~11 GB/night. On 2026-09-21 the disk filled mid-dump, wedged the ForgeGraph Postgres for days, and left a truncated truecomps dump that the already-dumped-today check then refused to redo. - snapshot.local_keep_days caps local copies; S3 keeps the tiers. - Prune local before dumping, not after. - Skip a dump when free space < 1.5x the previous dump (floor 1 GiB). - Write to .partial and rename on success; clean abandoned partials. ## Rollout After the next agent release, set `"local_keep_days": 2` in hetzner-master `/etc/forgegraph/agent.json` under `snapshot`, then remove the stopgap `/etc/cron.d/fg-snapshot-local-trim` + `/usr/local/bin/fg-snapshot-local-trim.sh`. ## Verification - `go test ./internal/snapshot/ ./internal/agentcfg/ ./internal/cmdexec/`: pass - Mutation control: disabling keep-days makes `TestPruneLocalKeepDaysKeepsOnlyRecentDailies` fail 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(agent): bound local snapshot retention and never fill the disk
All checks were successful
CI / gitleaks (pull_request) Successful in 7s
CI / storybook (pull_request) Successful in 1m22s
CI / web-build (pull_request) Successful in 3m27s
forgegraph/ci CI passed
CI / ci (pull_request) Successful in 10m18s
8e6b1088b8
hetzner-master kept the full tiered snapshot retention (7 daily + weekly +
monthly) on its 75 GB root disk at ~11 GB/night. On 2026-09-21 the disk
filled mid-dump, wedged the ForgeGraph Postgres for days, and left a
truncated truecomps dump that the already-dumped-today check then refused
to redo.

- snapshot.local_keep_days caps local copies; S3 keeps the tiers.
- Prune local before dumping, not after.
- Skip a dump when free space < 1.5x the previous dump (floor 1 GiB).
- Write to .partial and rename on success; clean abandoned partials.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Author
Owner

Preview environment is live: https://pr-604-forgegraph.forgegraf.com

Deployed 8e6b1088 with the beta stage's environment. It redeploys on every push and is destroyed when this PR closes.

Preview environment is live: https://pr-604-forgegraph.forgegraf.com Deployed `8e6b1088` with the beta stage's environment. It redeploys on every push and is destroyed when this PR closes.
Author
Owner

Preview environment is live: https://pr-604-forgegraph.forgegraf.com

Deployed 8e6b1088 with the beta stage's environment. It redeploys on every push and is destroyed when this PR closes.

Preview environment is live: https://pr-604-forgegraph.forgegraf.com Deployed `8e6b1088` with the beta stage's environment. It redeploys on every push and is destroyed when this PR closes.
All checks were successful
CI / gitleaks (pull_request) Successful in 7s
Required
Details
CI / storybook (pull_request) Successful in 1m22s
CI / web-build (pull_request) Successful in 3m27s
forgegraph/ci CI passed
CI / ci (pull_request) Successful in 10m18s
Required
Details
This pull request has changes conflicting with the target branch.
  • CHANGELOG.md
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/snapshot-local-retention:fix/snapshot-local-retention
git switch fix/snapshot-local-retention
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
gmackie/ForgeGraph!604
No description provided.