Repository navigation
fix(sessions): warn when a fire-and-forget disk-budget sweep fails - #124681
Conversation
The throttled budget kick swallowed every sweep failure into an empty catch. Retrying on the next kick is right, but a persistently failing sweep (corrupt store, permission loss) meant unbounded disk growth with no operator signal — silent failure on the default maintenance path. Warn with the error and store path before the retry.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 16, 2026, 12:12 PM ET / 16:12 UTC. ClawSweeper reviewWhat this changesThis PR replaces the silent asynchronous session-history disk-budget catch with a subsystem warning and adds a focused regression test for a rejected background sweep. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open. The catch is at the correct non-blocking maintenance boundary, but its error and store path are metadata that normal console output omits and JSON serializes the Error as Priority: P2 Review scores
Verification
How this fits togetherSession writes, resets, and deletes trigger a throttled SQLite disk-budget sweep to reclaim historical transcript storage. The sweep runs asynchronously after the user-facing write, so its failures must be observable without delaying that write. flowchart LR
A[Session write or reset] --> B[Throttled maintenance kick]
B --> C[Background disk-budget sweep]
C --> D{Sweep outcome}
D -->|Success| E[History storage reclaimed]
D -->|Failure| F[Operator diagnostic]
F --> G[Retry on next kick]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +9, Tests +44. Total +53 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the warning at this catch, but put redacted Do we have a high-confidence way to reproduce the issue? Yes—source inspection gives a high-confidence path: make the queued sweep reject after admission, then observe the warning; this read-only review did not execute the test. Is this the best way to solve the issue? No. The catch is the right owner boundary, but the proposed metadata form loses actionable error details in the product’s log renderers. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 01a23bc8b9c6. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…penclaw#124681) The throttled budget kick swallowed every sweep failure into an empty catch. Retrying on the next kick is right, but a persistently failing sweep (corrupt store, permission loss) meant unbounded disk growth with no operator signal — silent failure on the default maintenance path. Warn with the error and store path before the retry.
What Problem This Solves
The throttled session-history disk-budget kick (
kickSessionHistoryDiskBudgetMaintenance) swallowed every sweep failure into an empty catch. Retry-on-next-kick is the right recovery, but a persistently failing sweep — corrupt store, permission loss, filesystem error — meant unbounded disk growth with no operator signal. Silent failure on the default maintenance path is the worst bug class per the repo doctrine.Why This Change Was Made
Record the fact where it happens: warn with the error and store path before the fire-and-forget retry. The containment behavior (never blocking the entry write, single-slot per store, pendingForce re-kick) is untouched.
User Impact
Operators see a
sessions/history-evictionwarn line when budget sweeps fail instead of discovering the problem when the disk fills.Evidence
node scripts/run-vitest.mjs run src/config/sessions/session-history-eviction.test.ts— 9/9 pass.