Skip to content

perf(config): avoid synchronous plugin-state snapshots - #170685

Merged
steipete merged 21 commits into
mainfrom
perf/plugin-metadata-state-read
Oct 13, 2026
Merged

steipete merged 21 commits into
mainfrom
perf/plugin-metadata-state-read

Conversation

@steipete

@steipete steipete commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Removes the synchronous SQLite snapshot subprocess from plugin-aware CLI config preparation, following #170230, while avoiding the cold-reader regression in the original version of this PR.

Config validation now asks its existing rule owner whether plugin metadata is needed. Core-only configuration finishes without reading plugin state. Metadata completion and model-catalog preparation stay lazy. Reused configurations that contain plugin settings still validate their schemas: an installed ledger entry can select an external plugin schema, so substituting bundled metadata or skipping those settings would change validation. This includes the native-catalog privacy preferences persisted by the first config write. The installed ledger can point outside the configured scan roots; a cold CLI has no equivalent authoritative non-SQL fact. A parallel file cache would add another persistence owner.

When metadata is needed, preparation reuses the Gateway snapshot or operation-owned prepared facts where available. Cold artifact-preserving reads use the existing isolated asynchronous snapshot child and its SQL worker. The child keeps source file descriptors outside the Gateway process; the worker owns database admission and queries; the existing snapshot owner joins cleanup. Warm readers retain their existing lifecycle. Lease inspection loads its own handler without loading unrelated state-store handlers. The two standalone reader builds bundle the pure JavaScript portions of Kysely, semver, tslog, and fs-safe to reduce cold module initialization. The fs-safe transform preserves installed package URLs for its native binding and platform assets; all other build graphs retain the external package. No dependency version or lockfile changes are involved.

Core config get redaction uses the existing sensitivity hints without generating JSON Schema. Plugin, channel, and agent paths retain plugin-schema hints. No schema, migration, persistent cache, foreign-commit probe, or ownership-policy change is introduced.

The bundled-discovery fact is needed only when deriving plugin discovery/index compatibility, not for every config validation. Its process memo remains keyed by state root and cleared by the plugin lifecycle; private snapshot facts do not replace the live memo. Freshness and effect-boundary authority checks retain their existing owners. History in #127855 explains why a same-process Atomics thread cannot replace raw-source descriptor isolation.

Update behavior and release-note context

The installed updater still runs first and consumes the same persisted plugin index and bundled-discovery compatibility policy. Plugin refresh, backup, rollback, and invalidation retain their existing owners; no new marker is needed. Release-note context: reduce startup work for plugin-aware config reads, writes, and validation without a synchronous SQLite snapshot subprocess.

Evidence

Landing refresh

Merged as 0873425a1ef2a1c36e5296ba648dd51958768f77 through native inherited-failure admission. The exact attempted head and landed-parent audit are recorded in the completed native receipt.

Landed head: 75fd93d4228f58be42228492e3c85c6e47afa360, after merging main d1637c4fcbb9f7f28d4d78bad0cd8007c1243e15 into the approved branch without conflicts. No rebase or additional product changes were made. Main already includes the Doctor fixture drainage change, so that file is no longer part of the PR delta. The previously accepted performance and published-driver results remain historical proof at their stated heads.

The integrated candidate passed fresh isolated Codex autoreview through P2 with no actionable findings. Focused tests passed across five Vitest shards in 70.58 s runner wall: src/state/openclaw-state-read.worker.test.ts, src/plugins/plugin-metadata-state-worker.test.ts, src/config/validation.async.test.ts, src/commands/doctor-post-upgrade.test.ts, and test/scripts/state-read-worker-build.test.ts, invoked with pnpm test <files> --maxWorkers=1. git diff --check passed. Fresh exact-head CI run 38424399459, attempt 1, completed all 114 jobs. Only checks-node-changed-1 and the downstream openclaw/ci-gate failed. The sole test failure is the natural-exit ingress fixture, raising Runtime config is not prepared. Await captureRuntimeConfigAsyncReader()() first. No other test job failed; the earlier native-session and RPC failures did not recur. This remains failed CI, not a green run.

The inherited-only landing evidence binds synthetic CI merge bdb3d0043349f8346248889e84a04848f0c72103, with ordered parents 0538c07d971655f1e7cbe66279112f608595ecd6 and the current head. The failing runtime-snapshot, agent-runtime-config and command-preparation owners are byte-identical to both that CI base and the previously reproduced base 7aa34462c04555decf95b244dff80102e773ef7b. The test change only reports the existing child rejection before reading the missing result file. The retained baseline observer confirms the identical exception; its Docker-emulation limitation and the unproven successful-turn exit remain explicit below. This qualification does not exempt any CI-only timeout.

