fix(durable): spawn DurableRetentionService background prune sweep in production - #6285
Merged
Conversation
bug-ops
enabled auto-merge (squash)
July 14, 2026 17:37
bug-ops
force-pushed
the
fix/6264-durable-retention-sweep
branch
from
July 14, 2026 17:39
c356969 to
048d8a5
Compare
… production
RetentionService::run() implemented the periodic sweep documented in
spec-064 ("Retention & Compaction") but was only ever driven from its own
doctest. Every production path that opens a durable backend now spawns it
via TaskSupervisor alongside the JournalWriter: the shared P1/P2
open_durable_backend helper and the P3 scheduler daemon's
build_durable_adapter, gated by the same per-adapter conditions that
already guard backend construction. Without this, terminal executions
past their TTL were never automatically reclaimed and durable.db grew
unbounded regardless of retention config.
Closes #6264
bug-ops
force-pushed
the
fix/6264-durable-retention-sweep
branch
from
July 14, 2026 17:47
048d8a5 to
0a79bff
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
zeph_durable::retention::DurableRetentionService::run()implemented the periodic prune sweep documented inspecs/064-durable-execution/spec.md("Retention & Compaction"), but was never instantiated anywhere in production — only the crate's own doctest and the manual one-shotzeph durable pruneCLI subcommand ever called into the durable-execution prune path.TaskSupervisor::spawn(task namedurable.retention_sweep,RestartPolicy::Restart { max: 5, base_delay: 5s }), alongside the existingJournalWriteractor spawn:open_durable_backend()helper (crates/zeph-core/src/agent/durable_bootstrap.rs), covering both the P1 agent-turn and P2 orchestration adapters.build_durable_adapter()(src/commands/scheduler_daemon.rs), a separate process.TaskSupervisor's documented same-name-aborts-prior-instance behavior) rather than running duplicate sweeps against the samedurable.db.Test plan
cargo +nightly fmt --checkcargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warningscargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins— 13611 passed, 34 skippedRUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler"gitleaks protect --staged --no-banner --redact— no leaks foundspawns_retention_sweep_reachable_via_task_supervisor_snapshot(P1/P2 path)spawns_retention_sweep_alongside_journal_writer+does_not_spawn_when_scheduler_adapter_disabled(P3 scheduler-daemon path)[Unreleased].local/testing/playbooks/durable.mdupdated with a full#6264 (fixed)sectionCloses #6264