Repository navigation
fix(cron): keep read RPCs from blocking the gateway - #133552
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 6:29 PM ET / 22:29 UTC. ClawSweeper reviewWhat this changesThe PR makes started cron reads observational, runs timer maintenance only for actual repair candidates, and batches active receipt lookup during real cron maintenance. Regression provenancePossible regression — probable (reviewed change; failure trace; known regression link). No predecessor PR is attributed. Merge readinessKeep open: current main still routes started cron reads through synchronous maintenance, and this protected maintainer PR supplies a focused, source-backed repair with no discrete blocking defect found. Priority: P1 Review scores
Verification
How this fits togetherGateway cron RPCs read scheduled-job state while the scheduler timer owns time-based repair and execution. SQLite run receipts identify active jobs so recovery and maintenance do not alter work owned by another scheduler. flowchart LR
RPC[Gateway cron reads] --> Read[Load cron state]
Timer[Scheduler timer] --> Gate[Maintenance admission]
Read --> Reply[Status and job results]
Gate -->|repair candidate| SQLite[SQLite cron and receipt rows]
Gate -->|no candidate| Recheck[Next scheduler wake]
SQLite --> Runs[Scheduled agent execution]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +15, Tests +389. Total +404 across 10 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Land the single scheduler-owned maintenance flow while retaining the unstarted repair and the exact overdue, retry, active-receipt, stale-future, and invalid-schedule cases. Do we have a high-confidence way to reproduce the issue? Yes—current main’s read operations call ensureLoadedForRead(), which invokes the synchronous maintenance transaction; the added tests instrument that same transaction label across the public read surface. Is this the best way to solve the issue? Yes. Moving repair responsibility to the scheduler after startup removes write work from observational RPCs without dropping the timer’s required recovery cases. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7504a3b3c453. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
41f8e3c to
5c22988
Compare
* origin/main: (55 commits) test: include v2026.8.1 release navigation (#133581) fix: stop cloud work before unrelated provider inspection finishes (#133476) fix(e2e): keep delete fixture target-compatible (#133526) fix(release): detect optional target E2E capability (#133525) fix(package): publish readable dist inventory (#133549) docs: add complete v2026.8.1 maintainer change index (#133585) fix(browser): preserve contextless worker and iframe sessions (#133571) fix(voice): discover configured provider candidates (#133507) refactor(ui): simplify chat rendering and lifecycle state (#133567) test: reduce maturity fixture cleanup time (#133566) improve: speed up legacy imports and transcript replacement (#133546) docs: add draft v2026.8.1 release notes (#133557) test: guard multi-project Vitest cache ownership (#133554) fix(memory): clarify default agent scope in command help (#133560) fix(clawdock): keep credentials out of diagnostic output (#133547) refactor(ui): avoid redundant presence work in avatar lists (#133548) fix(agents): recognize internal requester completion replies (#133543) fix: prevent duplicate queued user messages in chat clients (#133542) chore(ui): refresh control ui locales (#133544) fix(beam): restart delivery when the receiver changes (#133533) ...
|
Merged via squash.
|
…cked-delivery * origin/main: fix(ui): wait for restored draft before clearing (openclaw#133575) fix(deps): update fast-uri security patches (openclaw#133572) test: reduce workflow sanity fixture cleanup time (openclaw#133588) fix(media): normalize detected Matroska MIME (openclaw#133383) refactor(docker): retire ClawDock shell helpers (openclaw#133594) perf(browser): reuse snapshot refs and screenshot metadata (openclaw#133598) perf: load web chat history in larger, faster batches (openclaw#133565) fix(plugins): keep bundled plugins bundled when selected by plugins.load.paths (openclaw#133584) test: isolate shared /tmp session-store paths in runner and health suites (openclaw#133568) fix(cron): avoid no-op schedule repair writes (openclaw#133552)
Fixes #133442
What Problem This Solves
Fixes an issue where cron read RPCs and no-runnable-job timer ticks could enter full synchronous SQLite write maintenance after the scheduler had started. On nontrivial stores, nominal reads and no-op timer wakes could block the gateway event loop.
Why This Change Was Made
Started read operations now load current state without performing durable schedule repair; unstarted reads retain the existing missing-schedule repair. Empty timer ticks enter maintenance only for exact expired repair candidates or enabled timed jobs with no valid next run and no active marker.
Real maintenance sweeps now load cron rows once, decode once, and fetch active receipt job IDs with one indexed query inside the existing transaction. Receipt-owned jobs remain untouched. This does not change schema versions, migrations, retention, configuration, protocol, locking, queues, workers, or timeouts.
The regression was introduced by
d3308e2cfd9d8818c5663811e7ea9fd5b66be82fin #122948. That commit is present in beta tags beginning withv2026.8.1-beta.2; stablev2026.7.1-2predates it.User Impact
Cron status, list, paginated list, and job-read calls remain observational after scheduler startup. Stable and receipt-owned timer states no longer trigger no-op write sweeps, while missing schedules, stale backoff slots, overdue execution, retries, and auto-disable behavior continue to work.
Accepted Residuals
nextRunAtMs; the scheduler-owned timer repairs it within the existing 60-second watchdog cadence. This bounded deferral is intentional so read RPCs remain write-free.Evidence
Pre-fix regression run:
cron.schedule-unownedtransactions; post-fix: 0.Post-fix:
node scripts/run-vitest.mjs src/cron/service.read-ops-nonblocking.test.ts src/cron/service.timer-maintenance.test.ts src/cron/service.overdue-scheduling.test.ts src/cron/service/run-recovery.test.ts src/cron/store/run-receipt-store.test.ts src/cron/service.every-jobs-fire.test.ts src/cron/service/store.test.ts src/cron/service.prevents-duplicate-timers.test.ts src/cron/service.list-past-due.test.ts41f8e3cc5bba: stale invalid future cron slot performed 0 sweeps and failed the new timer-boundary regression.node scripts/check-changed.mjs: passed.pnpm tsgo:core:test: passed.pnpm check: all preflights plus core/UI production typecheck passed; extension typecheck was not usable in this linked worktree because its mandated shared install provides@grammyjs/[email protected]while this commit's lockfile requires5.0.0. Exact-head CI will run with a clean dependency install.LOC:
The production growth is the shared timer-admission predicates and batched active-receipt lookup needed to eliminate repeated write sweeps and per-row receipt queries without losing stale-future cron repair.