Repository navigation
refactor: move plugin index and Board setup to workers - #167702
Conversation
Use the existing plugin metadata worker for fresh snapshots, leased index commits, and exact-revision rollback. Share identical live guard leaves within each synchronous check while preserving transaction, commit, and disclosure fences and acknowledged receipt custody. Remove duplicate host Board schema preparation on durable routes while retaining native SDK and incognito ownership. T1 inventory falls from 802 to 799 without changing storage or released SDK contracts.
|
🦞👀 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: needs changes before merge. What this changesPlugin administration and Board session dashboards move database work into existing workers while preserving authorization, rollback, and stored data. Review scores
ProductKind: Performance · Worth it: Yes Merge readiness⛔ Needs changes before merge - 1 item remains This PR retains useful work absent from current main. Both prior findings are resolved, and this review found no new blocking code defect. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe Gateway manages plugin installation records and session dashboards stored in SQLite. Database workers perform persistence while the Gateway retains caller authority and publishes acknowledged results. flowchart TD
A[Plugin administration or dashboard write] --> B[Gateway caller checks]
B --> C[Existing database worker]
C --> D[Transaction and commit authorization]
D --> E[SQLite storage]
E --> F[Acknowledged result]
F --> G[Publish metadata or conditionally roll back]
Technical reviewBest possible solution: Keep database work with the existing workers and preserve synchronous SDK exceptions, live authority checks, and exact-revision compensation. Do we have a high-confidence way to reproduce the issue? Not applicable to this performance refactor; source-bound Gateway RPC measurements establish the affected workload, and current source confirms the remaining host database paths. Is this the best way to solve the issue? Yes. Reusing the existing worker and persistence owners preserves the canonical transaction and rollback contracts without creating another storage or policy mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3e9038981322. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +319, Tests +481, Docs +29, Other +15. Total +844 across 36 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 HistoryReview history (4 earlier review cycles)
Reviewed October 9, 2026, 1:56 PM ET / 17:56 UTC (Revision 5). |
Integrate main c647ce7 with a merge commit, retaining both worker inventory classifications and regenerating the report. Forward raw consent caller authority through worker transaction and commit admission while preserving receipt settlement ordering. Regression proof covers revoked reloads without persisting capability acceptance.
Require the caller-authority option and acknowledgment callback in the existing exact writer expectations. This fixes five PR-caused CI assertion failures without changing production code or weakening record, config, and lease assertions.
Resolve the generated inventory conflict by regenerating it from the retained classifications. Preserve the reviewed production delta and the main branch test-probe conversions. This is a conflict-only integration; scoped validation is running before merge admission.
|
Merged via squash.
|
* refactor: move plugin index and Board setup to workers Use the existing plugin metadata worker for fresh snapshots, leased index commits, and exact-revision rollback. Share identical live guard leaves within each synchronous check while preserving transaction, commit, and disclosure fences and acknowledged receipt custody. Remove duplicate host Board schema preparation on durable routes while retaining native SDK and incognito ownership. T1 inventory falls from 802 to 799 without changing storage or released SDK contracts. * test(plugins): expect index acknowledgment callbacks Require the caller-authority option and acknowledgment callback in the existing exact writer expectations. This fixes five PR-caused CI assertion failures without changing production code or weakening record, config, and lease assertions.
What Problem This Solves
Plugin install, uninstall, and reload still perform live index SQL on the Gateway thread. The first durable Board operation also repeats schema preparation on that thread.
User Impact
Plugin administration and first Board writes do less native SQLite work on the Gateway thread. Boot metadata remains stable, rollback preserves later writers, and storage, permissions, and released synchronous SDK contracts stay unchanged. No migration or operator action is required.
Why This Change Was Made
Fresh management policy/index reads use one snapshot in the existing metadata worker. The existing plugin worker also owns leased index commits and exact-revision rollback. It reads the current revision and captures before/after rows in one synchronous transaction. The host retains acknowledged receipts for compensation and invalidates its caches before a late caller refusal; desired metadata is published only after acknowledgment and a current-authority check.
Index mutation preparation runs once, followed by one full live-caller check at the first transaction grant, commit, and disclosure. Transport retains its lightweight liveness checks; the worker retains live lease-row checks and expiry validation. Existing assertion composition shares identical lease checks only within one synchronous invocation. Every later phase checks authority again.
Durable Board writes use the existing worker's schema admission. Native incognito and opaque SDK ownership retain their existing path. Final native authority reads remain explicit until the SDK/storage owner can publish complete revocation facts.
Evidence
Comparison base:
2f1f73ccb2224bbe7d961b4c0d3b29cfdd51e7f8. Final source: ec4479b. Local measurements use macOS, Node 26.10.0, pnpm 12.5.1, and alternating M,C,M,C,M,C runs, with all-thread SQL, MAIN SQL, worker requests, and phase durations recorded independently. Moving SQL between threads is recorded separately from eliminated work. Both sides use the same private startup prelude, which waits for the existing startup-maintenance completion before connecting. The measured RPC workload and shared instrumentation are unchanged, and all startup SQL remains in the boot phase. This prevents the previously diagnosed baseline startup-lease cleanup collision without retries or TTL changes.All values below are medians [min–max] across three alternating baseline/candidate pairs. SQL counts include every thread; MAIN is reported separately.
Worker requests and end-to-end seconds are per measured operation/phase. All duration ratios pass the 1.5 gate; the maximum is 1.363.
MAIN statement changes conserve as follows. “Variation” rows receive no optimization credit.
Expiry SELECT samples alone are install
[300, 300, 300] → [169, 169, 169]and uninstall[429, 430, 430] → [386, 386, 386]. The final live-authority fences remain. No new schema probes or plugin-specific format bypass are added; existing cache-owner schema/user-version observations after foreign commits remain visible in the counts.All-thread deltas conserve independently: install −363 = −385 MAIN +17 metadata-worker statements +5 other helper/worker variation; uninstall −269 = −150 MAIN +15 index-worker statements −134 other maintenance/admission/contention variation. The install MAIN component here differs from its independent MAIN median because each metric selects its own median observation. Moving statements between threads is not counted as eliminated work.
Cold Board removes exactly seven host statements in every run: BEGIN, COMMIT, data-version, two CREATE TABLEs, one CREATE INDEX, and the
board_widgetsschema lookup. MAIN schema counts are[7, 7, 7] → [0, 0, 0]; worker schema counts remain[7, 7, 7] → [7, 7, 7]. The observed all-thread reduction of 19 is seven removed statements plus 12 statements of reader/catalog timing variation.Reload moves two MAIN metadata statements to the worker with no all-thread saving; its remaining seven-statement decrease is existing worker-open and delivery timing, including two marker observations. Refresh likewise moves two statements, adds the required three-statement final native guard, and has 20 fewer statements of unchanged timing (seven MAIN and 13 worker) for its observed net decrease of 17; retained worker schema/user-version observations remain included. Warm Board SQL is unchanged: its raw put/grant/update differences, boot's zero change, and connect's three-statement decrease are existing catalog/open/approval/shared-fact/placement/delivery timing, not additional optimization credit.
No combined window is needed. The only all-thread increases are session creation +24 (+1.42%) and shutdown +8, both within non-turn tolerance and attributable to unchanged owners. Session creation has 45 positive statement contributions matching exact baseline SQL and normalized native stacks; one matches the same stack/template with only its inline clock literal changed. Shutdown has nine exact positive matches and four matching stacks differing only in remaining busy-timeout values. Offsetting statements remain counted. Net request medians are unchanged: catalog +1/delivery −1, and audit prune +1/resource close −1, with matching baseline caller stacks. The audit normalizes only the recorded clock/budget literals for that membership comparison; it does not remove executions. Historical measurements are not pooled with these six runs.
T1 reachability is 802 → 799 (T2 = 370, T3 = 255; worker sites 1067 → 1070; 2494 total sites).
installed-plugin-index-store-write.ts:126:10installed-plugin-index-store-write.ts:249:10installed-plugin-index-store-write.ts:367:20installed-plugin-index-store-write.ts:238sqlite-board-store.kernel.ts:71installed-plugin-index-row.ts:42:12Final-source proof passed 59 focused cases: 29 config/lock/mutation cases and 30 plugin receipt/persistence cases. Source-matched Board, metadata, Gateway-entry, and shared-lease proof is retained separately, including 42 phase-fence cases; overlapping prior runs are not added to this total. Negative controls demonstrate the old MAIN-SQL paths, lost acknowledgment custody, stale-cache publication, and missing final authority checks. Restoring the old config wrappers makes the new boundary regression fail with
[2, 4]guard calls instead of[1, 2]; the fixed path still refuses after revocation across an await.The final plugin command,
pnpm test src/plugins/installed-plugin-index-store-write.receipt.test.ts src/plugins/install-persistence.test.ts --maxWorkers=1, passed in 274.9 seconds wall time with 173.8 summed case-seconds. The config wrapper commands passed in 458.3 seconds wall time with 69.5 summed case-seconds under ordinary repository scheduling. These are local measurements, not measured CI wall time. Existing durable worker/config fixtures account for the seconds-long cases; the added guard regression reuses its existing fixture.Both canonical qaRuntime builds passed (baseline 642.6 seconds, candidate 463.1 seconds); tsdown concurrency was limited to one on the loaded host. Fresh Codex P2 review is scoped-clean. Core and all core-test typecheck lanes, changed-file formatting/lint, schema/version guards, the T1 ratchet, Madge (zero cycles), and Knip files/dependencies passed.
check-changeditself reports the inherited unusedobservePlacementAuthorityexport in untouchedsrc/gateway/worker-environments/placement-turn-authority.ts; all 12 checks after that fail-fast point were executed separately and passed. The canonical SDK diff reports no entrypoint or export changes, bound to the reviewed tree and verified against the final commit tree.The integrated diff spans 36 files: production +493/−174, tests +703/−222, docs/tooling +57/−13. The added code carries worker-phase authority and acknowledged receipts; most test growth protects revocation/expiry, cache invalidation, exact rollback, and real Board/management boundaries. The existing FIFO fixture now waits for persistence entry instead of imposing a one-second polling deadline and always settles accepted work.
The published-driver × final-candidate update cell passed on cbe82ef; the exact-source result is recorded below. No schema, durability, retention, permission, or released synchronous SDK contract changes are included. Final native effect-boundary guards remain explicit. This rare-administration lane claims no warmed-chat-turn saving; historical chat measurements are kept separate from the final owner samples.
Landing repair and integration
Head
cbe82efb8917721ed000d8e4b2420015d15a459eincludes the consent repair inbe2672a99ce0, the test-only callback-expectation repair ina12e54178794, and merge commits integrating main through3e90389813229bd33c169fb07b883b567847224e. Only the worker inventory classifier and generated inventory conflicted; both classifications were retained and the inventory was regenerated. Production files merged without conflicts. Existing paired SQL evidence is reused under the landing proof policy.ClawSweeper’s consent-authority finding is fixed. Capability-consent persistence now forwards the raw caller guard through the index writer’s existing transaction/commit hooks. Managed enable/reload pass that raw guard rather than their composed same-database lease assertion, while the direct chat caller remains protected. Transport keeps lease-liveness checks and acknowledged-result custody before any final caller refusal. Storage schemas, permissions, and public API signatures are unchanged.
The real reload/SQLite regression failed at both transaction and commit admission on the approved pre-fix source: rejection still persisted acceptedSurface. Both cases pass after the repair, with the persisted installation record unchanged and runtime activation absent. The integrated focused run passed all 21 cases across the consent suite, runtime-process build graph, shared-worker imports, and get-reply imports (501.31 seconds wall time across three Vitest shards). The consent file itself had 5 passing cases in 116.54 seconds including transform/setup; its cases totaled about 21.3 seconds. After syncing the lane’s stale dependencies to the merged frozen lockfile, the two new regression cases passed again (221.90 seconds command wall time; 75.94 seconds Vitest duration including setup/transform). These are local measurements, not CI seconds.
Fresh Codex P2 autoreview of the complete integrated candidate is scoped-clean; Madge reports zero cycles. The initial local typecheck identified stale installed fs-safe 0.24.2 versus main’s required 0.25.0, so dependencies were reconciled with the unchanged frozen lockfile. Post-integration core and all core-test typecheck shards passed on that installation.
Released SDK audit: the changed helper signatures and removed internal export are not reachable from the v2026.10.1-beta.1 SDK exports, api.runtime surface, or documented SDK subpaths. The lane’s canonical SDK diff passed with no API changes on tree 13b0d5a1ee6c082e74f6178e8ba4c974621f362b (the approved ec4479b head); the integration and raw-guard repair add no SDK surface change. Existing worker test routing already covers the affected durable suites.
Current-head CI: https://github.com/openclaw/openclaw/actions/runs/37968352048 . The first CI run at be2672a failed five exact mock-option assertions in install-record-commit.test.ts because the new acknowledgment callback was missing from their expectations. Commit a12e541 requires that callback while preserving all exact record/config/lease expectations. All 12 focused cases passed (330.07 seconds command wall time; 270.80 seconds Vitest duration under host load), and the test-only repair received a scoped-clean P2 review. No inherited-failure bypass is claimed.
A later GitHub CONFLICTING state required the second main merge. Only the generated worker inventory conflicted; it was regenerated. The PR's production delta remains unchanged. Current main's Board probe conversion was retained. All 25 Board cases passed (290.67 seconds command wall time), core and all 27 core-test typecheck shards passed, and Madge reported zero cycles after this integration. SQL measurements are reused under the conflict-only landing policy.
Published-driver proof on repaired production head be2672a passed: published 2026.9.9 updated to the candidate, readiness was 200, the running build matched, durable history remained, and incognito history was absent. That lease is stopped. The final-source repetition also PASSED on cbe82ef, tree bbb704fa1454c0f5ddb82dca12a4204405af8a86: published 2026.9.9 driver completed the update, readiness was 200, the running candidate build matched, durable history was preserved and incognito history was absent. Package build/integrity passed (318.2 seconds); the update cell passed in 276.2 seconds with native exit 0 and settled receipt. Package SHA-256: 671faf4c9ca92e0a9efa55f2219d3a8cb0a1512b99172fbe00c9009d8688a2b6. Workflow: https://github.com/openclaw/openclaw/actions/runs/37968429850 . A runner-portal synchronization timeout happened after successful command settlement and did not affect product proof.
The final-head CI run and required openclaw/ci-gate, dependency-review, and security-sensitive-review statuses are green. ClawSweeper's consent and test-expectation findings are fixed, and the requested updater proof is complete. No admin bypass or flaky rerun was used.