Skip to content

Protect recoverable sidecars from retention prune (#61)#71

Merged
willwashburn merged 3 commits intomainfrom
fix/sidecar-prune-protection-61
Apr 25, 2026
Merged

Protect recoverable sidecars from retention prune (#61)#71
willwashburn merged 3 commits intomainfrom
fix/sidecar-prune-protection-61

Conversation

@willwashburn
Copy link
Copy Markdown
Member

@willwashburn willwashburn commented Apr 25, 2026

Fixes #61.

Summary

  • Default burn content prune (and the opportunistic prune on every CLI invocation) no longer deletes sidecars whose upstream session file still exists. The data is recoverable via burn rebuild --content, so retention-only deletion was silently lossy.
  • pruneContent accepts an optional isRecoverable(sessionId) callback and now returns PruneResult.skippedRecoverable alongside filesDeleted / bytesFreed. The ledger package stays free of adapter-specific paths — the CLI builds the source index from the same walker helpers ingest.ts already uses (walkJsonl, walkOpencodeSessions, plus the Claude project dir scan).
  • New opt-out paths: burn content prune --force and RELAYBURN_PRUNE_FORCE=1 for unattended automation. The CLI prints a kept N recoverable sidecars whose source files still exist line when the protection kicked in, with a hint to use --force.

Test plan

  • pnpm install && pnpm run test:ts (345 tests pass)
  • pruneContent with isRecoverable returning true: file kept, counted in skippedRecoverable.
  • pruneContent with isRecoverable returning false: file pruned per existing retention rule.
  • pruneContent without isRecoverable: existing retention behavior unchanged (acts like --force).
  • Async isRecoverable predicate is awaited.
  • Throwing isRecoverable falls through to retention (fail-closed-to-prune so a broken source index can't accumulate forever).
  • CLI: --force flag suppresses the recoverable-source check and the kept-recoverable output line.
  • CLI: RELAYBURN_PRUNE_FORCE=1 env var has the same effect as --force.

Open in Devin Review

Default `burn content prune` (and the opportunistic prune that runs on
every CLI invocation) now skips sidecars whose upstream source session
file still exists under one of the adapter roots. The data is
recoverable via `burn rebuild --content`, so retention-only deletion
was silently lossy. Pass `--force` (or set `RELAYBURN_PRUNE_FORCE=1`)
to bypass the check and reclaim disk regardless.

The ledger package stays decoupled from adapter-specific paths:
`pruneContent` accepts an optional `isRecoverable(sessionId)`
callback, and `PruneResult` gains a `skippedRecoverable` count
alongside `filesDeleted` / `bytesFreed`. The CLI builds the source
index from the same walker helpers `ingest.ts` already uses
(`walkJsonl`, `walkOpencodeSessions`, plus the Claude project dir
scan).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
devin-ai-integration[bot]

This comment was marked as resolved.

willwashburn and others added 2 commits April 24, 2026 22:18
The 0.11.0 - 2026-04-25 header was accidentally dropped from
packages/ledger/CHANGELOG.md, folding the released "Plans config
primitives" entry into [Unreleased]. Every other package CHANGELOG and
the root CHANGELOG still carry that header, so this restores the
lockstep-release invariant called out in AGENTS.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Resolve packages/ledger/CHANGELOG.md conflict by keeping the PR's
Unreleased Changed entry alongside the released 0.14.1 / 0.13.1 sections
that landed on main.
@willwashburn willwashburn merged commit 97092a0 into main Apr 25, 2026
@willwashburn willwashburn deleted the fix/sidecar-prune-protection-61 branch April 25, 2026 18:13
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 4 additional findings in Devin Review.

Open in Devin Review

Comment thread packages/cli/CHANGELOG.md
Comment on lines +33 to +35
### Fixed

- **`burn content prune` (and the opportunistic prune that runs on every CLI invocation) no longer deletes sidecars whose upstream source file still exists** — the data is recoverable via `burn rebuild --content`, so retention-only deletion was silently lossy. Default `burn content prune` now reports a `kept N recoverable sidecars whose source files still exist` line alongside the deletion count. Pass `--force` (or set `RELAYBURN_PRUNE_FORCE=1`) to bypass the check and reclaim disk regardless. (#61)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 CLI CHANGELOG entry placed under already-released [0.13.1] instead of [Unreleased]

The AGENTS.md rule states: "Curate [Unreleased] in the relevant per-package packages/*/CHANGELOG.md as you land PRs." The new ### Fixed entry for the source-aware prune feature is added under the already-released ## [0.13.1] - 2026-04-25 section instead of under the empty ## [Unreleased] section at packages/cli/CHANGELOG.md:8. The ledger CHANGELOG (packages/ledger/CHANGELOG.md:10-12) correctly places its entry under [Unreleased], making this inconsistent as well.

Prompt for agents
The new Fixed entry (lines 33-35 of packages/cli/CHANGELOG.md) is placed under the already-released section [0.13.1]. Per AGENTS.md, new changelog entries must be curated under [Unreleased]. Move the ### Fixed block (lines 33-36) from its current position under [0.13.1] to immediately after the ## [Unreleased] header at line 8. The [Unreleased] section is currently empty (just the header followed by a blank line), so insert the ### Fixed subsection and its bullet there.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

Protect recoverable sidecars from retention prune

1 participant