Repository navigation
perf(config): speed up validation with large live shared state - #183082
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 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. |
9079689 to
e398f7c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e398f7cd07
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
The two type-check failures on head
The earlier benchmark fixture writer violation was fixed in this PR and passed its local guard. Broad CI is still running; no failing check is being reported as green. |
|
Codex review: needs changes before merge. What this changesThis PR reads plugin metadata directly from verified live SQLite databases instead of copying unrelated shared state. Example: Run openclaw config validate against a live Gateway with 1 GiB of unrelated shared-state payload.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: the measured optimization is worthwhile, but the new transport loses typed schema refusals and needs a focused repair. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherPlugin-aware config validation requests persisted inventory and discovery metadata through the shared-state read owner, which selects an isolated SQLite child or a retained private snapshot and returns committed metadata rows. flowchart TD
A[Config validation] --> B[Shared state read owner]
B --> C[Verify admission and live owner]
C --> D[Isolated SQLite child]
C --> E[Offline or retained snapshot]
D --> F[Plugin metadata query]
E --> F
F --> G[Config validation result]
Technical reviewBest possible solution: Keep the isolated live-row read and preserve structured schema errors through its transport using the existing error codec. Do we have a high-confidence way to reproduce the issue? Source confirms that main copies the database for this metadata read, and the supplied built-CLI measurements exercise the large live-state trigger; this read-only review did not run a reproduction. Is this the best way to solve the issue? The smallest complete optimization reuses the existing isolated inspection child, metadata query, and live-owner verifier; the distinct snapshot paths remain justified by their byte-preservation contracts. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 149416139cf8. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource +64, Tests +93, Other +287. Total +444 across 8 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 24, 2026, 9:30 PM ET / October 25, 2026, 01:30 UTC. |
e398f7c to
6d6f2c7
Compare
Read plugin metadata through the existing isolated SQLite inspection child instead of backing up unrelated state. Preserve offline artifact-neutral reads, pinned snapshots, managed schema scopes, and live identity/admission checks. Synthetic 1 GiB live shared-state fixture: CLI elapsed 2.96s to 1.29s (-56%), total process-tree CPU 3.27s to 1.58s (-52%). Independent review clean; focused metadata/closure tests and core typecheck passed.
6d6f2c7 to
55ecfd1
Compare
…law#183082) * perf(config): speed up validation with large live shared state Read plugin metadata through the existing isolated SQLite inspection child instead of backing up unrelated state. Preserve offline artifact-neutral reads, pinned snapshots, managed schema scopes, and live identity/admission checks. Synthetic 1 GiB live shared-state fixture: CLI elapsed 2.96s to 1.29s (-56%), total process-tree CPU 3.27s to 1.58s (-52%). Independent review clean; focused metadata/closure tests and core typecheck passed. * fix(perf): seed config benchmark through async state writer * fix(config): preserve schema refusals during live metadata reads * fix(config): narrow live metadata read outcomes explicitly
What Problem This Solves
openclaw config validateslows down as unrelated shared-state data grows while a Gateway is running. Reading two plugin-metadata rows was first backing up the entire shared SQLite database.User Impact
Config validation remains read-only and no longer needs space or time for a full database copy when a verified live Gateway owns the database. No configuration, schema, timeout, or migration changes.
Why This Change Was Made
Use the existing isolated SQLite inspection child and metadata-query owner to read the committed rows in one pinned read transaction. Preserve physical-identity, live-owner, access, schema-version, and parent-admission checks. Offline byte-preserving reads, retained snapshots, and managed schema/maintenance scopes retain their existing paths. Native source handles are closed in the isolated child, not alongside another thread's writer.
Production change: +95 lines in
src/excluding tests. The growth preserves the distinct live-source versus offline/pinned-snapshot contracts; there is no new cache or schema. The live-owner verifier is moved and shared with the existing snapshot owner. Benchmark usage is in its script header; the shared perf README is untouched.Evidence
Local macOS, Node 26.12.1, baseline
d8b07b7e02253e3703c5cbc3caee0a57bcb2e40e. Actual built CLI, synthetic 35 plugin entries, 3 agents, 2 providers/5 models, 10,000 sessions, 6,000 settled runs, and 1 GiB unrelated shared-state payload. A separate isolated loopback Gateway owns the database. No production data or services were used.Final measurements repeat the reviewed implementation, including typed error propagation: two paired groups of five fresh CLI processes per side, candidate/baseline then baseline/candidate; identical instrumentation and startup metadata. All 20 invocations returned valid config. These local runs are sequential and counterbalanced, not simultaneous pinned-host pairs. The candidate was built before the final unrelated main rebase; affected owner sources did not change during that rebase.
Elapsed medians: 3,461/3,952 ms baseline and 1,392/1,364 ms candidate. Ranges: 3,311–4,275 / 2,864–5,130 ms baseline and 1,343–1,531 / 1,339–1,501 ms candidate. Baseline timing is noisy on the shared Mac; the candidate remains consistently below 1.54 s. An earlier 20-run paired experiment before the schema-error correction measured 2,957→1,294 ms (−56.3%) elapsed and 3,274→1,581 ms (−51.7%) CPU. The eliminated work is one whole-database backup for the live plugin-metadata read; the regression proves this without timing assertions by refusing snapshot staging with ENOSPC.
Resource context, startup, and limitations
/usr/bin/timeCPU includes the whole process tree.--cpu-profrun shows the baseline main thread mostly waiting (2.18 s idle) while metadata preparation runs; it is not a timing sample. Initial empty-state validation was about 1.2 s and missed the full-copy path.Reproduce with
scripts/perf/config-validate-measure.mjs(header commands),--payload-mib 1024;--profileis a separate traced pass. The fixture's mock model endpoint is not contacted by config validation.