Repository navigation
refactor(skills): run Workshop storage operations in the shared worker - #156110
Conversation
Move proposal, evaluation, transition, rollback, reconciliation, and collection review persistence into the existing shared-state worker. Retain filesystem staging and target-lock lifetimes on the host, with grouped live lease admission through transaction and commit settlement.
Use the canonical environment clone before resolving Workshop state and worker routing. Preserve Windows logical key lookup, config-owned provenance, and an independent snapshot across asynchronous proposal work.
|
🦞👀 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 23, 2026, 11:29 PM ET / September 24, 2026, 03:29 UTC (Revision 12). ClawSweeper reviewWhat this changesMoves Skill Workshop proposal, review, rollback, and recovery database operations into the shared SQLite worker while retaining host-side file staging and adding update and lifecycle coverage. Warning SQLite table change This PR modifies persisted SQLite tables in Merge readiness⛔ Blocked before merge - 2 items remain Keep open: current main still runs Workshop proposal persistence on the caller thread, and this branch provides a coherent worker cutover with substantial runtime and upgrade evidence. The prior request for single-worker test wall times remains unmet. Priority: P2 Review scores
Verification
How this fits togetherSkill Workshop receives proposed skill changes and review decisions from agent tools. It stores proposal records and events in shared SQLite state, then uses the result to manage skill files and notifications. flowchart LR
A[Agent tools and reviews] --> B[Workshop service]
B --> C[File staging and leases]
C --> D[Shared SQLite worker]
E[Doctor legacy imports] --> D
D --> F[Proposal records and events]
D --> G[Commit outcome]
G --> H[Skill files and hooks]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +857, Tests +1594, Docs +14, Other +420. Total +2885 across 74 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use the shared worker as Workshop's storage owner while preserving existing lease, rollback, and Doctor recovery contracts; keep factory-construction SQL as separately scoped work. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a storage-ownership refactor. Current-main source establishes the synchronous before state, and the PR reports compiled after-state flows. Is this the best way to solve the issue? Yes: the change uses the existing shared worker, retains host-side file and lease ownership, and leaves legacy import with Doctor. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 45920b3853c2. 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 (11 earlier review cycles; latest 8 shown)
|
Keep captured maintenance assertions receiver-free without weakening identity or currentness checks. Bind legacy proposal import, rollback preservation, complete rows, and recoverable warnings to the candidate Doctor in the published-updater scenario.
Preserve main's incognito review exclusion and lease verification that releases its read snapshot before host admission. Retain Workshop's grouped transaction authority, awaited outcomes, and current Tool Search receipts. Validation: 180 focused tests; core/root types and all 25 core-test type graphs; scoped P0-P2 review. Full core lint has two unchanged main max-lines failures. Final fixture lint passed; stronger published-updater/compiled-flow proof remains pending; this is a private integration checkpoint.
Preserve Tool Search argument and result ownership alongside exact paired Workshop receipts. Supply the inherited Placement lifecycle fixture with its required policyConfig using the same config object. Validation: 44 Workshop contract cases, three Placement lifecycle cases, all 25 core-test type graphs, selected static checks, and scoped P0-P2 review. Current six-case mock-provider E2E, published-updater recovery, and compiled Node/Bun proof remain pending the canonical remote continuation. Earlier 0b9 package and flow evidence remains separately bound.
Preserve canonical durable file creation and its fault-injection coverage alongside awaited Workshop worker assertions. Adopt the upstream Placement fixture and retire the superseded private config variant. Validation: the maintained runner reported 12 focused cases passing; core and selected test types, scoped lint/format, and P0-P2 review passed. The outer allocation monitor hit cache-retirement telemetry loss; its record and a conservative full-phase charge remain preserved. Current remote E2E, published-updater, compiled-flow and exact-head CI proof remain pending.
Settle legacy proposal import before closing the database and copying the rehearsal snapshot. The three owning cases, scoped lint/format checks, and independent P0-P2 review passed.
Merge fixed bc5a318 into the retained Workshop feature branch before the separate calendar-fixture repair. Feature changes compose without conflict. Private recovery checkpoint only. The normal frozen dependency reconciliation completed; current selected type/static/runtime checks and fresh package, published-driver, and compiled-cell proof remain pending. Historical9efeb package evidence is not qualification of this changed runtime graph. Preserve the installer-overlap accounting incident and all earlier failures, including the outer-monitor exit gap. Fresh source review is recorded in the private proof packet; this commit does not assert publication readiness.
The proposal transition fixture froze Date at August 30 while SQLite lease acquisition used real time in its worker. On September 23 the computed expiry delay exceeded Node's signed 32-bit timer limit, which became a one-millisecond timer and incorrectly aborted the otherwise-owned lease. The manifest assertion already sorts by skill key, and proposal IDs carry random UUID suffixes. Remove the obsolete clock setup while preserving every assertion and all production lease behavior. Reproduced the failure in the original Linux child, then passed 20 full-file runs, three original 37-file child replays, workshop owner siblings, changed checks, formatting, and P2 review. The single-worker file cost was 26.28 seconds wall time.
Join the copied shared-state worker lifecycle before removing rehearsal state, and revalidate directory custody after drainage. Preserve cleanup failure as a refusal to delete the copy. A real-file regression reproduces the retained-owner collision after cleanup on the original implementation and passes after the lifecycle fix.
|
Merged via squash.
|
openclaw#156110) * refactor(workshop): run proposal storage in the shared worker Move proposal, evaluation, transition, rollback, reconciliation, and collection review persistence into the existing shared-state worker. Retain filesystem staging and target-lock lifetimes on the host, with grouped live lease admission through transaction and commit settlement. * fix(workshop): preserve captured environment semantics Use the canonical environment clone before resolving Workshop state and worker routing. Preserve Windows logical key lookup, config-owned provenance, and an independent snapshot across asynchronous proposal work. * fix(workshop): validate lease guards and updater recovery Keep captured maintenance assertions receiver-free without weakening identity or currentness checks. Bind legacy proposal import, rollback preservation, complete rows, and recoverable warnings to the candidate Doctor in the published-updater scenario. * test(workshop): match persisted event envelope in upgrade proof * test(workshop): await rehearsal proposal import Settle legacy proposal import before closing the database and copying the rehearsal snapshot. The three owning cases, scoped lint/format checks, and independent P0-P2 review passed. * fix(test): remove obsolete workshop fixture clock The proposal transition fixture froze Date at August 30 while SQLite lease acquisition used real time in its worker. On September 23 the computed expiry delay exceeded Node's signed 32-bit timer limit, which became a one-millisecond timer and incorrectly aborted the otherwise-owned lease. The manifest assertion already sorts by skill key, and proposal IDs carry random UUID suffixes. Remove the obsolete clock setup while preserving every assertion and all production lease behavior. Reproduced the failure in the original Linux child, then passed 20 full-file runs, three original 37-file child replays, workshop owner siblings, changed checks, formatting, and P2 review. The single-worker file cost was 26.28 seconds wall time. * fix(update): drain rehearsal workers before deleting copies Join the copied shared-state worker lifecycle before removing rehearsal state, and revalidate directory custody after drainage. Preserve cleanup failure as a refusal to delete the copy. A real-file regression reproduces the retained-owner collision after cleanup on the original implementation and passes after the lifecycle fix.
What Problem This Solves
Skill Workshop exposes asynchronous services but still performs proposal, evaluation, rollback, and reconciliation database work on the caller thread. Moving those operations to the shared-state worker prevents Workshop storage from blocking that thread while preserving its existing approval and recovery behavior.
User Impact
Proposal creation, review, apply, rejection, rollback, and collection restoration retain their current contracts. No configuration change, schema migration, retention change, or operator action is required. Environment capture preserves Windows case-insensitive state-path lookup and configuration provenance.
Why This Change Was Made
The existing shared-state worker becomes the execution owner for Workshop proposal reads and writes, evaluation, rollback metadata, transitions, collection history, and experience-review outcomes. Record and event writes remain one synchronous transaction with revision comparisons and pending-proposal limits. The host retains filesystem staging and collection/target leases through settlement; worker transactions check every held lease before effects and commit. Failed replies are reconciled before staged generations are discarded or live files restored.
Doctor awaits legacy imports before deleting source sidecars. Transaction-bound relocation kernels and read-only migration readers retain their supplied connections. Table DDL, schema versions, and retention are unchanged.
Rehearsal cleanup now drains the copied database through the existing asynchronous lifecycle owner before removing its directory. The copied path is captured independently of mutable environment data, directory custody is checked again after drainage, and a failed drain preserves the copy.
Evidence
Current source and behavior
All current product evidence below binds to
2ad60f84801f3b48dcc580163fcc4b298b3c21c0. Exact-head CI succeeded with all 171 jobs completed. The Doctor job executed all four producer cases, including applied-history recovery and the new cleanup regression, in its generated merge with main82a518c90ca4.The original CI failure was a worker-identity collision during Doctor rehearsal. A real-file regression reproduces the same guard failure on the original cleanup: Doctor inventory leaves a cached actor after its native reader closes, and a retained hardlink exposes that physical copy to a subsequent worker admission. Draining the copied path repairs this lifecycle defect. The regression uses actual files and worker owners, without mocked identities or timers. It does not establish that inode reuse caused the original CI event; that event was not directly observed.
The repaired regression, three original producer cases, and two cleanup-policy cases pass locally and on Linux. Independent P0–P2 review is clean. The normal changed-file gate passed production types, all 25 core-test type graphs, unused-export checks, scoped lint, formatting, and selected structural guards. Earlier full-core local lint encountered unchanged baseline line limits; that historical failure remains in the receipts, with no local environment or severity override.
Package and published-updater proof
The canonical Linux run passed six real mock-provider E2E cases and the normal package-owner build. The hydration run identifies its lease; joined wrapper results and collected receipts establish the command outcomes. The build took 412.29 seconds and produced a 98,431,266-byte tarball:
174e6da68438530fbd5bd3dc57a0efafe96396de5938e4c08ebaffd038b69b5669c2cad8fbb8f2b7c0b81681ec8b2eeff17ec78d, verified against the exact reviewed2ad60ftree and raw source hashes.That package passed all 25 phases of published
2026.9.4→ candidateworkshop-doctor-recovery. Original process witnesses show the published updater launching candidate Doctor with the update marker. Legacy sidecars and empty Workshop tables were present at entry; proposal, rollback, and event payload[1, {"recovered": true}, null]were present at exit. Corrupt-state refusal, explicit repair, installed-package identity, retained artifacts/warnings, and repeated Doctor assertions passed.Four compiled Linux Node 24.19.0/Bun 1.4.0 write/reopen flows exited successfully and closed through the canonical owner. Each write flow made 18 registered tool calls and five actual pending embedded-TUI allow-once approvals, persisting four proposals and 12 events; each reopen made six calls. All eight SQLite observers and blocking waits were positively calibrated. Imports and write flows recorded zero caller SQL/waits, and every Workshop stage after reopening added zero.
Factory construction debt remains: reopening recorded 4 opens, 4 closes, 12 prepares, 4 execs, 9 gets, and 3 iterations during tool construction. The whole-entry zero-SQL measurement remains false. This PR completes the Workshop operation cut; synchronous config-machine and installed-plugin construction reads require the separate Factory work.
Relevant built exports/workers matched the tarball, and source, artifacts, runtimes, and install metadata remained unchanged during proof. Worker SQL is outside the caller-thread measurement; transitive dependency payload bytes were not exhaustively hashed, and Bun's computed dynamic-import limit remains. No external live-provider, compiled macOS, remote process-tree RSS, or Docker incremental-disk proof is claimed. The lease is stopped and capsule cleanup verified.
Test costs
Seconds below sum reported test-case durations; setup, transformation, and wrapper overhead are separate. Distinct parameterized cases sharing a rendered name are counted separately. CI costs are from the exact-head run above. Earlier one-worker measurements are labeled explicitly; their source/dependency context is not presented as current-head execution.
src/state/openclaw-state-lease-worker-group.test.tssrc/state/openclaw-state-lease-worker.transaction-group.test.tssrc/skills/workshop/store.test.tssrc/skills/workshop/collection-restore.test.tssrc/skills/workshop/experience-review.live-contract.test.tssrc/commands/doctor-update-rehearsal-producer.test.tstest/scripts/upgrade-survivor-migration-order.test.tssrc/agents/tools/skill-workshop-tool.list.test.tssrc/skills/workshop/service.test.tssrc/skills/workshop/experience-review.e2e.test.tsThe new cleanup regression contributes 4.734 seconds locally and 3.742 seconds in CI; the original three producer/inventory cases account for the remaining 96.690/26.847 seconds. They require real copied SQLite state, durable pending/applied records, Doctor inventory, and native actor admission. A mocked close call would miss the retained-owner collision. The six-case E2E protects discovery, registered tools, approvals, and idle-review completion across distinct outcomes; mocking the Workshop service would miss that caller/producer contract. These explain the files exceeding 30 seconds. No timeout, assertion, worker cap, routing, or CI budget was relaxed.
Current-source product proof and exact-head CI are complete. Normal native preparation, merge gates, and landed-source parity remain required. Detailed prior attempts and superseded qualification records remain in retained task receipts rather than being treated as current evidence.