Previously reviewed candidate: 55d0cc35949db3d8ce51976caefbe5660ff72abc. Performance and Docker proof were measured at 373899d5d199e23e72dbf5dd7fa0965cc6fadcab; this follow-up changes test fixtures only, with production and packaging source unchanged. Matched control: 7aa34462c04555decf95b244dff80102e773ef7b. The final merge preserves main's clean-close SQLite admission, immutable-file URI and canonical identity checks. The earlier measurements on the pre-seal base are superseded below.

Same-base performance

Node 26.11.1, Bun 1.4.3, macOS 27.0.1 arm64. Matched base 7aa34462c04555decf95b244dff80102e773ef7b; final candidate rebuilt with the unchanged full frozen install. Source/build identities, identical package/lock inputs and all 57 changed-source hashes were verified before and after. All 180 timing commands, 14 profiles and 22 untimed seed commands passed. No samples were excluded or runtime tuning inherited. Native clean-close seals were neither manufactured nor removed. Fresh set starts empty and seeds its same-runtime reused state; fresh get/validate start with synthetic config and no database. Each invocation is a new process. /usr/bin/time -l measures instructions, CPU including children, wall and peak-process RSS.

The original matrix has five interleaved pairs per cell. Fresh set on each runtime and Bun reused-get have ten additional pairs, for 15 each. The table reports per-column marginal medians; instruction changes are ratios of those medians. Paired statistics are discussed separately.

Runtime State / command Pairs Wall s before → after CPU s before → after Peak RSS MiB before → after Retired Ginst before → after Instructions change
node set-fresh 15 1.23 → 1.22 1.53 → 1.53 351.88 → 351.98 17.18 → 17.39 +1.2%
node get-fresh 5 0.93 → 0.57 1.17 → 0.69 230.11 → 203.91 13.70 → 7.92 -42.2%
node validate-fresh 5 0.74 → 0.56 0.91 → 0.68 218.30 → 207.97 9.90 → 7.74 -21.8%
node set-reused 5 1.44 → 1.16 1.75 → 1.37 340.30 → 268.17 15.43 → 12.27 -20.5%
node get-reused 5 0.93 → 0.99 1.17 → 1.17 236.64 → 213.33 14.03 → 10.46 -25.5%
node validate-reused 5 2.90 → 1.01 3.69 → 1.19 367.20 → 221.42 18.75 → 10.52 -43.9%
bun set-fresh 15 1.04 → 0.96 5.80 → 5.69 361.27 → 364.80 15.46 → 15.44 -0.2%
bun get-fresh 5 0.79 → 0.51 6.27 → 5.79 329.67 → 211.28 12.25 → 7.52 -38.6%
bun validate-fresh 5 0.58 → 0.45 4.44 → 4.03 255.16 → 217.75 9.35 → 7.43 -20.5%
bun set-reused 5 1.11 → 0.84 5.37 → 3.45 326.81 → 286.88 12.41 → 9.47 -23.7%
bun get-reused 15 0.68 → 0.68 3.15 → 1.60 312.98 → 225.92 9.95 → 7.16 -28.0%
bun validate-reused 5 2.02 → 0.72 12.82 → 3.61 337.14 → 225.92 15.33 → 7.31 -52.3%

Node fresh set has a small replicated instruction cost. Its marginal medians rise +1.205%, and the paired median is +0.623% with IQR [+0.170, +1.678]. 12 of 15 pairs increase and 3 decrease. The ten-pair replication alone has paired median +0.413% with IQR [+0.162, +0.833]. The previous same-base run also showed a positive paired median (+0.702%, IQR [+0.357, +0.709]); the present data therefore does not identify this as a new packaging-only regression. This is retained as an observed small cost, not dismissed as noise, and its exact operation-level cause is not isolated by these measurements.

Fresh-set CPU does not establish a stable improvement. Node combined marginal medians are 1.53→1.53 s; paired change is +0.658% with IQR [−0.637, +1.981]. Bun's initial five-pair CPU increase (marginal +14.78%, paired +5.78%, IQR [−3.94, +31.74]) reverses in the added ten pairs. Combined Bun CPU is 5.80→5.69 s, paired −1.176% with IQR [−10.817, +13.305]. Bun combined instructions are essentially flat (marginal −0.165%, paired −0.676%). These CPU comparisons vary across phases and retain all samples.

