Skip to content

feat: offload data-only keyed plugin state operations - #146557

Merged
steipete merged 19 commits into
mainfrom
codex/plugin-keyed-store-merged-main-20260912
Sep 14, 2026
Merged

steipete merged 19 commits into
mainfrom
codex/plugin-keyed-store-merged-main-20260912

Conversation

@steipete

@steipete steipete commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Plugin keyed-store methods return Promises while their SQLite work still blocks the calling thread.

User Impact

Ten data-only keyed operations execute SQLite in the shared-state worker while preserving values, errors, expiry, capacity, and ordering. Validation and serialization remain on the caller thread. Synchronous stores and callback-based update and deleteIf retain their documented deprecation contract. On older hosts without optional scalar conditional deletion, Slack retains a relinquished cooldown until expiry (up to eight hours), preserving a newer reservation rather than risking its deletion.

Why This Change Was Made

The worker and synchronous API share query and mutation kernels. Consume remains atomic, bulk reads preserve input positions and per-key errors, and reads do not create missing stores. Scalar conditional deletion lets Slack relinquish its own presence cooldown without a callback.

The canonical shared actor retains TaskFlow, metadata, session-delivery, preferences, Cron, Health, and audit operations. Maintenance ownership and shared fixture fixes landed independently in #148126, #147986, and #148444. This composition preserves those owners and the complete unique test inventory. The two remaining tooling fixtures now assert the actual watch wrapper and separate Gateway/infra plans without weakening selection or ordering assertions.

No schema, stored-data layout, configuration, retention, or OpenClaw version change is introduced.

Evidence

Candidate cd387fc53eef carries one fixture-only follow-up to the qualified runtime at 25c62c39d75b. The iMessage self-chat test now makes its unchanged eight-dispatch assertion after the monitor has joined admitted work. The exact ordered messages, no-error and no-loop assertions, and test deadline are unchanged. Its targeted ordinary synthetic case, scoped gate, and fresh P2 review passed.

The runtime composition preserves 81 unique core-worker entries and 93 unique extension-worker entries. Eight pure routing/build-graph controls, two ordinary KV/Health controls, and complete source review passed. The normal 25c62 build and canonical package checks passed; local artifact SHA-256 804d0e085e1ab7d62b64427f0a6b7c423e01c58142b085992e151e2e93a2560b is 71,505,920 bytes, with all 9,740 dist files matching its build. Both standalone workers and the expected KV exports were verified. This is local static package proof, not a new installed run; the fixture-only successor does not change its runtime inputs.

Completed CI for 25c62c39d75b passed 136 jobs with 10 skipped. Its sole substantive failure observed three dispatches in the self-chat test's pre-drain polling window; the aggregate gate also failed. The follow-up uses the existing completion owner and preserves the original failure evidence without claiming a precise slow-operation cause or an unrecorded post-drain count. Exact follow-up CI passed 139 jobs with 10 skipped, including the repaired self-chat case. Native preparation completed on the same head with hosted gates verified.

An earlier ordinary TaskFlow creation error lost its original cause and remains unattributed. Later passes and the landed cause-preservation improvement do not diagnose that historical failure. The Telegram fixture deliberately admits both messages within one controlled 20 ms window; its 75 ms real-time guard bounds successful completion, while cleanup joins admitted work and can outlast it. No cross-window policy atomicity is claimed.

Prior-head installed qualification on exact d6297838549d passed through the published 2026.9.4 updater, ordinary Doctor, ten compiled host-facade KV operations, close/reopen, manual synthetic Gateway restart, and retained TaskFlow/backup continuity. That run’s Linux package is SHA-256 ac52b43fbe7a0808eb6f46421a4d4704333342e6b6b8d825d87762fac2515b60 (71,377,086 bytes); five installed inventories match all 9,713 packaged regular dist files. Startup took 14 seconds. Original collection and independent receipt review passed, and the owned Testbox was stopped. A post-result runner-portal sync timeout is retained as a warning.

The KV implementation and caller source remain unchanged. Intervening main updates changed build and packaging inputs, including standalone-worker construction; the 25c62 build, static package audit, and ordinary controls qualify those inputs. The d629/ac52 run remains evidence for the unchanged mechanism, not an installed receipt for this new head. Historical packages retain their original identities.

The three measured SQL intervals excluded preflight, legacy controls, and final drain; they establish neither registered-plugin admission nor whole-Gateway zero SQL. The restart uses the ordinary manual synthetic route, not native service-manager restoration. Historical095 evidence and the independent maintenance updater proof keep their original source and package identities.

Related: #144592. Callback/CAS and other worker migrations remain separate work.

@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: slack Channel integration: slack extensions: memory-core Extension: memory-core scripts Repository scripts plugin: file-transfer size: XL maintainer Maintainer-authored PR labels Sep 12, 2026
@steipete
steipete marked this pull request as ready for review September 12, 2026 23:20
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 14, 2026, 7:10 PM ET / 23:10 UTC (Revision 16).

ClawSweeper review

What this changes

Moves ten plugin key-value operations onto the shared SQLite worker, adds optional scalar conditional deletion, and adapts Slack cleanup and test routing.

Merge readiness

⛔ Blocked before merge - 3 items remain

This remains useful work: current main still executes asynchronous keyed-store calls synchronously. No blocking introduced defect was found, and the latest fixture-only follow-up preserves the previously qualified runtime.

Priority: P2
Reviewed head: cd387fc53eefaf839cc99bc4c0707e89754641cc

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful implementation with retained runtime qualification, shared kernels, and explicit compatibility limits; no blocking defect was identified.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): The captured installed qualification exercises the ten compiled keyed-store operations, reopen, and published-updater continuity on d629783; inspected runtime paths are unchanged at this head. Later build/package checks support the composition without claiming a new installed run. Raw linked logs could not be independently retrieved because of the reviewer’s network restriction.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The captured installed qualification exercises the ten compiled keyed-store operations, reopen, and published-updater continuity on d629783; inspected runtime paths are unchanged at this head. Later build/package checks support the composition without claiming a new installed run. Raw linked logs could not be independently retrieved because of the reviewer’s network restriction.
Evidence reviewed 9 items Still necessary on current main: The current-main facade wraps synchronous store methods in async functions; it does not provide this PR’s worker execution.
Latest release retains synchronous execution: The v2026.9.4 source also delegates asynchronous keyed-store methods directly to the synchronous store. The release source was read through GitHub after local object retrieval failed.
Existing owner and atomic operations: The facade validates and serializes before dispatch; the shared actor executes the existing mutation kernels inside write admission. Consume decodes inside its transaction, and conditional deletion compares the live value before deleting.
Findings None None.
Security None None.

How this fits together

Plugin keyed stores persist plugin-scoped values in OpenClaw’s shared SQLite database. The asynchronous facade sends data-only operations to the existing database worker and returns decoded results or typed errors to callers.

flowchart LR
  A[Plugin callers] --> B[Validate and serialize]
  B --> C{Operation kind}
  C -->|Data only| D[Shared SQLite worker]
  C -->|Legacy callback| E[Synchronous transaction]
  D --> F[Shared SQLite database]
  E --> F
  F --> G[Values and typed errors]
Loading

Before merge

  • Resolve merge risk (P1) - Separately deploying the changed Slack plugin on an older host without deleteIfEqual can delay another presence greeting for up to eight hours after relinquishing a reservation; this tradeoff is explicitly documented.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Code growth by role Production and tooling +985 net lines; tests and test support +1594 net lines Growth supports worker dispatch, error transport, and test ownership; extracted kernels remain shared with synchronous compatibility paths.
Plugin API compatibility 1 optional method added; 2 callback methods deprecated and retained Existing adapters remain source-compatible while scalar conditional deletion gains a worker-backed path.

Stored data model

Persistent data-model change detected: unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: partial_overlap
Canonical: #144592
Summary: This implements the data-only keyed-store portion of the broader asynchronous-storage campaign.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Retain the documented older-host behavior (recommended)
    Accept the bounded Slack cooldown delay while preserving optional capability checks and the existing callback compatibility window.

Technical review

Best possible solution:

Keep data-only operations on the canonical shared actor, preserve atomic callback compatibility, and retain the documented older-host cooldown behavior.

Do we have a high-confidence way to reproduce the issue?

Yes, source establishes the current-main behavior: asynchronous keyed-store methods directly execute synchronous SQLite operations. No runtime reproduction was executed during this read-only review.

Is this the best way to solve the issue?

Yes. Reusing the shared actor and transaction kernels avoids a competing persistence owner while preserving the callback API and stored representation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against bc8f013eae00.

Labels

Label justifications:

  • P2: This is a concrete storage responsiveness improvement without evidence of an urgent user-facing outage.
  • merge-risk: 🚨 compatibility: The new optional SDK capability changes Slack cooldown cleanup on older hosts, with a documented delay of up to eight hours.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The captured installed qualification exercises the ten compiled keyed-store operations, reopen, and published-updater continuity on d629783; inspected runtime paths are unchanged at this head. Later build/package checks support the composition without claiming a new installed run. Raw linked logs could not be independently retrieved because of the reviewer’s network restriction.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured installed qualification exercises the ten compiled keyed-store operations, reopen, and published-updater continuity on d629783; inspected runtime paths are unchanged at this head. Later build/package checks support the composition without claiming a new installed run. Raw linked logs could not be independently retrieved because of the reviewer’s network restriction.

Evidence

