Skip to content

fix(sessions): warn when a fire-and-forget disk-budget sweep fails - #124681

Merged
steipete merged 1 commit into
mainfrom
codex/autoqa-budget-kick-warn
Aug 16, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/autoqa-budget-kick-warn

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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-eviction warn line when budget sweeps fail instead of discovering the problem when the disk fills.

Evidence

  • New regression "warns when a fire-and-forget budget sweep fails instead of swallowing it" — deterministic fault injection via a throwing maintenance-config getter; fails pre-fix (stash-verified), passes post-fix.
  • node scripts/run-vitest.mjs run src/config/sessions/session-history-eviction.test.ts — 9/9 pass.
  • tsgo core green.
  • LOC: prod +9, test +29. Justified growth: observability at the owner boundary.
  • Codex autoreview (gpt-5.6-sol, high): clean, 0.99.

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.
@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 16, 2026
@steipete
steipete marked this pull request as ready for review August 16, 2026 16:05
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 16, 2026, 12:12 PM ET / 16:12 UTC.

ClawSweeper review

What this changes

This 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 provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep 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 {}, leaving the new warning non-actionable.

Priority: P2
Reviewed head: bb1ee1d14696c0c200385f35b5438f7efbd52a88

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The repair is focused and correctly located, but the operator diagnostic needs one mechanical rendering correction.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-labelled PR is exempt from the external-contributor proof gate; its reported focused test remains supplemental validation.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-labelled PR is exempt from the external-contributor proof gate; its reported focused test remains supplemental validation.
Evidence reviewed 6 items Current silent failure: Current main starts the background sweep and drops every rejection in an empty catch, so a failed default maintenance pass has no operator signal.
Owner boundary and callers: The changed function owns the fire-and-forget sweep; normal entry writes call it after committing, while reset/delete force a kick and explicit cleanup awaits enforcement directly.
Rendered error is lost: Pretty and compact subsystem output render only the message, while JSON output serializes metadata with JSON.stringify; therefore the Error object at the changed warning becomes {} and neither default console mode displays its path metadata.
Findings 1 actionable finding [P2] Include actionable failure details in the warning text
Security None None.

How this fits together

Session 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]
Loading

Before merge

  • Include actionable failure details in the warning text (P2) - SubsystemLogger omits metadata in normal pretty/compact console output, and its JSON formatter serializes an Error as {}. The new warning therefore hides both the failing store and the error from the normal operator path. Render redacted String(error) and the store path in the message (or an equivalent console message) and assert them in this regression test.
  • Resolve merge risk (P1) - Production code grows by net 9 lines; the logger and explicit diagnostic are warranted at this owner boundary, but the final form should remain limited to actionable observability.

Findings

  • [P2] Include actionable failure details in the warning text — src/config/sessions/session-history-eviction.ts:513-516
Agent review details

Security

None.

PR surface

Source +9, Tests +44. Total +53 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 11 2 +9
Tests 1 45 1 +44
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 56 3 +53

Review metrics

Metric Value Why it matters
Production vs test LOC production +11/-2 (net +9), tests +45/-1 (net +44) The added logger and diagnostic are owner-boundary observability work; the test growth is focused on the rejected asynchronous sweep.

Stored data model

Persistent data-model change detected: serialized state: src/config/sessions/session-history-eviction.test.ts, serialized state: src/config/sessions/session-history-eviction.ts, unknown-data-model-change: src/config/sessions/session-history-eviction.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the warning at this catch, but put redacted String(error) and the affected store path in the rendered warning text, with a regression assertion for those diagnostics.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the warning at this catch, but put redacted String(error) and the affected store path in the rendered warning text, with a regression assertion for those diagnostics.

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:

  • [P2] Include actionable failure details in the warning text — src/config/sessions/session-history-eviction.ts:513-516
    SubsystemLogger omits metadata in normal pretty/compact console output, and its JSON formatter serializes an Error as {}. The new warning therefore hides both the failing store and the error from the normal operator path. Render redacted String(error) and the store path in the message (or an equivalent console message) and assert them in this regression test.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 01a23bc8b9c6.

Labels

Label changes:

  • add P2: The patch addresses an operator-visible session-maintenance failure but the remaining diagnostic defect has limited blast radius.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-labelled PR is exempt from the external-contributor proof gate; its reported focused test remains supplemental validation.

Label justifications:

  • P2: The patch addresses an operator-visible session-maintenance failure but the remaining diagnostic defect has limited blast radius.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-labelled PR is exempt from the external-contributor proof gate; its reported focused test remains supplemental validation.

Evidence

What I checked:

Likely related people:

  • steipete: The current maintenance owner and its empty catch were introduced in this contributor's merged commit; this PR also continues work in that same boundary. (role: introduced current owner boundary and recent area contributor; confidence: high; commits: d8e7ec5345b6; files: src/config/sessions/session-history-eviction.ts, src/config/sessions/session-accessor.sqlite-entry.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Include the error and store path in rendered warning text, then show the focused after-fix test or log output.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 2b8e94e into main Aug 16, 2026
279 checks passed
@steipete
steipete deleted the codex/autoqa-budget-kick-warn branch August 16, 2026 16:15
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 17, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant