Repository navigation
perf(sqlite): avoid schema writes on warm store use - #170658
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Contributor
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 14, 2026
* perf(sqlite): avoid schema writes on warm store use * fix(sqlite): reuse the catalog owner for legacy trigger inspection
This was referenced Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #170470, #170548, #170598
What Problem This Solves
Repeated schema preparation can revoke an active tool caller's retained profile authority even when SQLite's
CREATE IF NOT EXISTSchanges nothing. This completes the audit of persistent DDL on use across core, packages, and bundled plugins after the cron and shared-state additive fixes.User Impact
Existing stores can prepare their tables without revoking retained caller authority. Missing objects still install transactionally, existing historical column/constraint repairs remain, and imported memory rows retain their provenance backfill. There are no schema SQL, stored-shape, version, retention, permission, upgrade, or downgrade changes.
Why This Change Was Made
Use the existing schema-fact owner and
createSqliteSchemaEnsurerfor the remaining additive stores, including the first use of a warm native handle. Standalone update/Windows lease owners create only a missing table within their existing ownership boundaries. Retained wrapper readiness now follows the schema owner’s facts instead of an irrevocable per-handle flag, preserving admission/post-commit timing while invalidating on schema change or rollback. The Board constraint repair still validates the canonical/recognized historical definition; retired memory triggers still drop when present.Audit inventory and previous DDL frequency
src/node-host/node-worker-launch-store.kernel.tssrc/skills/library/store.tssrc/gateway/worker-environments/store-schema.tssrc/gateway/worker-environments/placement-move-intent.tssrc/state/openclaw-agent-goal-operations-schema.tssrc/state/openclaw-agent-board-schema.tssrc/state/openclaw-state-db-existing-write.tssrc/infra/update-managed-service-handoff-database.tssrc/gateway/worker-environments/workspace-quiescence-scripts.tssrc/audit/execution-owner-lifecycle-binding-store.tspackages/memory-host-sdk/src/host/memory-schema-provenance.tspackages/memory-host-sdk/src/memory-entry-origins.tsAlready fixed: cron run receipts/runtime authority (#170548), shared-state feature/additive table ensures (#170598). Existing standing-intent and progress-card owners already gate their DDL with admitted objects/columns. Workshop changes, node-worker turns, outbound progress/bindings, standing grants, approval identity companions, project/template registries, execution identity/decision facts, and feature-local schema wrappers already guard installation.
Plugin/package audit: Workboard, logbook, and team reports initialize under schema admission at backend open; memory schema initializes under its published/shadow owner. Memory origin/tombstone callers already check missing tables. Full memory FTS/vector publication deliberately replaces derived structures and must retain its DDL. PostgreSQL bootstrap is outside the SQLite audit.
Excluded by lifecycle: versioned migrations and Doctor/STRICT/index repairs; snapshot restore; package activation/adoption initialization; one-shot legacy proxy-capture and restart-sentinel connection admission; disposable transcript import/archive/history-matching/staging/contract databases; TEMP tracking objects, and explicit planner-statistics refresh after maintenance. These perform initialization, actual schema repair, or deliberate derived-data replacement rather than redundant warm preparation.
Evidence
Native SQL guards cover first and repeated warm audit/goal/Board/memory preparation, real node-worker claim/start persistence, reopened private update lease mutation, and emitted Windows lease renewal/release against real synthetic SQLite. A non-cron regression retains the operator tool source, releases the initiating request, and dispatches first warm skill-library preparation with live transaction/commit authority checks.
Synthetic Linux sandbox measurement on Node 26.8.2, baseline
88e5ae840faa, seven measured rounds after 100 warm-up calls; medians per 1,000 initialized-store preparations (each with an explicit writer transaction):These measure preparation overhead on empty synthetic stores, not end-to-end Gateway latency. Audit/origin bundled callers already guard their helpers; the direct-helper numbers quantify the tightened boundary rather than claim a current production-call speedup. Memory provenance retains its DML backfill and improves 2.20×. The sandbox was deleted after measurement.
Local focused proof: the five-file run passed 84 tests with one existing Bun-qualified skip (package provenance: 3.72 s file wall time; gateway/authority + emitted lease script: 72.95 s combined shard wall time; node launch + update handoff: 169.02 s combined shard wall time). The ten-test state schema guard file passed; the existing subset-writer file's 22 siblings passed, and its new physical-writer DDL guard passed separately after admitting the validated catalog. The schema-contract validator legitimately creates a private scratch database; that DDL is excluded by exact observed database identity, rather than masking physical-store changes. The warm audit-binding guard fails on the unchanged baseline because it observes both repeated CREATE statements. The request-closed skill-library regression also fails on unchanged code because the physical store issues its redundant CREATE block. Its authority-only assertion still passes on this narrower current-main harness; the added native SQL assertion protects the schema/authority boundary before more owners move under retained admission. Final cache-lifecycle checks passed: the request-closed warm library guard, worker-environment companion rollback/retry, and placement legacy-column repair/reopen (3 tests, 140.05 s shard wall time including compiler/import overhead). Broad typecheck, full cron/sqlite-store suites, builds, and e2e belong to PR CI under the requested validation policy; no Testbox/Crabbox lease was allocated.
Changed-file oxfmt, repo lint, and
git diff --checkpassed. Lint initially found the node-kernel line budget and a fixture variable shadow; both were corrected. No new source/test module or public SDK subpath was added; the existing private bridge has two additional re-exports. Export/closure guards and full cron/sqlite-store coverage remain PR CI gates. Final-head PR CI passed: 59 successful jobs, 25 skipped, 717 s run wall time and 10,808 successful-job CI seconds.Review: fresh-context independent subagent review of the complete 21-file diff and audit inventory returned a clean verdict with no actionable correctness findings. Review covered canonical table/index contracts, schema-fact invalidation and rollback, post-commit readiness, legacy repairs, and the production-path SQL guards. This uses the lead-authorized replacement route; the existing review configuration was preserved.
Production LOC: +180 / -83, net +97 (excluding tests, test support, and docs). Growth names each store’s complete table/index contract, retains historical trigger/column/constraint cleanup, and ties wrapper readiness to the schema owner’s facts while preserving transaction/commit callback timing. The superseded unconditional DDL and goal/base-launch handle caches are removed. No competing schema installer or new configuration surface is added.
Additional exact-head Actions proof: main-tier CI at
5856e0b3eabe1e6859035f2b7281dc90c74f25afincludes the complete cron and SQLite-store inventories beyond ordinary bounded PR selection. Dispatched once for the explicitly requested suite coverage, with no Testbox lease. Completed: 136 jobs passed, 10 failed, 13 skipped; Node rows: 69 passed, six failed, one skipped. The full cron and SQLite-store inventories ran; no failed test case is in those suites. This is prior-head supplemental coverage, not a claim that the whole run was green.CI corrective change: the dialect ratchet rejected the additional cold-handle trigger catalog query. Reused the existing table-contract reader, keeping engine-specific SQL at its owner. The admitted hot path and measurements are unchanged. Focused provenance tests pass (5/5, 2.87 s runner wall), changed-file formatting passes, and the changed-file dialect ratchet passes (engine-maintenance 2 → 2). The independent reviewer also returned a clean verdict on this corrective delta.
Inherited supplemental failures: config-preflight TS2724 reproduces on unchanged main baseline, and is separately repaired by #170619; the stale test import is outside this diff. Deadcode reports the unchanged UI export
renderBoardWidgetError, matching scheduled main. Logs fetched once; neither failure will be rerun to seek green.Final corrective head:
da3c521d6c0e927cc79750539cc68664b31d881a. The one-file cold-handle fallback correction passed repo changed-file lint and independent review before commit. Final-head PR CI reruns the changed owners and required gates; supplemental full-suite results from the first head are retained as explicitly scoped prior-head evidence for unchanged cron and store paths.Final-head required proof: PR CI is successful at
da3c521d6c0e927cc79750539cc68664b31d881a; both required aggregate contexts report success. All selected owner tests, compiler, lint, schema/dialect, export and closure gates passed. No CI rerun was requested.Supplemental attribution: both session metadata assertions reproduced after temporarily removing all 13 lane production changes (baseline
88e5ae840faa, unchanged test, 2 failures, 62.09 s runner wall). The provider auth literal parity failure also reproduced with all lane production changes removed (1 selected failure, 208.33 s runner wall). That focused wrapper automatically invoked an 85.8 s local runtime build, exceeding the requested light-check scope; no further runtime build was invoked. The unchanged baseline remote-catalog file then passed both cases using that already-built baseline runtime (177.64 s runner wall). Its supplemental v1 timeout and following v2 row mismatch are recorded as an unclassified prior-head coverage gap, not a demonstrated lane regression or claimed inherited reproduction. The separate freshness assertion matches scheduled-main evidence above. Candidate source was restored after each baseline run.Freshness baseline: the same
models.list reuses inventory until explicit refreshsibling assertion (expected 0 projection calls, observed 6) fails in scheduled main. No model/catalog source, provider manifest, or test file from these supplemental failures is modified by this lane.Additional authority comparison: with all lane production files removed, the two selected auth-refresh cases reproduce the timeout/root-work-count failures; the grant-revocation case passes (110.98 s runner wall). On the final candidate, the same three selected cases pass (161.63 s runner wall), including denial of the final write after grant revocation. This verifies the candidate boundary without claiming that a passing replay fixes the broader fixture failures. Both runs reused the existing baseline runtime; no additional runtime build was invoked.
Supplemental mixed-row gaps: the stale config test also fails at runtime with the same private-helper error; the first-head dialect failure is fixed on the final head. Untouched Gateway agent deletion/recreation timeouts, auth-refresh assertions, a sessions-create admission failure, and a channel-reload assertion also appear in the broad run. Auth-refresh failure signatures reproduce on the baseline; the selected candidate auth/grant cases pass. Deletion/reload and remaining catalog/lifecycle failures remain unclassified prior-head evidence gaps; they are not suppressed, not claimed fixed, and no rerun was requested to seek green. Final-head ordinary PR CI is fully successful, so landing uses the normal exact-head guarded squash route without a red-head exception.