Node reused get retains a latency tradeoff: wall 0.93→0.99 s, paired +6.45% with IQR [+6.45, +9.00]. CPU medians are 1.17→1.17 s, while instructions fall 25.5% and peak-process RSS falls about 9.8%.

Bun reused-get CPU remains uncertain after 15 pairs. Marginal medians fall 3.15→1.60 s (−49.2%), but the paired median is +3.65% with IQR [−45.02, +8.36]. The added ten pairs alone have paired −16.31% with IQR [−53.83, +5.92]. Do not present the marginal-median drop as a reliable CPU gain. Combined instructions fall 28.00% (paired −27.38%, IQR [−27.88, −26.83]), peak RSS falls 27.82%, and wall medians are 0.68→0.68 s (paired +1.47%, IQR [−3.59, +5.86]).

RSS is peak-process RSS, not summed process-tree memory. The candidate may use an asynchronous SQLite child plus a SQL worker; aggregate RSS was not measured. These runs use a shared host. Full distributions, user/system CPU, cycles, paired deltas, raw command logs and profiles are retained.

The maintainer accepted the documented Node fresh-set instruction cost and approximately 60 ms Node reused-get latency as tradeoffs for the larger instruction and RSS reductions. Both remain visible above; the measurements are unchanged. The worker imports already existed on the base, and the small added async validation replay preserves default-mutated config facts across its await.

Profiles

All twelve profiles of the measured runtime have zero sampled SQLite synchronous-worker stacks and no runSqliteReadOnlyWorkerSync or prepareSqliteReadOnlyLocationSync frame nodes. Reused-set control reproduces the stack: Node 0.329361 s and Bun 0.216067 s sampled. Candidate set retains the unrelated boot-identity synchronous process check. Cold metadata reads retain one asynchronous isolated child and its SQL worker; no main-thread SQL or process-lock shortcut is introduced.

Fixture drainage follow-up

The Doctor ENOTEMPTY failure was treated as adjacent to this PR rather than assumed inherited. doctor-post-upgrade.test.ts now awaits the database owner's per-path async close before removing its synthetic state directory. Related Doctor, installed-index, bundled-discovery and plugin-metadata fixtures use the same existing owner APIs. Cleanup hooks retire plugin state before the final database drain; generation-precedence and setup-registry teardown order is explicit in one hook. No sleeps, retries, deletion suppression, new production API, or runtime behavior changes were added.

The Doctor file passed 10 consecutive runs, 130 test executions, 196.95 s total wall (18.43 s median), using pnpm test src/commands/doctor-post-upgrade.test.ts --maxWorkers=1. All 15 sibling files passed, covering 124 test cases. The table below records each file's wall time, including wrapper and compilation cost. Affected plugins-platform and commands-doctor type graphs, lint, formatting, and Codex autoreview through P2 pass.

The two previously attributed failure files were run once each through their normal test wrapper. The branch-local pricing test still fails its rejection-versus-fulfilled assertion. The CI merge base includes the main-side test correction 394be69a4d068 (test(usage): align pricing retirement and refresh clock ownership), and all three pricing cases pass there; this fixture follow-up does not claim that repair. Ingress still fails at the same direct exported API call with Runtime config is not prepared. Its full-file local run also hits a CLI transport/skills-watcher cleanup timeout; that additional local failure remains unresolved and did not reproduce in this CI run. Pricing completed in 14.22 s; ingress in 1493.16 s, including the 21m49s runtime build (Vitest: 105.24 s). The production ingress implementation is unchanged; the ingress fixture reports the child rejection before reading its result file.

Fixture proof file results
File Result Wall s
src/commands/doctor/shared/post-core-plugin-convergence.source-checkout.test.ts 7 passed (7) 23.36
src/commands/doctor/shared/plugin-registry-migration.test.ts 5 passed (5) 13.04
src/plugins/setup-registry.runtime.test.ts 4 passed (4) 13.78
src/plugins/installed-plugin-index.compat.test.ts 4 passed (4) 13.55
src/plugins/installed-plugin-index-generation-precedence.test.ts 4 passed (4) 15.47
src/plugins/loader.metadata-retention.test.ts 3 passed (3) 18.82
src/plugins/channel-catalog-registry.workspace.test.ts 3 passed (3) 11.73
src/plugins/plugin-registry.test.ts 12 passed (12) 14.58
src/plugins/plugin-registry-inspection.test.ts 10 passed (10) 21.27
src/plugins/installed-plugin-index.symlink.test.ts 7 passed (7) 10.26
src/plugins/bundled-discovery-state.test.ts 3 passed (3) 16.02
src/plugins/plugin-metadata-snapshot.test.ts 32 passed (32) 20.75
src/plugins/gateway-startup-plugin-plan.bundled-discovery.test.ts 1 passed (1) 18.23
src/plugins/capability-provider-runtime.test.ts 27 passed (27) 9.89
src/plugins/installed-plugin-index-policy.test.ts 2 passed (2) 7.48
src/infra/session-cost-usage-metadata.test.ts 1 failed | 2 passed (3) 14.22
src/commands/agent-exec-plugin.e2e.test.ts 2 failed | 1 passed (3) 1493.16

