Repository navigation
perf(state): retire periodic runtime integrity scans - #162015
Conversation
Remove delayed and daily full-database scans from the Gateway while preserving requested agent quick checks, live-owner confirmation, and quarantine. Keep full verification with admission, migrations, and Doctor maintenance. No config or schema migration is required.
|
🦞👀 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: blocked before merge. Reviewed September 30, 2026, 3:31 PM ET / 19:31 UTC (Revision 4). ClawSweeper reviewWhat this changesThe branch removes delayed and daily Gateway SQLite scans, retains requested agent quick checks, narrows a Plugin SDK export facade, and updates documentation and verifier tests. Merge readiness⛔ Blocked before merge - 4 items remain Keep open. The final head still directs operators to a Doctor command that does not perform the promised full verification of every registered agent database. Removing the daily scan also changes a corruption-detection tradeoff that earlier work accepted while that scan remained in place. Priority: P2 Review scores
Verification
How this fits togetherAfter the Gateway starts, cached agent database opens submit paths to a verifier queue. A child process checks requested files, and confirmed failures can quarantine them; admission, migration, and backup have separate integrity checks. flowchart LR
A[Cached agent open] --> B[Gateway request queue]
B --> C[Child quick check]
C --> D[Live owner confirmation]
D --> E[Quarantine or continue]
F[Backup creation and verification] --> G[Full snapshot check]
Decision needed
Why: The performance benefit is clear from removing scheduled work, but the acceptable delay in detecting index or page damage is a product safety choice. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource -80, Tests -5, Docs +19, Other 0. Total -66 across 13 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Provide a truthful, supported way to verify all registered databases in a maintenance window, with its archive and live-quarantine limits explained, then adopt the scan cadence a maintainer chooses. Do we have a high-confidence way to reproduce the issue? Yes. Current main's verifier schedules a full scan after five minutes and daily thereafter; the PR's fake-time evidence exercises that schedule, although this read-only review did not run it. Is this the best way to solve the issue? No. Removing idle scans addresses the scheduled work, but the documented replacement command does not provide equivalent full verification of every registered database. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f02c8eba42a2. 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
HistoryReview history (3 earlier review cycles)
|
Carry the existing restoration phase through Windows task recovery so SIGINT fences forward work without rejecting compensation. Preserve executor and native task ownership checks before side effects. The original 40-file CI shard reproduced 821 passes and one SIGINT failure; it passes all 822 tests with this change. Testbox focused tests and changed checks passed, and independent Codex review found no actionable findings.
Pin the legacy home-directory facade to its existing eight exports so new internal updater helpers do not become public SDK contracts. Reduce the wildcard ratchet by one without expanding export or callable budgets. All 11 SDK surface tests passed against the exact failed CI merge plus this fix on Testbox, along with core/script types, targeted lint, export guards, and formatting. Independent Codex review found no actionable findings.
Integrate main to resolve the actual Windows recovery conflict. Keep main’s recovery implementation byte-for-byte; the verifier retirement and explicit SDK facade retain their reviewed source. Final candidate review found no actionable P0–P2 findings. On Blacksmith Testbox, 41 verifier, SDK, and Windows lifecycle tests passed against the complete pinned merge candidate.
* perf(state): retire periodic runtime integrity scans Remove delayed and daily full-database scans from the Gateway while preserving requested agent quick checks, live-owner confirmation, and quarantine. Keep full verification with admission, migrations, and Doctor maintenance. No config or schema migration is required. * fix(update): restore Windows task autostart after cancellation Carry the existing restoration phase through Windows task recovery so SIGINT fences forward work without rejecting compensation. Preserve executor and native task ownership checks before side effects. The original 40-file CI shard reproduced 821 passes and one SIGINT failure; it passes all 822 tests with this change. Testbox focused tests and changed checks passed, and independent Codex review found no actionable findings. * fix(plugin-sdk): keep updater path context private Pin the legacy home-directory facade to its existing eight exports so new internal updater helpers do not become public SDK contracts. Reduce the wildcard ratchet by one without expanding export or callable budgets. All 11 SDK surface tests passed against the exact failed CI merge plus this fix on Testbox, along with core/script types, targeted lint, export guards, and formatting. Independent Codex review found no actionable findings.
What Problem This Solves
Running Gateways rescan every registered SQLite database five minutes after startup and every 24 hours, competing for storage and page cache after those databases have already passed admission.
Related: #110271, #153463.
User Impact
Gateways no longer schedule full database integrity scans. Requested agent quick checks, live-owner confirmation, quarantine, and shutdown drainage remain intact. Full verification stays with admission/migration and explicit Doctor maintenance; the docs describe the Doctor command and its service lifecycle. Quick checks do not cross-check every index.
A bounded CI repair also keeps an internal updater path-context helper out of the public SDK, preserving all eight existing home-directory exports without raising SDK budgets.
Update-path behavior: no configuration, schema, migration, installed-updater, or rollback change against current main, and no new option. The verifier change applies when the new Gateway starts. The Windows repair investigated during CI landed concurrently and is inherited from main.
Why This Change Was Made
Retire the delayed/daily deadlines, whole-database inventory collector, and unused full-scan worker mode. The existing Gateway sidecar consumes only deduplicated requested paths, stays idle without a timer when no request is pending, and always selects
quick_checkplus foreign-key verification. Child-process isolation still protects the live writer's POSIX locks. The perf change removes 89 production lines; naming the existing SDK exports adds nine, leaving production code 80 lines smaller overall. The identifier-count ratchet shrinks from 475 to 473.The periodic verifier originated in #110271's fast schema gate work; #153463 retained it while adding clean-restart quick checks. The retained queue serves clean-restart admission as well as explicit requests. Result application still reconfirms terminal failures against the live owner and rejects stale generations before latching/persisting quarantine.
CI exposed a separate cancellation regression introduced by #161104: SIGINT sets
run.interrupted, but Windows task restoration received the forward execution guard, so compensation failed withrequester-revoked. The repair carries the existingrestorephase through the two Windows recovery modules. Forward admission remains cancellable, while restoration still verifies the captured executor and rechecks current task authority after awaited work. The equivalent repair landed concurrently on main; the final candidate inherits that implementation and preserves the regression evidence below.Evidence
All heavy validation used provider
blacksmith-testbox, profileopenclaw-check. No local tests, typechecks, or builds ran. No live Gateway was modified or restarted.The scheduling regression failed against the original code and passes after the cutover. This measures eliminated scheduled work; live I/O volume, heap use, and event-loop latency have not been remeasured.
Verifier proof
Lease
tbx_01m3sjmndwnrb1a27hyxdw82m1, validation environment, base3b5707dc03f536e75ba23e44d825034c7965f2e4: 138 tests passed across seven files, usingnode scripts/run-vitest.mjs/pnpm testwith--maxWorkers=1.src/state/openclaw-database-verify.shutdown.test.ts: 10 tests, 2.68 s command wall.src/state/openclaw-database-verify.test.ts: 24 tests, 20.81 s command wall, including worker bundle validation.src/state/openclaw-database-verify.process.test.ts: 27 tests, 8.72 s command wall, including worker bundle validation.src/gateway/session-row-projection.topology.test.ts: 32 existing tests, 32.72 s harness wall (31.09 s Vitest). Only its verification target fixture changed.openclaw-agent-db.integrity-cache.test.ts,openclaw-agent-db.integrity-policy.test.ts, andopenclaw-agent-execution.integrity.test.ts: 45 tests.Coverage includes queued/late requests, same-root peer handoff, shutdown/result settlement, live WAL locks, native worker relay, durable quarantine, and stale/repaired/replaced database results. Full-scan-only cases were removed; the quick-check foreign-key case retains quarantine across close/reopen.
All components selected by
node scripts/check-changed.mjs --base 3b5707dc03f536e75ba23e44d825034c7965f2e4 --timedpassed cumulatively. The final broad invocation passed core types, every core test-type graph, ratchets, formatting, and dead-export checks before reporting an intentional non-Error fixture throw. After annotating that fixture with the existing test convention, the process tests, targeted lint, script lint, and remaining selected schema/storage/sidecar/cycle/auth guards passed separately. This is cumulative proof, not a claim that the aggregate wrapper exited successfully.CI repair proof
Initial CI run, head
cd7194aba1944c630efeed49d37a56322cf74736: onlychecks-node-changed-compact-large-7failed, atsrc/cli/update-cli.windows-lifecycle.test.ts→restores Windows Scheduled Task autostart on SIGINT during package suspension. Relevant updater files were unchanged between the PR head and tested main basef6948d0bbf59fede6714c4cf5d5778aff53993d4.Lease
tbx_01m3sqe4vd95zm7ytem4qswgxx(validation environment), exact published head plus the reviewed repair:node --import ./scripts/tsx.mjs scripts/ci-run-node-test-shard.mtsand its original plan/runtime policy: reproduced 821 pass / 1 fail in 362.69 s; after the repair, 822/822 pass in 347.68 s.node scripts/run-vitest.mjsfor the Windows lifecycle, task-recovery, service-maintenance recovery, and mutable-signal tests: 48/48 pass; 94.22 s wrapper wall (35.25 s and 35.40 s Vitest groups).node scripts/check-changed.mjs --base cd7194aba1944c630efeed49d37a56322cf74736 --timed: all selected checks passed, exit 0, 23m00.3s command wall. This includes core types, all 27 core test-type groups, lint, formatting, export scans, and structural guards. A post-command external runner-portal sync warning did not change the successful command result.Published-driver compatibility on lease
tbx_01m3ssah7x9jzm6t667pjd3k7z(environment) stopped at an inherited package-budget gate before the updater ran. Command:Full candidate build passed in 7m16.5s and packed-tarball integrity passed twice. The canonical unpacked-size gate then rejected 392,237,507 bytes (374.1 MiB; 14,002 files) against 335,544,320 bytes (320 MiB). Published
2026.9.7itself is 388,950,288 bytes (370.9 MiB; 13,281 files), also above that gate. Total remote command: 613.17 s. No budget exception was added; the baseline install and actual update never ran, so this compatibility cell remains unproven. Build also reported a non-fatal existing UI gzip-size warning (217.1 KiB versus 215.0 KiB).The supported Linux Testbox route exercises simulated Windows service boundaries; native Windows sync/run is unavailable through this route. Native Windows SIGINT compensation has not been exercised.
Follow-up SDK surface repair
The next CI run (36761378488) passed the previously failing Windows shard but exposed an inherited SDK leak. Main commit
6830c82ea080added the internalwithUserPathBaseDirectoryhelper for the updater; theinfra-runtimewildcard also exported it publicly. The observed counts became 4,595 exports / 2,699 callable against budgets 4,594 / 2,698. Its only caller imports the internal owner directly. The facade now names the same eight existing home-directory exports, and the wildcard ratchet shrinks exactly 47 → 46. Export/callable budgets remain unchanged.Lease
tbx_01m3sv4pnpntc9rv8rm9w32nyb(validation environment) materialized the exact failed CI merged6406e76a1f45390d20925f53fcd955530455f1cin an isolated remote checkout and applied only the two-file facade patch.node scripts/run-vitest.mjs test/scripts/plugin-sdk-surface-report.test.ts --maxWorkers=1passed all 11 tests (13.47 s Vitest, 14.37 s wrapper), including all three original failures. SDK export synchronization, wildcard checks, and script erasability passed. Core and script typechecks, targeted lint for both files, formatting, andgit diff --checkpassed. Independent Codex review found no actionable P0–P2 findings. The changed-check planner was inspected; the two-file export-preserving fix used these focused gates, reusing existing broader proof. One mistakenly broad root typecheck was interrupted; its owned processes were drained and its retained artifact lock was recovered before the intended checks ran. The successful scoped-check/replay command took 145.90 s.Two other failures in that run remain unproven:
checks-node-changed-3: the package artifact-mode case hit the existing 20-second timeout in its offline npm receipt subprocess; 66 passed / 1 failed / 3 skipped. The same underlying npm stall was investigated in fix(packaging): keep the final-archive receipt out of the shared npm cache #161548; its private-cache mitigation is already present. One same-file-order Testbox replay on the exact failed merge plus the unrelated SDK fix passed 67 tests / 3 skipped in 38.93 s; the previously failing case took 631 ms. This is non-reproduction, not a fix. No timeout or assertion was weakened.checks-ui-e2e (1/9): the native plugin UI geometry assertion measured right clearance 6.734375 against scrollbar allowance 10.0546875 at 1280px; 343 passed / 1 failed. Its layout owner, CSS, and helper are unchanged by this PR and byte-identical to main ata3601dd51537. The helper checks committed size and captures geometry in separate renderer evaluations, leaving a possible resize race, but that cause has not been reproduced. Existing readiness fix fix: wait for startup leases after container replacement #160266 is already present. No browser automation or speculative UI fix was performed.The Windows repair landed concurrently through #161990 with equivalent restoration semantics. Resolving the resulting merge conflict takes main's Windows recovery module byte-for-byte; the final PR adds no Windows production diff against main and retains the recovery documentation.
Conflict resolution proof
A real conflict with concurrently landed Windows recovery work required integrating main at
e6d8dae5c2009d0e754427de3d0ff7230d4da62e. The conflicted module takes main byte-for-byte. The verifier production code and SDK facade patch retain their reviewed bytes.Provider
blacksmith-testbox, profileopenclaw-check, leasetbx_01m3svvpn9dqyjd13wh0bpf3sc(environment): verified the complete local/remote candidate patch against the pinned main base (SHA-256a785d005c187f00d3072b2b90d55a4bc8ff2154d1b6cde7df930a4b5fd716cd7).node scripts/run-vitest.mjs src/state/openclaw-database-verify.shutdown.test.ts src/cli/update-cli.windows-lifecycle.test.ts test/scripts/plugin-sdk-surface-report.test.ts --maxWorkers=1passed 41/41 tests. Vitest groups: 1.32 s, 11.24 s, 43.85 s; wrapper 74.51 s; setup-plus-test command 85.86 s. The first identity guard stopped before tests because the native transport seeded the pending merge from main rather than the local branch parent; the full patch comparison then proved identical source. Fresh review of the complete candidate against the pinned main base found no actionable P0–P2 findings.Review and limitations
Independent Codex autoreview: no actionable P0–P2 findings for the perf change or the exact three-file CI repair. Subsequent perf-only edits were mechanical fixture/expectation/ratchet updates and the intentional test-throw annotation; reviewed production code was unchanged. Formatting and
git diff --checkpass.Docs anchor audit checked 14,956 links and found 53 broken fragments identical on baseline and candidate, all outside changed pages; zero new failures. ClawHub's external mirrored fragments were unavailable. New local routes/anchors were checked against source pages.
Missing lease dependencies were restored once with
pnpm install --frozen-lockfile. Earlier checks caught an obsolete worker-error expectation, the identifier ratchet, and a required Gateway fixture property; all were corrected and affected checks passed. One native sync timed out before test execution and succeeded on a diagnostic retry.Current-head CI: run 36765452453 completed successfully on
06a5616ab145efecdade01d4234093335dae69ef, includingopenclaw/ci-gate; verified against a fresh exact-run read. All five task Testbox leases are stopped. The prior UI and npm failures passed on this head but remain unexplained; those passing replays are not claimed as fixes.