Repository navigation
refactor(sdk,state,skills): deslop plugin SDK internals, state and skills - #159299
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 27, 2026, 1:08 PM ET / 17:08 UTC (Revision 15). ClawSweeper reviewWhat this changesThe branch consolidates Plugin SDK, SQLite state, and skill helpers while fixing abort cleanup, media-reader release, login cancellation, remote-skill refresh, and migration redaction edge cases. Merge readiness⛔ Blocked before merge - 4 items remain Keep this PR open. Current main does not contain its distinct cleanup and fixes, and the reviewed code has no definite blocking defect. The remaining blocker is preservation of existing sessions and profiles through the changed legacy database copy paths. Priority: P2 Review scores
Verification
How this fits togetherThe Plugin SDK connects channel and provider plugins to core dispatch; skill preparation supplies instructions to agent runs. SQLite state helpers read and update stored sessions and profiles, including during upgrades. flowchart LR
A[Channel and provider calls] --> B[Plugin SDK helpers]
B --> C[Replies and task updates]
D[Skill files and remote catalogs] --> E[Skill preparation]
E --> F[Agent context]
G[Existing SQLite databases] --> H[State and migration helpers]
H --> F
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the consolidated owners and verify session and profile preservation using the shipped updater, populated database copies, and before-and-after comparisons before landing. Do we have a high-confidence way to reproduce the issue? Not applicable to the refactor as a whole. The PR reports original-source negative controls for five targeted fixes, while the legacy upgrade path still needs an existing-state comparison. Is this the best way to solve the issue? Yes for consolidating duplicate internal paths under existing owners; the storage portion needs upgrade evidence before its behavior-preserving claim is complete. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2948123d63d1. LabelsLabel changes: No label 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 (14 earlier review cycles; latest 8 shown)
|
310651c to
cdbb2c3
Compare
|
cdbb2c3 to
bc859e6
Compare
bc859e6 to
63e9505
Compare
63e9505 to
e566640
Compare
…ills (openclaw#159299) * refactor(sdk,state,skills): deslop plugin SDK internals, state and skills * fix(sdk): preserve declaration surface and deterministic API reports * refactor(sdk): retain typed loaders and owned callbacks
What Problem This Solves
SDK internals, shared-state helpers, and skill preparation repeat projections and ownership plumbing that can run through their existing owners.
User Impact
The refactoring preserves every public Plugin SDK entrypoint and type, SQLite schema and persistent-store policy, config key, and whole-skill serving contract. Small fixes found during the sweep settle channel cleanup correctly, release failed media readers, unblock cancelled login attempts, avoid unnecessary skill refreshes, and handle cyclic migration-report arrays.
Why This Change Was Made
Removes 694 net production lines after rebasing onto
be43232aa6d6e1d9086380b1079f622e2cf52058. The initial candidate exceeded 1,000 lines, but #156541 landed overlapping state cleanup during validation. This PR retains those merged owners and drops duplicate work. The complete below-threshold coverage log is included below: every current production file over 200 lines, sorted by size, with its READ disposition.Retained simplifications and rationale
Fixes found along the way
Evidence
Validated; hosted CI blocked by the inherited Windows PNG fixture at
e5666405ac80ec94e485c9791b69f6fb341bc53b: 694 net production lines removed, with complete 228-file READ coverage below. The final rebase incorporates #159654's File Transfer boundary repair and commite52420e1eea6c614ba7730d3d36980167478c6df's stale shared-worker admission repair. All three reviewed lane commits are patch-identical across this rebase.Final-source proof passed on Blacksmith Testbox, provider
blacksmith-testbox, leasetbx_01m3hrh829bnj7th66t0v7cw57, run. The wrapper verified sourcee5666405ac80ec94e485c9791b69f6fb341bc53band its tree before execution; delegated checkouts use a synthetic carrier commit. The lease is stopped.pnpm build: passed, 379.51 s. The prior interrupted build was replaced by this complete result.Final-head hosted CI is blocked by
src/agents/tools/media-tool-file-url.windows.test.ts: its old PNG fixture has an invalid compressed-data checksum, exposed by the new decode validation in #159668. The Windows image read succeeds but decoding reportsincorrect data check. Existing #159770 owns the canonical-fixture repair; this lane does not duplicate it or weaken the assertion. The dependency must land and hosted CI be refreshed before claiming READY-TO-LAND.Retained proof for the unchanged reviewed patch:
node scripts/check-changed.mjspassed atbc859e65cefe(1,649.73 s); the scoped changed gate for the final state reconciliation passed at63e95056492fwith the exact upstream File Transfer fix (1,641.14 s).ff7b090f, without an acknowledgement or suppression.node scripts/run-vitest.mjs src/plugin-sdk src/state src/skills: 6,170 tests passed across 519 files, with 25 tests / one file skipped, 621.65 s.pnpm test:extensions:batch irc,migrate-claude,openrouterpassed. The original build passed in 381.18 s; it emitted only approximately 0.1 KiB soft UI gzip warnings, with hosted UI performance green.pnpm test src/plugin-sdk/api-baseline.test.ts --maxWorkers=1: 20 consecutive Linux passes, all 28 tests each time. Fresh reconciled API/state/Doctor proof also passed in 110.03 s.The inherited Agents API line-cap failure was fixed by #159262; the conversation database teardown race was fixed by #159445, so duplicate candidate repairs were dropped. The Codex startup-scan fixture race is fixed separately in #159664, with original failing proof, 21 whole-file passes and three exact shard replays.
The later migration failure was reproduced in the original five-group CI workload and again with receipt diagnostics: plugin lifecycle lease loss affected multiple matrix rows. Upstream
e52420e1eeafixes the cause: inode-matched cached actors could retain invalid admission and reopen a retired path. The branch preserves that producer fix and its awaited fixture cleanup. It also carries #159654 rather than changing the filesystem-boundary scanner. One prior Testbox ended during build; that unfinished build is not counted as passing.Changed-test measurements from the original-source/candidate proof on Linux Testbox (
pnpm test <file> --maxWorkers=1, whole-command wall):src/plugin-sdk/channel-lifecycle.test.tssrc/plugin-sdk/outbound-media.test.tssrc/plugin-sdk/provider-auth-login-flow-runtime.test.tssrc/skills/runtime/remote-skills.test.tssrc/plugin-sdk/migration-sensitive-redaction.test.tssrc/plugin-sdk/provider-oauth-runtime.test.tssrc/skills/lifecycle/upload-store.test.tsHosted times are sums of Vitest case durations in successful CI run 36314814265, exact head
bc859e65cefe2f0c810902f6b0f531ee68204759. They exclude transform, collection, startup and file teardown; zero is reporter rounding. Per-file wall time was not retained by hosted CI.Complete production coverage log (228 files over 200 lines)
l105 production coverage
Final coverage after rebasing onto
be43232aa6d6e1d9086380b1079f622e2cf52058. Every current production file over 200 lines insrc/plugin-sdk,src/state, andsrc/skillsis listed below, sorted by current size. Test/test-support files are excluded; generated schemas and declarations are included and remain unchanged in this PR. All listed files were read by the lead or its subsystem reviewers.Prior merged deslop patches and name-only diffs were inspected before implementation. During validation, #156541 landed overlapping state cleanup; the rebase retained those canonical owners and removed duplicate lane work. The final PR is therefore below the original line-reduction target despite the initial reviewed candidate exceeding 1,000 net production lines. New upstream async task and execution/heartbeat changes were read and preserved during the final rebase.
src/state/openclaw-state-schema.sqlsrc/state/openclaw-state-db.generated.d.tssrc/state/openclaw-agent-schema.sqlsrc/plugin-sdk/approval-native-helpers.tssrc/plugin-sdk/core.tssrc/skills/security/scanner.tssrc/state/openclaw-agent-db.tssrc/skills/runtime/refresh.tssrc/plugin-sdk/approval-reaction-runtime.tssrc/state/openclaw-state-db-cache.tssrc/state/openclaw-state-db-async-lifecycle.tssrc/skills/lifecycle/install.tssrc/state/user-profile-list.tssrc/plugin-sdk/provider-stream-shared.tssrc/state/openclaw-agent-db-lease.tssrc/state/openclaw-state-db-readonly.tssrc/skills/loading/workspace-skill-loader.tssrc/skills/loading/skill-root-discovery.tssrc/plugin-sdk/qa-runner-runtime.tssrc/plugin-sdk/provider-onboard.tssrc/state/openclaw-agent-execution.worker.tssrc/plugin-sdk/provider-auth-login-flow-runtime.tssrc/plugin-sdk/agent-harness-task-runtime.tssrc/state/openclaw-state-db-maintenance.tssrc/state/openclaw-state-read-worker.tssrc/state/openclaw-database-preflight.tssrc/plugin-sdk/session-transcript-runtime.tssrc/plugin-sdk/agent-harness-runtime.tssrc/plugin-sdk/outbound-media.tssrc/plugin-sdk/channel-entry-contract.tssrc/plugin-sdk/persistent-dedupe.tssrc/state/openclaw-state-worker-runtime.tssrc/plugin-sdk/session-store-runtime.tssrc/plugin-sdk/api-baseline-declaration-closure.tssrc/skills/runtime/remote.tssrc/state/openclaw-agent-db-lifecycle.tssrc/state/user-model-accounts.tssrc/state/openclaw-agent-execution.tssrc/state/openclaw-state-lease.tssrc/state/openclaw-agent-db.generated.d.tssrc/skills/lifecycle/clawhub-install-core.tssrc/state/agent-deletion-journal.tssrc/state/openclaw-agent-db-schema.tssrc/state/openclaw-state-db-legacy-backfills.tssrc/state/openclaw-state-read.worker.tssrc/state/openclaw-state-worker-owner.tssrc/skills/workshop/apply-transition.tssrc/plugin-sdk/provider-tools.tssrc/plugin-sdk/reply-payload.tssrc/state/user-profiles.tssrc/plugin-sdk/provider-entry.tssrc/state/openclaw-state-db.tssrc/state/openclaw-quarantine-store.tssrc/state/openclaw-agent-execution-native.tssrc/state/openclaw-state-lease-heartbeat.tssrc/skills/workshop/store.tssrc/state/openclaw-agent-db-session-migrations.tssrc/skills/lifecycle/clawhub-status.tssrc/plugin-sdk/channel-config-helpers.tssrc/plugin-sdk/runtime-doctor-migrations.tssrc/state/user-profiles-internal.tssrc/state/openclaw-state-read.types.tssrc/skills/runtime/refresh-content-native.tssrc/plugin-sdk/provider-catalog-live-runtime.tssrc/state/user-profile-github-identity.tssrc/plugin-sdk/provider-catalog-live-normalize.internal.tssrc/plugin-sdk/api-baseline.tssrc/skills/lifecycle/clawhub-store.tssrc/plugin-sdk/approval-delivery-helpers.tssrc/plugin-sdk/api-diff.tssrc/plugin-sdk/status-helpers.tssrc/plugin-sdk/memory-host-core.tssrc/state/openclaw-state-lease-worker-owner.tssrc/plugin-sdk/migration-runtime.tssrc/plugin-sdk/qa-runtime.tssrc/plugin-sdk/allowlist-config-edit.tssrc/skills/library/service.tssrc/skills/library/bundle.tssrc/skills/discovery/status.tssrc/plugin-sdk/provider-catalog-live-acquisition.internal.tssrc/state/openclaw-state-db-schema-repair.tssrc/state/openclaw-state-db-read-connection.tssrc/state/user-channel-identities.tssrc/state/openclaw-state-worker-error.tssrc/state/openclaw-agent-worker-store.tssrc/plugin-sdk/windows-spawn.tssrc/state/openclaw-agent-db-session-nodes-migration.tssrc/plugin-sdk/channel-policy.tssrc/skills/workshop/service.tssrc/plugin-sdk/provider-model-shared.tssrc/skills/lifecycle/workspace-skill-write.tssrc/plugin-sdk/secret-ref-runtime.tssrc/plugin-sdk/migration.tssrc/plugin-sdk/infra-runtime.tssrc/plugin-sdk/session-visibility.tssrc/state/openclaw-state-db-schema-additive.tssrc/state/openclaw-agent-db-validation-cache.tssrc/plugin-sdk/qa-channel-protocol.tssrc/skills/lifecycle/upload-store.tssrc/plugin-sdk/webhook-request-guards.tssrc/state/openclaw-agent-db-admission.tssrc/skills/loading/plugin-skills.tssrc/state/openclaw-state-db-table-retirements.tssrc/skills/runtime/resources.tssrc/plugin-sdk/provider-auth.tssrc/plugin-sdk/session-visibility-internal.tssrc/skills/runtime/workspace-worker.tssrc/state/agent-database-admission.tssrc/state/agent-database-startup.tssrc/skills/workshop/service-evaluation.tssrc/skills/workshop/service-propose.tssrc/skills/library/store.tssrc/state/openclaw-state-worker-contract.tssrc/skills/loading/workspace-skill-sync.runtime.tssrc/state/openclaw-agent-db.paths.tssrc/plugin-sdk/channel-ingress-runtime.tssrc/plugin-sdk/webhook-targets.tssrc/plugin-sdk/discord.tssrc/state/user-profiles-avatar.tsrequireStateLifecycle; the worker operation contract retired that option with the coordinator cutover. Current physical-identity admission, before-row validation, retained settlement publication, cache bounds and stale-byte checks remain intact. Our shared row validator preserves the same predicate and our ordered-email selector preserves inspection results; no conflicting cleanup or additional sound change found.src/plugin-sdk/provider-auth-claude-compat.tssrc/state/openclaw-state-db-repair.tssrc/state/openclaw-agent-db-readonly-scope.tssrc/state/openclaw-agent-db-registry-listing.tssrc/state/user-profile-events.tssrc/state/openclaw-state-db-audit-migration.tssrc/skills/library/selection.tssrc/state/user-github-connections.tssrc/plugin-sdk/provider-catalog-shared.tssrc/state/openclaw-agent-db-schema-helpers.tssrc/skills/runtime/refresh-state.tssrc/state/openclaw-state-worker-error-identity.tssrc/skills/lifecycle/clawhub-uninstall.tssrc/skills/lifecycle/install-download.tssrc/plugin-sdk/channel-inbound.tssrc/plugin-sdk/api-baseline-declaration-print.tssrc/plugin-sdk/provider-auth-runtime.tssrc/skills/loading/session.tssrc/skills/lifecycle/clawhub.tssrc/skills/workshop/experience-review.tssrc/state/openclaw-database-verify.impl.tssrc/state/user-channel-identity-operations.tssrc/plugin-sdk/facade-loader.tssrc/state/session-repository-workspaces.tsmutatealready owns revision checks, current authority, write and publication; creation/deletion retain their different artifact lifecycle.src/skills/lifecycle/archive-install.tssrc/plugin-sdk/file-lock.tssrc/skills/lifecycle/upload-store.kernel.tssrc/state/openclaw-state-worker-lease.tssrc/skills/runtime/refresh-watch-path.tssrc/state/user-profile-identity.read.tstoUserProfilethroughObject.assignand the canonical email-alias selector. Keep the fresh-main file unchanged; alias/prefix/damaged-key boundaries remain distinct.src/plugin-sdk/pair-loop-guard-runtime.tssrc/state/openclaw-agent-db-legacy-schema.tssrc/state/openclaw-state-db-startup-checkpoint.tssrc/plugin-sdk/channel-outbound.tssrc/state/openclaw-state.worker.tssrc/skills/lifecycle/workspace-types.tssrc/skills/workshop/tool-policy-diagnostic.tssrc/plugin-sdk/provider-selection-runtime.tssrc/plugin-sdk/provider-oauth-runtime.tssrc/plugin-sdk/channel-replay-guard.tssrc/plugin-sdk/command-auth.tssrc/skills/workshop/experience-review-scheduler.tssrc/skills/runtime/remote-skills.tssrc/plugin-sdk/feature-plugin.tssrc/skills/runtime/refresh-ancestor-native.tssrc/state/openclaw-agent-schema-inspection-worker.tssrc/plugin-sdk/control-ui.tssrc/state/openclaw-state-db-schema-v13-widerow.tssrc/skills/discovery/chat-commands.tssrc/state/openclaw-state-lease-heartbeat.worker.tssrc/skills/lifecycle/source-install.tssrc/plugin-sdk/facade-resolution-shared.tssrc/plugin-sdk/extension-shared.tssrc/skills/runtime/refresh-watch-targets.tssrc/plugin-sdk/tool-plugin.tssrc/plugin-sdk/channel-route.tssrc/plugin-sdk/plugin-entry.tssrc/skills/workshop/reconcile-transition.tssrc/state/openclaw-state-lease-worker-storage.tssrc/plugin-sdk/channel-config-ui-hints.tssrc/skills/workshop/service-query.tssrc/skills/library/import.tssrc/state/openclaw-state-lease-worker.tssrc/state/openclaw-state-db-task-delivery-recovery.tssrc/skills/workshop/store-sqlite-event.tssrc/state/openclaw-agent-db-resources.tssrc/plugin-sdk/realtime-voice.tssrc/state/openclaw-state-read.validation.tssrc/skills/runtime/refresh-ancestor-watch.tssrc/skills/runtime/session-snapshot.tssrc/skills/runtime/refresh-watch-registry.tssrc/plugin-sdk/webhook-memory-guards.tssrc/state/openclaw-state-lease-storage.tssrc/skills/runtime/env-overrides.tssrc/skills/runtime/tool-dispatch.tssrc/state/openclaw-schema-retirements.jsonsrc/state/agent-deletion-journal.read.tssrc/skills/lifecycle/upload-store.sqlite.tssrc/plugin-sdk/memory-host-event-export.tssrc/plugin-sdk/facade-activation-check.runtime.tssrc/state/openclaw-state-ownership.tssrc/plugin-sdk/access-groups.tssrc/plugin-sdk/provider-stream.tssrc/skills/discovery/command-specs.tssrc/skills/discovery/chat-command-invocation.tssrc/plugin-sdk/session-catalog-paging.tssrc/state/user-profile-writes.tssrc/skills/workshop/store-record.tssrc/state/claw-package-lifecycle-lease.tsacquired === falsepath; successful transaction completion already establishes acquisition. TTL, heartbeat and cleanup behavior remain identical.src/plugin-sdk/ssrf-policy.tssrc/state/user-profile-writes.worker.tssrc/plugin-sdk/facade-runtime.tssrc/state/agent-deletion-discovery.tssrc/skills/workshop/proposal-draft.tssrc/skills/workshop/proposal-bundle.tssrc/skills/loading/skill-root-loader.tssrc/skills/loading/config.tssrc/state/user-preferences.store.tssrc/state/openclaw-database-preflight-agent-scheduler.tssrc/state/user-preferences.tssrc/state/openclaw-state-db-open.tssrc/plugin-sdk/approval-client-helpers.tssrc/plugin-sdk/channel-lifecycle.core.tssrc/skills/loading/workspace-skill-prompt.tssrc/state/openclaw-state-db-schema-v12-foldin.tssrc/state/agent-deletion-cleanup.tssrc/skills/workshop/types.tssrc/skills/workshop/policy.tssrc/plugin-sdk/approval-auth-helpers.ts