Repository navigation
refactor(core): deslop core runtime states - #165288
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 October 5, 2026, 2:15 AM ET / 06:15 UTC (Revision 6). ClawSweeper reviewWhat this changesThis PR simplifies agent, Gateway, infrastructure, and plugin runtime states, preserves falsy CLI failures after cleanup, and removes retired JSON dedupe import APIs. Merge readiness⛔ Blocked before merge - 1 item remains Keep open: the CLI correctness fix remains absent from main, and no blocking introduced defect was found. The documented retirement policy resolves the earlier migration concern; enforced CI still blocks landing. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s runtime turns validated requests and prepared plugin/model facts into agent execution, session updates, and replies. These changes simplify internal state handling and completion without adding configuration. flowchart TD
A[Validated requests] --> B[Prepared runtime facts]
B --> C[Agent and Gateway execution]
C --> D[Result or failure]
D --> E[Cleanup and settlement]
E --> F[Replies and session updates]
B --> G[Metadata publication]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep decisions with their validated runtime owners and preserve supported SQLite behavior while retiring the approved pre-July imports. Do we have a high-confidence way to reproduce the issue? Yes, from source: a falsy rejection entering main’s CLI settlement can escape its truthiness-based failure check. The supplied regression evidence covers all four values; this review did not execute them. Is this the best way to solve the issue? Yes. Explicit settlement outcomes repair the failure distinction directly, and the cleanup consumes existing validated owners rather than adding competing behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c949e281be43. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
d683dd7 to
8423727
Compare
7a1bd8e to
84b7e1c
Compare
|
Exact-head landing evidence for Hosted CI cleared the cleanup-related failures from earlier runs, including the canonical Gateway descriptor fixtures, model-publication lifetime, and prepared model reads. Passing focused proof also includes the falsy CLI settlement regression and SDK surface ratchet. The full model/voicewake file passes all six tests; the final infrastructure conflict proof passes 53 tests. Independent reviews of both CI corrections found no actionable P0–P2 findings. Production reduction is 1,006 net lines (+751/−1,757), excluding tests, fixtures, generated files, docs, and ratchets. Two E2E jobs still fail on this head:
The final runtime check reports zero value cycles. The final local Madge check reports two components covering 258 unchanged base modules. An earlier 48-module SQLite component was independently observed in main architecture CI; that evidence is not relabeled as proof of the expanded final components. No cycle module differs from the latest base Squash auto-merge is pinned to the head above. No admin merge has been submitted because the required hosted baseline qualification for the remaining E2E failures is absent. All lane cloud leases are released; later capacity failures allocated no lease. |
A/B attribution completedAll 18 requested invocations completed on one macOS arm64 host using Node 26.5.0, isolated detached checkouts, and frozen dependency installs. Each revision received its own Each command ran three times per revision, with revision order rotated across rounds:
The scheduler's other attempts timed out before Gateway readiness and never reached the lock assertion; they are not counted as reproductions or passes. Every attempt that reached the scheduler assertion failed with the same Telegram cause: bot construction starts native command-menu synchronization. The fixture's mocked bot supplies Scheduler cause: disabling automatic scheduling does not prevent an awaited Both hosted failures therefore reproduce without this PR at comparable rates. This evidence qualifies the coordinator-authorized inherited-failure merge route; no corrective source or test change is needed for these two failures. Full pinned revisions:
The reported hosted failures remain visible in run 37268623844. They are classified as inherited, not relabeled green. |
Consume typed and validated owner facts directly, strengthen internal state unions, and remove redundant normalization and forwarding paths. Preserve external-input validation and live authority at their existing boundaries. Retire the pre-July JSON dedupe migration APIs and run chat metadata tests through the normal publication lifecycle instead of an alternate refresh path. Fix CLI settlement swallowing falsy thrown values after cleanup. Preserve error formatting and primary-failure precedence.
Join accepted reset-handler work before fixture teardown and control the unrelated RPC response clock. Preserve authority and durable-state assertions. Remove redundant fixture setup and unused overrides, and shrink assertion budgets to the measured production counts.
Retain native listener-array copying, preserve command-error precedence, and resolve scoped lint findings without changing assertions or boundary validation.
84b7e1c to
7eac9ae
Compare
|
Conflict-only integration is pushed as
Both original failures are inherited. The new base also incorporates their upstream fixture repairs (#165430, #165457, and the Telegram consolidation in #165505), which remain untouched by this PR. Integration review caught and corrected one duplicate abort-helper import and combined SDK-budget counts. Correction review is scoped-clean at P2. The final tree passed 31 CLI settlement tests (including all eight falsy-error regressions), four update-command tests, ten SDK surface tests with one platform skip, 1,140 plugin contract tests across 48 files, core types, and focused lint. Runtime cycles are zero. Madge still reports one 17-module component; every component file is byte-identical to the new base Final production reduction is 936 lines (+684/-1,620); overlapping cleanup already landed upstream was dropped, with no new deslop work. The original A/B run is historical evidence for its exact tested head, not a claim of new-head hosted CI. Proceeding with the maintainer-authorized inherited-failure merge exception pinned to the exact API head. |
Restore the successful completion fixture after test consolidation reintroduced a legacy raw status. The real agent.wait owner already normalizes completed to ok. Type the table so invalid mock states cannot recur; keep assertions and the normalization owner regression unchanged. Follow-up to #165288.
|
Post-merge CI follow-through: run 37304487248 completed with four failed non-aggregate jobs. The one integration failure attributable to this lane is now corrected directly on main in Upstream test consolidation (#165438) reintroduced the raw Remaining failures for the main-CI coordinator:
The last two are source-attributed to pre-existing main commits; no separate matching hosted-baseline reproduction was found, and none is claimed. No extension repair, unrelated main fix, additional PR, or CI rerun was introduced in this lane. The failed aggregate gate remains historical evidence, not a green CI claim. |
Keep the single-message sanitizer private and exercise its production array API from the existing tests. Remove the unused BranchSummaryResult re-export from the internal runtime facade; retain its public SDK export. The last production consumers were removed in bd64d93 (#165288). Both named Knip findings reproduce three times before this change and are absent in three scans afterward. The 55 sanitizer/persistence tests pass three times, and display-projection siblings pass. Production typechecks and touched-file lint pass; neither cycle check adds a component. Unrelated Knip findings in CLI root help and media-understanding defaults, and the inherited 17-file migration component, remain outside this fix.
* refactor(core): deslop core runtime states Consume typed and validated owner facts directly, strengthen internal state unions, and remove redundant normalization and forwarding paths. Preserve external-input validation and live authority at their existing boundaries. Retire the pre-July JSON dedupe migration APIs and run chat metadata tests through the normal publication lifecycle instead of an alternate refresh path. Fix CLI settlement swallowing falsy thrown values after cleanup. Preserve error formatting and primary-failure precedence. * test(core): stabilize cleanup fixtures and tighten ratchets Join accepted reset-handler work before fixture teardown and control the unrelated RPC response clock. Preserve authority and durable-state assertions. Remove redundant fixture setup and unused overrides, and shrink assertion budgets to the measured production counts. * fix(core): keep native listener descriptors type-safe Retain native listener-array copying, preserve command-error precedence, and resolve scoped lint findings without changing assertions or boundary validation. * fix(core): preserve runtime and fixture contracts during cleanup * test(gateway): preserve prepared model read ownership * fix(core): reconcile imports and SDK budgets after rebase
Restore the successful completion fixture after test consolidation reintroduced a legacy raw status. The real agent.wait owner already normalizes completed to ok. Type the table so invalid mock states cannot recur; keep assertions and the normalization owner regression unchanged. Follow-up to openclaw#165288.
Keep the single-message sanitizer private and exercise its production array API from the existing tests. Remove the unused BranchSummaryResult re-export from the internal runtime facade; retain its public SDK export. The last production consumers were removed in ed04ab7 (openclaw#165288). Both named Knip findings reproduce three times before this change and are absent in three scans afterward. The 55 sanitizer/persistence tests pass three times, and display-projection siblings pass. Production typechecks and touched-file lint pass; neither cycle check adds a component. Unrelated Knip findings in CLI root help and media-understanding defaults, and the inherited 17-file migration component, remain outside this fix.
…a dated compat record (#167036) Related: #166404 ## What Problem This Solves Fixes: shipped Plugin SDK subpaths and exports could be removed without the surface check noticing, which broke published third-party plugins such as `@tencent-weixin/openclaw-weixin` on 2026.10.1-beta.1. ## User Impact User impact: the stable Plugin SDK surface can no longer silently disappear. Removing a subpath or named export that shipped in the latest stable release now fails `pnpm plugin-sdk:surface:check` unless a compatibility record covers it with a final compatibility day that has passed. No runtime behavior changes; nothing is restored here (restoring the removed subpaths for #166404 is a separate product decision). ## Why This Change Was Made `plugin-sdk:surface:check` only enforced maximum export-count budgets, and the API baseline diff is report-only. The commits that retired `config-runtime`, `infra-runtime`, `channel-message`, `command-auth` and four other subpaths (912+ named exports that shipped in v2026.9.8) lowered those budgets in the same change, so the check passed. A ceiling cannot detect a removal. This adds a committed inventory of the latest stable release's typed public surface (`scripts/lib/plugin-sdk-shipped-surface.json`, pinned to the current npm `latest` v2026.9.9: 158 typed subpaths, 4,591 named exports, identical to v2026.9.8). It is generated from the release tag's package exports and declarations by `pnpm plugin-sdk:shipped-surface:gen -- --release <tag>`, reusing the existing tagged-revision renderer from `plugin-sdk:api:diff`, and is regenerated during stable closeout (documented in RELEASING.md). The surface check compares the current tree against it: - A missing shipped subpath, or a missing name in a surviving subpath, needs a compat record whose `surfaces` names `openclaw/plugin-sdk/<subpath>` (whole subpath) or the qualified `openclaw/plugin-sdk/<subpath>.<Name>`. Bare names do not count. - The record must be `deprecated`, `removal-pending`, or `removed` with a `removeAfter` strictly before the current UTC date (the date is the final compatibility day). A `removalGate` alone or a future date does not authorize; budgets play no role. - Packaged private runtime facades without a `types` condition are excluded: they are not a declared contract. To make current `main` pass without restoring anything, the already-landed removals are recorded honestly: - Dated tombstones for the five subpaths retired under the Sept 30 owner decision (`removeAfter` 2026-09-30) and new tombstones for `command-auth`, `discord`, `telegram-account`, whose records were deleted in 0d530ea (`removeAfter` 2026-10-01). - 14 later named-export removals from surviving subpaths (2fec39f #165431, bd64d93 #165288, f2de06b #163587) recorded retroactively per owner decision; each release note states the export was removed without a compatibility window. - The Skill Workshop proposal-hook types removed by cfee851 (#161057) already had a tombstone; its surfaces are now qualified and dated. Release-note context: Plugin SDK authors get a migration-guide row for each of the 14 retroactively recorded exports in `docs/plugins/sdk-migration/removed-surfaces.md`. ## Evidence - Inventory generation from tag `v2026.9.8` (fc23bc8): 158 typed subpaths, 4,591 names; `config-runtime` 115, `infra-runtime` 583, `channel-message` 136, `command-auth` 78 names. - Historical transition, guard + inventory overlaid on throwaway worktrees with `OPENCLAW_PLUGIN_SDK_SURFACE_NOW=2026-10-01`: `e649be31^` shows only pre-existing gaps; `e649be31` additionally fails on exactly `channel-lifecycle` (23), `channel-message` (136), `channel-reply-pipeline` (12), `config-runtime` (115), `infra-runtime` (583) despite its lowered budgets. - Final tree: `pnpm plugin-sdk:surface:check` → `shipped Plugin SDK v2026.9.8: no unauthorized removals`. Reverting the tombstone dates re-reports all eight subpaths; pinning `OPENCLAW_PLUGIN_SDK_SURFACE_NOW=2026-10-07` re-reports the eight Skill Workshop types (strict date semantics). - The guard already caught a live regression during this PR: cfee851 landed on main mid-review and the rebased check failed on its eight unqualified types until the record was fixed. - Regenerated against v2026.9.9 (bcfc888) after it went stable mid-review: zero subpaths or names added or dropped versus v2026.9.8; check still clean. - PR wrapper inventory lists the new compat-record module (first CI run failed `eager-import-closure` / `pr-worktree-provision` on its absence). - Focused tests (`--maxWorkers=1`): `test/scripts/plugin-sdk-shipped-surface.test.ts` 20 passed (~2.2 s wall), `src/plugins/compat/registry.test.ts` 12 passed, `test/scripts/plugin-sdk-surface-report.test.ts` 11 passed / 1 Linux-only skip; all three ~11.7 s wall. Pure evaluator tests, no TS project boots, no timers. - `node scripts/check-changed.mjs`: every lane passed except two inherited from `main`: the dead-export scan (`observePlacementAuthority`, already fixed on main by 0178423) and core lint on three over-length files this PR does not touch. Direct oxlint on all changed `.ts`/`.mts` files is clean. - Autoreview (Codex, P2 threshold): scoped-clean.
…a dated compat record (openclaw#167036) Related: openclaw#166404 ## What Problem This Solves Fixes: shipped Plugin SDK subpaths and exports could be removed without the surface check noticing, which broke published third-party plugins such as `@tencent-weixin/openclaw-weixin` on 2026.10.1-beta.1. ## User Impact User impact: the stable Plugin SDK surface can no longer silently disappear. Removing a subpath or named export that shipped in the latest stable release now fails `pnpm plugin-sdk:surface:check` unless a compatibility record covers it with a final compatibility day that has passed. No runtime behavior changes; nothing is restored here (restoring the removed subpaths for openclaw#166404 is a separate product decision). ## Why This Change Was Made `plugin-sdk:surface:check` only enforced maximum export-count budgets, and the API baseline diff is report-only. The commits that retired `config-runtime`, `infra-runtime`, `channel-message`, `command-auth` and four other subpaths (912+ named exports that shipped in v2026.9.8) lowered those budgets in the same change, so the check passed. A ceiling cannot detect a removal. This adds a committed inventory of the latest stable release's typed public surface (`scripts/lib/plugin-sdk-shipped-surface.json`, pinned to the current npm `latest` v2026.9.9: 158 typed subpaths, 4,591 named exports, identical to v2026.9.8). It is generated from the release tag's package exports and declarations by `pnpm plugin-sdk:shipped-surface:gen -- --release <tag>`, reusing the existing tagged-revision renderer from `plugin-sdk:api:diff`, and is regenerated during stable closeout (documented in RELEASING.md). The surface check compares the current tree against it: - A missing shipped subpath, or a missing name in a surviving subpath, needs a compat record whose `surfaces` names `openclaw/plugin-sdk/<subpath>` (whole subpath) or the qualified `openclaw/plugin-sdk/<subpath>.<Name>`. Bare names do not count. - The record must be `deprecated`, `removal-pending`, or `removed` with a `removeAfter` strictly before the current UTC date (the date is the final compatibility day). A `removalGate` alone or a future date does not authorize; budgets play no role. - Packaged private runtime facades without a `types` condition are excluded: they are not a declared contract. To make current `main` pass without restoring anything, the already-landed removals are recorded honestly: - Dated tombstones for the five subpaths retired under the Sept 30 owner decision (`removeAfter` 2026-09-30) and new tombstones for `command-auth`, `discord`, `telegram-account`, whose records were deleted in bc7ecd0 (`removeAfter` 2026-10-01). - 14 later named-export removals from surviving subpaths (936fe5d openclaw#165431, ed04ab7 openclaw#165288, 0e5b206 openclaw#163587) recorded retroactively per owner decision; each release note states the export was removed without a compatibility window. - The Skill Workshop proposal-hook types removed by 1991553 (openclaw#161057) already had a tombstone; its surfaces are now qualified and dated. Release-note context: Plugin SDK authors get a migration-guide row for each of the 14 retroactively recorded exports in `docs/plugins/sdk-migration/removed-surfaces.md`. ## Evidence - Inventory generation from tag `v2026.9.8` (fc23bc8): 158 typed subpaths, 4,591 names; `config-runtime` 115, `infra-runtime` 583, `channel-message` 136, `command-auth` 78 names. - Historical transition, guard + inventory overlaid on throwaway worktrees with `OPENCLAW_PLUGIN_SDK_SURFACE_NOW=2026-10-01`: `3be7252f^` shows only pre-existing gaps; `3be7252f` additionally fails on exactly `channel-lifecycle` (23), `channel-message` (136), `channel-reply-pipeline` (12), `config-runtime` (115), `infra-runtime` (583) despite its lowered budgets. - Final tree: `pnpm plugin-sdk:surface:check` → `shipped Plugin SDK v2026.9.8: no unauthorized removals`. Reverting the tombstone dates re-reports all eight subpaths; pinning `OPENCLAW_PLUGIN_SDK_SURFACE_NOW=2026-10-07` re-reports the eight Skill Workshop types (strict date semantics). - The guard already caught a live regression during this PR: 1991553 landed on main mid-review and the rebased check failed on its eight unqualified types until the record was fixed. - Regenerated against v2026.9.9 (bcfc888) after it went stable mid-review: zero subpaths or names added or dropped versus v2026.9.8; check still clean. - PR wrapper inventory lists the new compat-record module (first CI run failed `eager-import-closure` / `pr-worktree-provision` on its absence). - Focused tests (`--maxWorkers=1`): `test/scripts/plugin-sdk-shipped-surface.test.ts` 20 passed (~2.2 s wall), `src/plugins/compat/registry.test.ts` 12 passed, `test/scripts/plugin-sdk-surface-report.test.ts` 11 passed / 1 Linux-only skip; all three ~11.7 s wall. Pure evaluator tests, no TS project boots, no timers. - `node scripts/check-changed.mjs`: every lane passed except two inherited from `main`: the dead-export scan (`observePlacementAuthority`, already fixed on main by 6dfbb46) and core lint on three over-length files this PR does not touch. Direct oxlint on all changed `.ts`/`.mts` files is clean. - Autoreview (Codex, P2 threshold): scoped-clean.
What Problem This Solves
Core runtime paths repeatedly revalidate facts already established by their parser, schema, registrar, or lifecycle owner. This batch removes those redundant paths and makes internal settlement and publication states explicit.
User Impact
CLI runs now reject
undefined,null,0, andfalsefailures after cleanup instead of silently returning an undefined success or replacing the primary failure with a cleanup error. Current config keys, wire formats, persisted SQLite state, model-facing descriptions, and visible output otherwise remain unchanged.Under the approved July 2026 migration cutoff, this retires the June JSON dedupe import functions
migratePersistentDedupeLegacyJsonFileandlistPersistentDedupeLegacyJsonFileEntries, plus their two migration-only types. The JSON writer moved to SQLite on June 7 (bab18d567b0); current SQLite replay protection, claims, namespaces, and the import-entry helper remain.Why This Change Was Made
936 net production lines removed (+684/−1,620), excluding tests, fixtures, generated files, docs, and ratchets. No code was moved out of the monorepo.
Fixes found along the way
CLI settlement used error truthiness to distinguish failure from success. Its explicit outcome preserves falsy rejections, cleanup completion, and primary-error precedence. Eight regression cases cover successful and failed cleanup.
The reset-concurrency fixture raced a non-cancelling RPC deadline against accepted handler work. It now controls that clock and joins the existing async-work owner before retiring resources, preserving authority and durable-state assertions.
CI also exposed contracts that the cleanup must retain: missing-origin auth-choice precedence, bounded usage refresh, pin-presence short circuits, lifecycle-owned publication subscriptions, canonical descriptors in Gateway fixtures, and prepared model reads without hidden fixture discovery. Those corrections preserve the existing assertions.
Evidence
Current head:
7eac9aec48ea0d126cc8df9018c811d6cf31de13.Conflict-only integration onto
5b618f2d8cb89a491d3131ede74e5f49a7fdc04apreserves newer main implementations and deletions. Overlapping cleanup already on main was dropped; no new deslop work was added. The resulting production reduction is 936 lines. Integration review identified a duplicate abort-helper import and combined SDK-budget mismatch; both are corrected, and the correction review is scoped-clean at P2. The canonical SDK report confirms 3,651 public exports / 2,114 callable exports, an exact decrease of four / two from the new base.models.listwarmup (230.76 seconds including local preparation).4e1f2845. The corrected surface-budget suite passed locally (10 passed, 1 platform-specific skip).After integration, the complete CLI settlement suite passed all 31 tests, including the eight falsy-rejection regressions (150.15s file wall time). Update-command tests passed 4/4; SDK surface tests passed 10 with one existing Linux-only skip. The combined three-file invocation took 552.44s including cold subprocess compilation. No tests, assertions, timeouts, or retry settings were weakened.
A/B attribution of the two hosted failures
Hosted run 37268623844 tested the previous head
84b7e1ccd901. Each failing file was then run three times on detached merge-base, frozen current main, and PR-head checkouts on the same Mac/Node 26.5.0, using identical commands and per-revision clean CI-style QA runtime builds. All 18 invocations completed. Full A/B evidence.c908806c87dd9151e48c4f9c84b7e1ccd901Every scheduler attempt reaching the assertion failed identically: base 2/2, main 1/1, head 2/2. Readiness failures are inconclusive, not passes. Both original failures are inherited: Telegram's mock omitted
deleteMyCommands, and the scheduler fixture opened a second service while the first retained exclusive database custody. The PR does not alter those owners.Newer main already repaired these fixtures: #165430 supplies the Telegram stub; #165505 consolidates the old Telegram file; #165457 stops the Gateway before transferring scheduler database custody. This conflict-only rebase preserves all three upstream changes. The old A/B results establish historical attribution; they are not claimed as new-head CI or current failures.
Current-tree checks: core production typecheck and focused core/script lint passed; plugin contracts passed 48 files / 1,140 tests (443.82s Vitest, 501s wrapper). Runtime value cycles: zero. Madge reports one 17-module component, with every component module byte-identical to base
5b618f2d8cb; it is retained as an inherited failure, not relabeled green. The original two hosted failures were independently attributed by the requested A/B runs, qualifying the coordinator-authorized exact-head admin merge route. The 18-run comparison is not claimed as CI for the rebased head.Protected heartbeat/Automations and PR-tooling paths are untouched. No live Gateway, deployment, or release was changed.
Post-merge follow-through: new-head CI run 37304487248 completed red. The one lane-attributable consolidated wait-fixture failure was corrected directly on main in
223f6e441ecb9bb80bbd80d885997a8ecc7270db, with five focused cases, Gateway test types, lint, and independent review passing. Production LOC is unchanged. Final CI evidence records the remaining Madge, Codex, and Copilot failures and the source-attribution limits.