Focused proof and cost

Final clean-close integration: 20 state-reader/plugin-metadata tests passed (46.00 s runner wall); 91 seal, admission, snapshot identity, preflight and async-config tests passed (82.53 s local wall). These use the default pool with pnpm test <file> --maxWorkers=1. Core types, focused lint/formatting and diff checks passed. Database worker ratchet: 454 → 454 live main-thread calls, deprecated calls 9 → 9; dialect ratchet has no growth.

The final fixture correction retains the actual unknown-model rejection and unchanged config bytes. The fixture previously reused one metadata snapshot after its owner retired; it now relies on the real owner-scoped metadata cache. Roster and main config CLI suites passed 49 tests in 54.26 s local wall (35.67 s Vitest). No production guard or assertion was relaxed. All core test type shards also passed.

Other unchanged-owner proof remains valid: model normalization and workspace policy 20 tests/35.04 s; config validation/redaction/supplied-intent 47/55.91 s; worker build/native boundaries 20/17.68 s; plugin lifetime 1/19.24 s; package extension 1/2.75 s; wrapper inventory 17/40.88 s; wrapper closure 3/6.04 s; legacy updater 23/85.95 s; migrated updater 28/160.56 s; stale worker artifacts 1/26.15 s; full build configuration 55/29.80 s.

The final packaging follow-up extends the native/asset fixture through the unchanged tarball import checker. It failed before the fix with entry.mjs imports missing ../package.json, then passed with all 24 selected build/checker tests in 6.43 s local wall. The transform canonicalizes only a relative require resolving to the installed dependency's own root manifest, using its existing public export. Native and asset locations retain their package anchor. Script and all four root-test type shards, focused lint/format and diff checks pass.

Independent Codex autoreview of the full diff and a fresh review of the packaging follow-up are scoped-clean through P2.

Previous-head CI run 38400960918 completed for 55d0cc35949db3d8ce51976caefbe5660ff72abc: 87 successful jobs, 22 skipped, four failed test jobs plus the failed aggregate gate. Doctor and pricing pass. The failed jobs cover direct ingress, session creation timeouts, config-patch agent mutation timeout, and required-native same-session settlement; attribution and limitations are recorded below. The PR was still open and unmerged at that stage.

Remaining CI attribution

Reinvestigated at head 55d0cc35949db3d8ce51976caefbe5660ff72abc versus its merge base 7aa34462c04555decf95b244dff80102e773ef7b. All five named cases were selected through pnpm test <file> --maxWorkers=1 -t <exact test name>, three times per revision. The table records process wall seconds, including the repository wrapper and compilation. Source archives and file manifests were checked before and after the unmodified test runs.

Platform limitation: both Blacksmith Testbox requests queued and were stopped; neither provided a test host. These are local Docker Linux x64 runs with Node 24.19.0, 8 CPU quota and 12 GiB, under OrbStack's x64 emulation. OrbStack injects --no-opt -r /proc/.p. This is not native Blacksmith execution and does not fulfill the requested native-Linux proof. No AWS or Hetzner lease was used. No lease remains active.

Selected test Head: pass count; wall seconds Merge base: pass count; wall seconds Verdict
agent-exec-plugin: natural exit 0/3 pass; 39.91 / 38.92 / 48.53 0/3 pass; 46.59 / 41.86 / 39.80 CI exception inherited; successful-turn exit still unproven
server.config-patch: fresh revisions after agent mutations 3/3 pass; 110.56 / 107.49 / 186.58 3/3 pass; 172.21 / 119.29 / 104.22 Unresolved: CI agents.create timeout not reproduced
sessions.create.dispatch: repository metadata publication 3/3 pass; 58.51 / 59.61 / 69.64 3/3 pass; 63.57 / 61.76 / 54.54 Unresolved: CI RPC timeout not reproduced
sessions.create.durability: concurrent inputs 3/3 pass; 58.11 / 57.01 / 88.89 3/3 pass; 63.48 / 62.54 / 57.39 Unresolved: CI RPC timeout not reproduced
required-native-same-session: native settlement 0/3 pass; 192.18 / 407.48 / 469.88 0/3 pass; 459.49 / 415.04 / 410.52 Unresolved: local timeout differs from CI terminal error

