Repository navigation
Conversation
Compaction ran one minute after every launch, scanning the whole event store on the synchronous connection and blocking the server. It now records when it last finished and waits until it is due (at least one minute, at most six hours), and its discovery reads run on the reader worker. Done with Claude Opus 5.5 in Claude Code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — This changes the default production maintenance schedule across restarts and adds persisted compaction state, rather than merely optimizing an isolated implementation. The reader-worker adjustment also changes execution behavior for compaction discovery, so the runtime impact warrants human review. You can add or adjust custom eligibility rules. Learn more. |
|
Taking over this one as maintainer for batch usage-billing-01. This combines persistent compaction cadence with reader-worker discovery queries, so I will rebuild it as two focused stack layers on origin, credit the original work, and close this PR only after the replacement layers are published and verified. No merge is planned. |
|
Thanks @Alyx-ML — the persisted six-hour cadence and use of the existing SQLite reader-worker route were the right pieces to address repeated startup scans and writer blocking. This original PR is now superseded by two focused replacement layers:
These concerns can be reviewed independently. I compared both replacement production diffs with the original: both behaviors are preserved, including zero-deletion completion timestamps, best-effort timestamp I/O, normal periodic scheduling, synchronous fallback, pagination and retention. The completion timestamp is now saved immediately after compaction, before logging. No intended behavior was dropped. Both replacement heads have passing CI and two independent full-diff review rounds from Opus 5.5 and Sol 6 with no code blockers. Focused tests grew from 47 to 59; the cadence and actual reader-connection regressions have failing-control evidence. Verification output. The cadence layer still needs human policy approval; native platform/performance claims were not verified on this Linux host. Neither replacement has been merged. Rebuilt with Codex gpt-6-astra for tests and gpt-6.1-sol for implementation through T3 Code, with credit to the original work. |
Rebuild the reader portion of PR #21192 by Alyx-ML; contributor credit retained in the replacement PR.
Database compaction runs one minute after every launch, whenever it last ran. A pass reads the whole event store, and its discovery queries ran on the synchronous connection, so the server's event loop stalled during the first minutes of every session. Relaunching never let the six-hour interval take effect.
Summary
A missing or unreadable file keeps today's behavior: compact one minute after launch.
Evidence
The idle minute starts about one minute after launch, which is when compaction fires. The comparison is the same build with and without this change:
vp test runDatabaseStorage and runtimeLayer tests: 84 passed.Measured on release desktop builds (
build-desktop-artifact --target dir) on an Apple Silicon MacBook Pro running macOS 27.2. The seeded scratch HOME holds a 100,000-message chat and three chats streaming from a synthetic agent. The harness is in #21190.Merge Danger
Door: two-way
Deleting
compacted-atrestores the old timing.Blast Radius: small
Compaction can be postponed by up to six hours after a restart, which is the interval already intended.
Done with Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code