Repository navigation
test(sessions): hold cold maintenance validation where it actually runs - #161608
Conversation
The prepared-admission maintenance probes pre-released every native integrity check, so they passed even when cold validation ran in the foreground executor under the writer permit (#160858's shape, repaired by #161181). Hold the first integrity check on the fixture database in any worker, assert the reclamation worker owns it, and require a foreground replacement commit while it is held, for the whole-store, lifecycle and replacement entry points and the finalizer lifetime recheck. Keep expired-proof finalization as its own case on the retained branch: the reclamation worker revalidates before committing while foreground writes proceed. Existing integrity-counter callers keep their message shape; the unused before-writer hold mode is removed. With the executor-first preparation temporarily restored, the four cold cases fail in about 2 s each on the owner assertion.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 30, 2026, 12:42 AM ET / 04:42 UTC. ClawSweeper reviewWhat this changesThis PR changes session-maintenance tests to hold a native SQLite integrity check, verify foreground writes can commit during validation, and cover finalization with expired validation proof. Merge readiness✅ Ready for maintainer review Keep this PR open. The merged runtime fix restores foreground responsiveness, but current main does not contain these maintenance-entry-point regression checks. The proposed native-check hold and reported negative control support a distinct, useful test contribution. Priority: P2 Review scores
Verification
How this fits togetherSession maintenance plans archive and remove old session data through a reclamation worker. The tests check that its database validation leaves the foreground session writer available and that finalization still respects the current validation state. flowchart LR
A[Session maintenance] --> B[Archive plan]
B --> C[Reclamation worker]
C --> D[Native integrity check]
D --> E[Writer admission]
E --> F[Session data and archive]
G[Foreground session update] --> E
H[Test validation hold] --> D
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +219. Total +219 across 3 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain a native-check regression guard through the maintenance callers and expired-proof finalizer, alongside the existing lower-level reclamation test. Do we have a high-confidence way to reproduce the issue? Yes for the test gap: current main's old probe pre-releases native checks, and the PR reports that restoring the former executor-first route makes four proposed cold cases fail quickly. I did not execute the negative control. Is this the best way to solve the issue? Yes. Holding the actual native check and requiring an independent foreground commit tests the documented scheduling contract through the maintenance entry points. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2247f10d9a84. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…ns (openclaw#161608) The prepared-admission maintenance probes pre-released every native integrity check, so they passed even when cold validation ran in the foreground executor under the writer permit (openclaw#160858's shape, repaired by openclaw#161181). Hold the first integrity check on the fixture database in any worker, assert the reclamation worker owns it, and require a foreground replacement commit while it is held, for the whole-store, lifecycle and replacement entry points and the finalizer lifetime recheck. Keep expired-proof finalization as its own case on the retained branch: the reclamation worker revalidates before committing while foreground writes proceed. Existing integrity-counter callers keep their message shape; the unused before-writer hold mode is removed. With the executor-first preparation temporarily restored, the four cold cases fail in about 2 s each on the owner assertion.
Related: #160858, #161181
What Problem This Solves
The session maintenance concurrency tests could not detect the writer-blocking regression from #160858: cold agent-database integrity validation ran in the foreground executor while it held the writer permit, so foreground session writes stalled for the whole check, yet the current prepared-admission maintenance cases still passed on that shape.
User Impact
No user-visible change. The behavior was already repaired on
mainby #161181; this PR makes the maintenance entry points fail loudly if cold validation moves back under the foreground writer.Why This Change Was Made
observeWorkerAdmissionpre-released every native integrity check and only paused the maintenance finalizer before its writer permit, so it passed whether validation ran in the reclamation worker or in the executor under the writer. The probes now:worker-access.md), and require a foregroundapplySessionEntryReplacementscommit while it is held. This covers the whole-store, lifecycle and replacement maintenance entry points and the finalizer lifetime recheck.The opt-in hold leaves existing helper callers on their current two-key message shape. The unused
before-writerhold mode is removed, and the main-thread probe moves into the existing test-support file to keep the test under its line cap.Evidence
pnpm test src/config/sessions/session-accessor.sqlite-prepared-admission.test.ts --maxWorkers=1: 31/31 pass on this head, 66 s wall (baseline 30 tests, 170 s wall including a cold 50 s worker compile; a later run on a loaded host took 129 s).withSessionEntryWorker(... runExisting ...)preparation temporarily restored insession-accessor.sqlite-reclamation-run.ts, the three cold maintenance cases and the lifetime case fail in about 2 s each withcold validation owner: expected 'executor' to be 'reclamation', and no case times out. The expired-proof case still passes, as expected, because it exercises the separate retained branch. The mutation was reverted byte-for-byte.sqlite-reclamation-preparation3/3,sqlite-reclamation-reuse24/24,sqlite-lifecycle-admission9/9 (100 s combined,--maxWorkers=1).oxfmt --check, scopedrun-oxlint, and thecore-test-agents-sessionstsgo graph pass on the changed files.