Repository navigation
fix(cron): offload read-only inspection outside native exclusions - #152500
Conversation
|
🦞👀 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 19, 2026, 4:41 AM ET / 08:41 UTC (Revision 3). ClawSweeper reviewWhat this changesMoves scheduled-job inspection into a bounded worker while preserving read-only behavior and retaining failed cleanup for retry. Merge readiness✅ Ready for maintainer review This remains useful: current main still performs read-only Cron inspection on the caller thread. The revised head addresses the earlier integration concern, and this review found no actionable introduced defect. Priority: P2 Review scores
Verification
How this fits togetherCLI and Doctor inspections read scheduled jobs from OpenClaw’s shared SQLite database. This change moves database opening, decoding, and closing into a worker, while the existing state lifecycle manages admission and cleanup. flowchart TD
A[CLI and Doctor inspection] --> B[Capture database admission]
B --> C{Artifact preservation needed?}
C -->|Yes| D[Existing snapshot owner]
C -->|No| E[Bounded reader worker]
D --> E
E --> F[Decode scheduled jobs]
F --> G[Join worker and clean resources]
G --> H[Validate admission and return jobs]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +218, Tests +395, Docs +16. Total +629 across 9 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one Cron decoder and the existing snapshot lifecycle, with ordinary inspection off-thread and native exclusion preparation retained by its current owner. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main’s asynchronous inspection function directly performs synchronous SQLite opening, queries, and closing. No runtime reproduction was executed during this read-only review. Is this the best way to solve the issue? Yes. The patch moves execution through the existing worker infrastructure, reuses Cron decoding, and preserves native exclusion ownership without adding schema or configuration surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f9adf0b31ee3. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash.
|
…enclaw#152500) * perf(fleet): run registry operations in SQLite workers * fix(state): preserve readonly admission error context * test(gateway): retain catalog root failure diagnostics * fix: preserve uncertain lease outcomes before caller recovery * fix(state): reject retired read scopes and retain wrapper imports Reject new admissions to closing or closed selected read scopes while keeping already-admitted readers owned through cleanup. Preserve typed invalidation at plugin discovery boundaries. Include the retained-read eager dependencies in the canonical PR wrapper inventory. * test(state): require rejection of retired read scopes Update the three existing disposable-scope variants to expect the canonical admission error while preserving active and unrelated source assertions. * fix(state): keep ordinary reads in the SQLite worker Use the existing independent readonly worker for ordinary fixed reads while retaining cached writer custody. Validate captured file identity around opens and acceptance, and bind previously missing paths when their first file appears. Keep selected snapshots and native preparation scopes with their existing owners. * fix: catalog refresh fails when previous discovery finishes Retain selected plugin registries through awaited preparation and hand construction claims to the completed generation. Preserve stale-publication cleanup and borrowed Gateway-root ownership. Related: openclaw#151588, openclaw#148290. * fix(test): retain Telegram suite output on subprocess errors * fix(ci): require full compact proof for worker policy guards (openclaw#151427) Fix compact CI policy guards that confused a two-worker budget with a parallel-to-serial transition. Preserve inherited job ceilings on already-serial recipients and reject redundant group-policy rewrites. Select the complete compact plan on Blacksmith and hybrid runs when the owning planner-policy test changes; keep GitHub targeting precise. Production admission-before-placement, worker limits, and measurements remain unchanged. Validation: focused host-profile and policy cases, serial-policy negative controls, and exact-head CI run 35343663468 passed. ClawSweeper and the retained scoped review found no actionable defects. No user-visible runtime change. * refactor(state): move fixed-read snapshot tokens off the main thread * perf(gateway): materialize archived session rows on demand (openclaw#151574) * fix: avoid host-speed failures in catalog performance checks (openclaw#151732) Replace the catalog benchmark's host-dependent 20 ms median limit with 20 times an independent in-process CPU reference. Check every composed list for exactly 20 SQLite reads, including three binding-authority reads, and zero plugin-state worker operations, while preserving the existing native-RPC, file-I/O, and session-payload guards. This is a test reliability repair with no runtime or update behavior change. Production changes: 0 lines; tests and test support: +61/-7 across two files. Validation: exact-head CI is green; the reviewed proof includes five passing local runs, two-CPU Testbox and hosted calibration, an extra-SELECT negative control, and a uniform CPU slowdown that fails the independent timing guard. Round-2 Codex autoreview and exact-head ClawSweeper review found no actionable defects. * test(gateway): match catalog read budget to binding owner * test(codex): synchronize agent-end context scenarios Own the fixture clock and wait for turn start and ten response progress events before selecting completion, cancellation, or refusal. Keep the five-second budget and require the expected terminal outcome. Restore real timers before cancelling and joining the run so a failed assertion cannot discard cleanup deadlines. Validation: 62 agent-end, deadline, and lifecycle tests; extension test types; scoped lint and format; independent P2 review. A temporary assertion failure also verified cancellation, unsubscribe, and joined cleanup. * test(state): intercept asynchronous snapshot preparation in lifecycle controls * fix(sqlite): name scoped worker declaration return type * fix(cron): offload read-only inspection outside native exclusions
Prerequisite #151829 landed in
600657d52843417a69fd8b242839a7930bceaf2c. This update integrates captured main2e053112b61f34964d4b0c360e3562c71f728e99while preserving the original Cron feature patch.What Problem This Solves
CLI and Doctor Cron inspection awaited a function that still opened, queried, and closed SQLite on the caller thread.
User Impact
Ordinary cold reads and artifact-preserving cold reads now run their SQLite work off the caller thread. Missing state remains absent, legacy layouts remain unmigrated, and admitted database errors retain their native categories. An already-held exclusive source scope retains its original synchronous host snapshot preparation; that native owner cannot transfer its drained source to another isolate.
Invalid non-file database targets now fail canonical lifecycle admission before opening SQLite. For a directory, the observed Node diagnostic changes from
ERR_SQLITE_ERROR/disk I/O errortoSQLite worker database path must identify a regular file. The five production callers do not branch on that native I/O code; their existing failure/warning behavior remains intact.Why This Change Was Made
The existing Cron decoder runs in a bounded generic worker task. The shared snapshot owner allocates parent-known staging before dispatch, and cleanup waits for the source-copy process and reader worker to exit before retiring its token and removing copied bytes. Failed worker retirement or snapshot removal stays registered with the canonical lifecycle for explicit retry, including failures before a copied location is returned. Captured environment and generation admission survive asynchronous work. Schemas, retention, configuration, and public signatures are unchanged.
Evidence
The original entry failed both cold SQL-zero regressions. The main composition passes 160 selected tests: the original 140 caller and lifecycle cases plus 20 incoming backup, diagnostic, worker-CPU, and retirement controls. The nine Cron worker regressions cover SQL placement, missing/legacy state, native errors, generation drainage, worker retirement, and both formerly failing cold-copy cleanup cases.
Normal-build Node 24.21.0 and Bun 1.4.2 each pass ordinary and artifact-preserving A-B-A store-key reads in one process from an exited seeder: all caller-thread prepare/exec/close/get/all/run/iterate counts are zero, legacy bytes remain identical, and no snapshot artifacts remain. The queued-capacity environment proof passes.
Fresh P2 review is clean on the integrated main composition. The earlier non-file diagnostic finding and its source-backed rejection remain preserved; the resulting behavior is described above. The normal build, full repository check, and changed-scope gate pass on the integrated commit. Package boundary declaration generation emits 10,156 files successfully.