What I checked:

  • Still necessary on current main: The current-main facade wraps synchronous store methods in async functions; it does not provide this PR’s worker execution. (src/plugin-state/plugin-state-store.ts:177, bc8f013eae00)
  • Latest release retains synchronous execution: The v2026.9.4 source also delegates asynchronous keyed-store methods directly to the synchronous store. The release source was read through GitHub after local object retrieval failed. (src/plugin-state/plugin-state-store.ts:168, 3a9d69db306c)
  • Existing owner and atomic operations: The facade validates and serializes before dispatch; the shared actor executes the existing mutation kernels inside write admission. Consume decodes inside its transaction, and conditional deletion compares the live value before deleting. (src/plugin-state/plugin-state.worker.ts:114, cd387fc53eef)
  • Re-review continuity: The entire delta from the previous reviewed head moves the unchanged eight-dispatch assertion after monitor completion. The production monitor awaits ingress shutdown before returning; ordered-message, error, and loop assertions remain. (extensions/imessage/src/monitor.last-route.test.ts:726, cd387fc53eef)
  • Runtime proof continuity: The captured PR body records published-2026.9.4 updater qualification, ten compiled host-facade operations, close/reopen, Gateway restart, and retained TaskFlow/backup data on d629783, package SHA-256 ac52b43fbe7a0808eb6f46421a4d4704333342e6b6b8d825d87762fac2515b60. The inspected runtime paths have no subsequent delta. The later package audit is static proof, not a new installed receipt. (src/plugin-state/plugin-state-store.ts:188, cd387fc53eef)
  • Proof inspection limitation: The linked qualification run https://github.com/openclaw/openclaw/actions/runs/34890658083 has a cancelled outer workflow. Its underlying result cannot be inferred from that status. Fetching job logs was blocked by the sandbox’s Azure blob-host allowlist, so the recorded inner-run receipts were not independently reread. This does not invalidate the captured qualification evidence. The three inspected downloaded images belong to the related UI PR and receive no storage-proof credit.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Sarah Fortune: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (15 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-14T09:34:58.982Z sha 63013a1 :: blocked before merge. :: [P2] Update release fixtures to exercise maintenance-owned resources
  • reviewed 2026-09-14T18:04:35.939Z sha 889cd06 :: blocked before merge. :: none
  • reviewed 2026-09-14T19:40:26.347Z sha d629783 :: blocked before merge. :: none
  • reviewed 2026-09-14T20:47:51.116Z sha d629783 :: blocked before merge. :: none
  • reviewed 2026-09-14T21:24:41.891Z sha 4284b08 :: blocked before merge. :: none
  • reviewed 2026-09-14T21:45:19.511Z sha 4284b08 :: blocked before merge. :: none
  • reviewed 2026-09-14T22:17:13.794Z sha 8085966 :: blocked before merge. :: none
  • reviewed 2026-09-14T22:37:43.826Z sha 25c62c3 :: blocked before merge. :: none

@steipete
steipete force-pushed the codex/plugin-keyed-store-merged-main-20260912 branch from 6d4677b to caf4c17 Compare September 13, 2026 16:52
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 13, 2026
Await the existing shared-state close owner before resetting test stores
and removing temporary state in 37 verified extension fixtures. Preserve
producer completion, synchronous failure-latch resets, and assertions.

Eighteen selected ordinary cases and the canonical scoped checks pass.
Independent P2 review of the complete fixture packet is clean. This
follow-up changes tests only; runtime source and installed-package proof
remain bound to 0950426.
Admit both messages inside the existing 20 ms window before advancing its
clock, and join only the test album queue work before restoring globals.
Preserve all policy assertions and the real 75 ms completion criterion.
Cleanup retains admitted work even when settlement outlasts that deadline;
this does not claim bounded teardown for arbitrary hung KV work.

Move the unchanged channel-post context builder into existing test support
to keep the fixture within its line limit. The positive all-policy case,
canonical scoped checks, and fresh P2 review pass. Other table cases were
source-reviewed without replay.
Preserve current metadata, session delivery, preference, Health, audit, and TaskFlow dispatch alongside the ten worker-backed keyed operations. Retain canonical test routing and qualify maintenance release through its current resource owner.
Preserve the qualified keyed-store worker and resource lifecycle while composing the landed maintenance prerequisite. Keep the unique database-worker inventory and current full-suite partitioning.
Compose the native main baseline while retaining each database-worker consumer once, including Wizard provenance. Preserve the qualified keyed-store source and the independently landed TaskFlow diagnostic improvement.
Expect the database worker watch wrapper for directory watch selections and the separate infra plan for the core memory-search consumer. Keep exact argument ordering and selection assertions for both owner paths.
Compose the landed UI fixture and current main while retaining the complete shared-worker operation map and unique test ownership. Keep the qualified mixed Gateway watch and aggregate fixture corrections.
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui channel: buzz channel: imessage Channel integration: imessage channel: matrix Channel integration: matrix channel: msteams Channel integration: msteams channel: slack Channel integration: slack channel: synology-chat channel: telegram Channel integration: telegram channel: voice-call Channel integration: voice-call commands Command implementations docs Improvements or additions to documentation extensions: acpx extensions: codex extensions: crabbox extensions: device-pair extensions: memory-core Extension: memory-core extensions: onepassword 1Password plugin maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: beam Beam session sharing plugin plugin: file-transfer plugin: visitor-access proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant