Repository navigation
feat(storage): journal sealing and storage maintenance sweep - #123
Merged
senamakel merged 7 commits intoOct 17, 2026
Merged
Conversation
TurnJournal now retains the underlying journal and, on both terminal paths, flushes the append worker before sealing the run's stream so nothing is appended to a finished run and reads stay stable while retention runs. Sealing failures are logged and ignored, keeping the terminal writes best-effort. Auto-committed-on: dragonfly
Add a journal_retention_days setting to StorageConfig that controls how long a finished run's sealed event journal is kept before the storage maintenance sweep deletes it, defaulting to 30 days with 0 meaning forever. The manual Default impl replaces the derived one so the new field gets its non-zero default. Auto-committed-on: dragonfly
Expose the new journal_maintenance module from the storage module so its maintenance routines can be used elsewhere in the crate. Auto-committed-on: dragonfly
The runtime now starts the journal maintenance task alongside the other background sweeps so sealing and retention run on a schedule. Retention falls back to the storage config default instead of a standalone constant, and tests cover the default and TOML override. Auto-committed-on: dragonfly
Auto-committed-on: dragonfly
Reformat long method chains and the tracing macro call in the journal maintenance module to satisfy rustfmt. No behaviour changes. Auto-committed-on: dragonfly
Point the journal maintenance code and its tests at the relocated HarnessStatusStore, StorageConfig, and read_run_events_page paths so the module compiles against the reorganized harness crate. Auto-committed-on: dragonfly
This was referenced Oct 17, 2026
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.
Refs tinyhumansai#7995
What changed
agent/tinyagents/journal.rs:finish_completed/finish_failedflush the append worker, thenseal_runthe run'sharness.journal/<run_id>stream (non-fatal, logged).storage/journal_maintenance.rs(new): periodic sweep =Registry::maintain_allthenbackend.maintain; retention applied by composing the owner schemas with the journalretain_mstaken from config. Spawned with the other periodic services (ServiceSet.cronswitch, besideblob_sweep) incore/runtime/services.rs.tsd.migrations(harness/journal_seal_backfill_v1): seals every unsealed journal whose run is not active. Sealing is idempotent, so a crash re-runs it.[storage] journal_retention_days(default 30,0keeps forever) inconfig/schema/storage.rs.storage/boot.rs,storage/schema.rsand host stores untouched.v1 to v2 mapping
No record shapes change; no new migration
Step. The only new storage record is thetsd.migrationsimporter marker.Tests (isolated HOME, memory backend fixtures)
sealed vs unsealed pages identical; backfill seals finished not active runs and records itself; retention honours config (1 day vs 30 default); 0 keeps forever; config default/TOML.
Gates
cargo check (root all-targets, app), clippy (4 crates, -D warnings), focused lib tests, check-storage-owner, check-storage-schema, check-feature-forwarding, rust:layout: all pass. Did not run the
storage_*_e2etargets or full lib suite.