The original third head round ran alongside a Gateway orphan left by the preceding native-session timeout. It is retained as contaminated evidence and excluded from the table. The replacement third round starts without that orphan. Orphan cleanup records the test failure first, then signals and, if necessary, kills only the task-owned process subtree; it does not change an assertion, suppress a timeout, or turn a failed test into a pass.

Natural exit: all three head runs fail immediately with Runtime config is not prepared. Await captureRuntimeConfigAsyncReader()() first. The old base assertion first reports a missing ingress-result.json; an observer imported directly into that base child confirms the identical underlying exception and stack through readRuntimeConfig → resolveAgentRuntimeConfig → ingress preparation. That strict getter was introduced by 7e48efba10479f90496438e3edf3e0d0121e34c7 (#169714), before the merge base. This PR only reorders assertions in that fixture to expose the child rejection before reading its missing output. CI's exception is inherited; it is not a process-exit timeout.

The unprepared child exits with code 1 and only its three stdio pipes observed. A separate diagnostic prepares config before ingress using the existing captureRuntimeConfigAsyncReader()() API. On the head, the async-hooks observer sees three workers and 61 message ports created during preparation, then no referenced worker or message port when preparation returns. Ingress subsequently hits the separate owner-plugin-not-activatable fixture failure, also observed on the base. The head's eventual exit has only three stdio pipes after eight worker and 189 message-port creations over the whole diagnostic. No orphan process remains. This supports cleanup of the exercised asynchronous read path, but does not prove natural exit after a successful full ingress turn. The failed early NODE_OPTIONS-only observer attempts produced no trace and are not evidence; the reported traces use an explicit import in the synthetic child.

Native session: the local failures do not reproduce CI's REQUIRED-NATIVE-2-A terminal error. The head's first run fails on a cancelled physical receipt for 0-A; its other runs and all base runs time out after the first physical turn. Instrumented head and base both show 0-A physically completed, descendants reaped, lineage not settled, agent.wait returning ok, the committed reply in history, the synchronous settlement read returning, and all three Git commands exiting successfully. They then wait for workspace resume and reach the existing test timeout. The local timeout and orphaned-Gateway behavior therefore predate the PR. The separate CI terminal-error occurrence remains unclassified; a different local failure is not an inherited-failure exemption for it.

Config/session RPCs: each selected config-patch, session-dispatch and session-durability case passes 3/3 on both revisions. These isolated replays do not reproduce the concurrent changed-scope CI shards. In particular, the CI config failure is an agents.create timeout; the older macOS control failed later at config.patch, so neither that result nor #170349 proves this occurrence inherited. The two CI session-create RPC timeouts likewise remain unclassified.

CI run 38400960918 tested synthetic merge cdeebd87 (head merged into a2509eddf05943feae7489f0619fc4b0755b20e8), whereas the requested comparison above is committed head versus its merge base. That integration-tree difference is an additional attribution limit. Scheduled-main failures on different tests and main-push workflows without these shards are not used as exemptions.

The observer-only diagnostics temporarily edit isolated test copies and restore them afterward. No retained production or test change, fix commit, performance rerun, or CI rerun was made in this attribution pass. The accepted performance measurements and prior scoped-clean code review remain unchanged. That previous-head CI remains red, and its unclassified native/RPC failures do not have inherited-only clearance. The PR was still open and unmerged at that stage.

Published-driver upgrade proof

Final-head local OPENCLAW_DOCKER_ALL_LANES="published-upgrade-survivor" node scripts/test-docker-all.mjs passed in 640.37 s wall (survivor lane 380 s). The full build verified all 155 public SDK subpaths; tarball integrity and the prepublish plugin registry passed. Published openclaw@latest 2026.10.2 (b8952d477f0c) updated to the exact candidate build 373899d5d199 with status ok. Automatic migration, mobile pairing/restart, package-local dependency cleanup, standalone Doctor, preserved missing-path config, survival, and Gateway health/readiness/status checks passed. Source remained clean and unchanged throughout; cleanup joined.

The earlier standalone Doctor failure remains historical evidence attributed to #170550; this run did not reproduce it, and no repair for that owner is included here. The intermediate tarball-graph failure was fixed by the focused package-manifest transform above and is distinct from the Doctor issue.

Other synchronous SQLite child callers

Direct caller Remaining owner/contract
prepareSqliteReadOnlyLocationSync Generic private snapshots and retained synchronous SDK reads; process isolation protects native SQLite locks.
readSqliteSourceContentVersionSync Current-content authority, including update checks; fresh source bytes retain their explicit owner.
readSqliteFileGenerationSync Terminal-open/quarantine and file-generation guards; descriptor isolation remains necessary.
cron/store/read-only.worker.ts Cron inspection already runs in its own read worker, with isolated snapshot creation and cleanup.

The plugin-metadata trigger is removed from ordinary async config readers, write snapshots, and metadata-only completion. Remaining consumers include Doctor bloat/lint and index repair, shared-auth bootstrap, Gateway ownership and agent leases, task-delivery recovery, and update authority. Their lock, recovery, or fresh-authority contracts do not admit a cheap plugin-owner cutover.

Prepare plugin policy and inventory through the existing async metadata owner for ordinary config snapshots, write snapshots, and metadata completion. Keep captured snapshot policy separate from the live process memo.

Preserve bundled-discovery compatibility, installed-index selection, persisted state, update behavior, and generic child-process lock isolation. No schema or migration change.
@clawsweeper

clawsweeper Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S labels Oct 13, 2026
@steipete
steipete marked this pull request as ready for review October 13, 2026 05:52
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T15:49:46.570392Z 75fd93d New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a554119cc

ℹ️ 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".

Comment thread src/config/io.snapshot.ts Resolved
Keep direct bundled policy defaults on their existing lazy path. Prepare plugin metadata asynchronously only when the fallback needs a registry.

Update the CLI startup contract to require async Doctor metadata reads independently of Gateway host-scope ownership.
@openclaw-barnacle openclaw-barnacle Bot added the cli CLI command changes label Oct 13, 2026
Retain the existing inspection scope in the shared async snapshot reader and through metadata-only completion. Exercise plain, host, metadata and write snapshots directly; the old candidate fails artifact preservation for three cases.
Keep validation decisions with the rule owner and avoid unused inventory completion for core config reads. Preserve catalog policy and plugin schema checks when metadata is required, while loading unrelated state-reader handlers only for their own commands.
Promise-only plugin metadata reads reuse the existing native child session for token allocation, artifact-preserving copy, and retirement. Keep SQL in the read worker and preserve the retained staging path for synchronous servicing. Focused artifact, async config, and single-flight proof passed; independent review is clean through P2. Performance acceptance remains to be measured before publication.
@steipete steipete changed the title fix: avoid blocking SQLite snapshots during config validation perf(config): avoid synchronous plugin-state snapshots Oct 13, 2026
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XL and removed size: S labels Oct 13, 2026
@openclaw-barnacle openclaw-barnacle Bot added the commands Command implementations label Oct 13, 2026
@steipete
steipete merged commit 0873425 into main Oct 13, 2026
184 of 187 checks passed
@steipete
steipete deleted the perf/plugin-metadata-state-read branch October 13, 2026 16:34
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

steipete added a commit that referenced this pull request Oct 13, 2026
## What Problem This Solves

Scheduled main CI run [38432046450](https://github.com/openclaw/openclaw/actions/runs/38432046450), job 115417048066, fails the kernel's no-transport startup test because its expected diagnostic trace still assumes eager plugin metadata loading during config validation.

#170685 (`0873425a1ef2a1c36e5296ba648dd51958768f77`) deliberately made metadata loading lazy. For this core-only Gateway config, config materialization and observation complete before metadata scanning. Startup still awaits that metadata before state admission and runtime bootstrap.

## Change

Move the two metadata trace entries after `config.snapshot.read.observe`. Retain all 60 expected events and the exact ordering assertion. No production behavior or runtime checks change.

## Evidence

The original scheduled failure shows precisely this ordering difference. The async validation owner also covers core-only settings without loading plugin metadata. Changed-file formatting, lint, and `git diff --check` pass. One isolated Codex P0–P2 review is scoped-clean. Ordinary CI run [38436656398](https://github.com/openclaw/openclaw/actions/runs/38436656398/job/115432883237) passes the original case in 7,337 ms and the complete edited file: 11/11 tests, 79.68 s Vitest / 82.27 s wrapper. No local test rerun was needed. CI ratchets report T1 452 → 452, compatibility 9 → 9, and dialect growth 0 across all three groups.

Test-only change: no SQL/request behavior or T1 call-count change; no SQL harness, SDK diff or update cell is warranted. LOC: tests +2/−2, production 0.

Direct emergency pushes were previously refused by repository protection (GH006); this repair uses the authorized PR and head-pinned REST squash fallback.
steipete added a commit that referenced this pull request Oct 13, 2026
## What Problem This Solves

Scheduled main CI run [38432046450](https://github.com/openclaw/openclaw/actions/runs/38432046450), dependency job 115417046598, found three static-analysis regressions after two ownership moves.

- #171103 (`e454b2b80ca03e55b9ff58f924d1216552def9d5`) moved the Canvas builder into root scripts. Knip now attributes `@solidjs/web` and `solid-js` to the root workspace, although the builder resolves both through `extensions/canvas/package.json`, which declares them.
- #170685 (`0873425a1ef2a1c36e5296ba648dd51958768f77`) moved plugin metadata reads to the worker kernel but retained an unused facade re-export.
- The same change added a native dependency fixture launched by file path. The full-tree scan needs that subprocess entrypoint declared so it follows the fixture's dependencies.

## Change

Document the two Canvas-owned dependency exceptions alongside the existing compiler exception. Remove only the unused facade re-export; keep the local import, kernel export, and worker implementation. Declare the exact subprocess fixture as an audited Knip entrypoint.

No runtime behavior, database calls, dependency versions, public SDK surface, schema, migration, update, or service lifecycle changes. No checks are removed and no new concurrency edge cases are accepted. This patch makes no warmed SQL/request or T1 reduction claim; no SQL harness is warranted.

## Evidence

Changed-file formatting, syntax-only lint, and `git diff --check` pass. One isolated Codex P0–P2 review passed with no findings. Exact-source [CI proof 38436526162](https://github.com/openclaw/openclaw/actions/runs/38436526162/job/115431841520) passes all three original commands: dependency, unused-file and export scans, with no findings. Ordinary CI [38435429012](https://github.com/openclaw/openclaw/actions/runs/38435429012) passes lint, types, source contracts, Madge and database ratchets.

The ordinary CI failure in the unchanged one-shot ingress E2E is independently reproduced on the exact main base `5415a05cd1ec5d5ce70bfd145bdfdf604bf19fde`: [base run 38437637112](https://github.com/openclaw/openclaw/actions/runs/38437637112/job/115435700602) has the same workspace-skills case, rejected-vs-fulfilled assertion and `Runtime config is not prepared` stack through `resolveAgentRuntimeConfig`. The source remained unchanged during both proof runs. Land under the authorized inherited-failure exception; the separate owner repair is #171209. No PR-caused static failure is waived.

LOC: tooling +5/−0; production +0/−1; three files. No tests added or changed.

Direct emergency pushes were previously refused by repository protection (GH006). This repair uses the authorized PR and head-pinned REST squash fallback.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
* fix: avoid blocking SQLite snapshots during config validation

Prepare plugin policy and inventory through the existing async metadata owner for ordinary config snapshots, write snapshots, and metadata completion. Keep captured snapshot policy separate from the live process memo.

Preserve bundled-discovery compatibility, installed-index selection, persisted state, update behavior, and generic child-process lock isolation. No schema or migration change.

* fix: preserve lazy provider defaults in async snapshots

Keep direct bundled policy defaults on their existing lazy path. Prepare plugin metadata asynchronously only when the fallback needs a registry.

Update the CLI startup contract to require async Doctor metadata reads independently of Gateway host-scope ownership.

* fix(config): preserve unobserved async snapshot artifacts

Retain the existing inspection scope in the shared async snapshot reader and through metadata-only completion. Exercise plain, host, metadata and write snapshots directly; the old candidate fails artifact preservation for three cases.

* perf(config): load plugin metadata only when rules need it

Keep validation decisions with the rule owner and avoid unused inventory completion for core config reads. Preserve catalog policy and plugin schema checks when metadata is required, while loading unrelated state-reader handlers only for their own commands.

* perf(state): preserve lazy read-worker build chunks

* fix(build): remove ineffective session read import

* perf(state): retain awaited snapshots in one native child

Promise-only plugin metadata reads reuse the existing native child session for token allocation, artifact-preserving copy, and retirement. Keep SQL in the read worker and preserve the retained staging path for synchronous servicing. Focused artifact, async config, and single-flight proof passed; independent review is clean through P2. Performance acceptance remains to be measured before publication.

* perf(state): avoid supervisor startup for awaited reads

* perf(state): retire cold read workers before metadata loading

* perf(config): avoid schema work and reuse maintenance readers

* perf(state): keep cold metadata readers inside snapshot children

* perf(state): defer unrelated handlers during lease inspection

* perf(build): trim cold SQLite reader dependency loading

* fix(config): preserve lazy metadata build boundaries

* test(build): distinguish worker-only declaration graphs

* test(config): keep fixture metadata within its cache owner

* fix(build): preserve bundled reader manifest dependencies

* test(doctor): await state drainage before fixture cleanup
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
…aw#171203)

## What Problem This Solves

Scheduled main CI run [38432046450](https://github.com/openclaw/openclaw/actions/runs/38432046450), job 115417048066, fails the kernel's no-transport startup test because its expected diagnostic trace still assumes eager plugin metadata loading during config validation.

openclaw#170685 (`31c7ade62123d4fadedee50d7ad5e688397d9f23`) deliberately made metadata loading lazy. For this core-only Gateway config, config materialization and observation complete before metadata scanning. Startup still awaits that metadata before state admission and runtime bootstrap.

## Change

Move the two metadata trace entries after `config.snapshot.read.observe`. Retain all 60 expected events and the exact ordering assertion. No production behavior or runtime checks change.

## Evidence

The original scheduled failure shows precisely this ordering difference. The async validation owner also covers core-only settings without loading plugin metadata. Changed-file formatting, lint, and `git diff --check` pass. One isolated Codex P0–P2 review is scoped-clean. Ordinary CI run [38436656398](https://github.com/openclaw/openclaw/actions/runs/38436656398/job/115432883237) passes the original case in 7,337 ms and the complete edited file: 11/11 tests, 79.68 s Vitest / 82.27 s wrapper. No local test rerun was needed. CI ratchets report T1 452 → 452, compatibility 9 → 9, and dialect growth 0 across all three groups.

Test-only change: no SQL/request behavior or T1 call-count change; no SQL harness, SDK diff or update cell is warranted. LOC: tests +2/−2, production 0.

Direct emergency pushes were previously refused by repository protection (GH006); this repair uses the authorized PR and head-pinned REST squash fallback.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
…w#171194)

## What Problem This Solves

Scheduled main CI run [38432046450](https://github.com/openclaw/openclaw/actions/runs/38432046450), dependency job 115417046598, found three static-analysis regressions after two ownership moves.

- openclaw#171103 (`7ac851a8faa004550f9f5906464352aa17ab42a7`) moved the Canvas builder into root scripts. Knip now attributes `@solidjs/web` and `solid-js` to the root workspace, although the builder resolves both through `extensions/canvas/package.json`, which declares them.
- openclaw#170685 (`31c7ade62123d4fadedee50d7ad5e688397d9f23`) moved plugin metadata reads to the worker kernel but retained an unused facade re-export.
- The same change added a native dependency fixture launched by file path. The full-tree scan needs that subprocess entrypoint declared so it follows the fixture's dependencies.

## Change

Document the two Canvas-owned dependency exceptions alongside the existing compiler exception. Remove only the unused facade re-export; keep the local import, kernel export, and worker implementation. Declare the exact subprocess fixture as an audited Knip entrypoint.

No runtime behavior, database calls, dependency versions, public SDK surface, schema, migration, update, or service lifecycle changes. No checks are removed and no new concurrency edge cases are accepted. This patch makes no warmed SQL/request or T1 reduction claim; no SQL harness is warranted.

## Evidence

Changed-file formatting, syntax-only lint, and `git diff --check` pass. One isolated Codex P0–P2 review passed with no findings. Exact-source [CI proof 38436526162](https://github.com/openclaw/openclaw/actions/runs/38436526162/job/115431841520) passes all three original commands: dependency, unused-file and export scans, with no findings. Ordinary CI [38435429012](https://github.com/openclaw/openclaw/actions/runs/38435429012) passes lint, types, source contracts, Madge and database ratchets.

The ordinary CI failure in the unchanged one-shot ingress E2E is independently reproduced on the exact main base `cdd2bfe7cccca0c6c1cc21890ff202f2eec288af`: [base run 38437637112](https://github.com/openclaw/openclaw/actions/runs/38437637112/job/115435700602) has the same workspace-skills case, rejected-vs-fulfilled assertion and `Runtime config is not prepared` stack through `resolveAgentRuntimeConfig`. The source remained unchanged during both proof runs. Land under the authorized inherited-failure exception; the separate owner repair is openclaw#171209. No PR-caused static failure is waived.

LOC: tooling +5/−0; production +0/−1; three files. No tests added or changed.

Direct emergency pushes were previously refused by repository protection (GH006). This repair uses the authorized PR and head-pinned REST squash fallback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation scripts Repository scripts size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant