Repository navigation
refactor: fold duplicated helpers onto canonical owners - #159409
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, 10:46 AM ET / 14:46 UTC (Revision 9). ClawSweeper reviewWhat this changesThe branch consolidates duplicated types and runtime helpers across provider transports, plugins, channels, agent and Gateway lifecycles, Workboard, and the Control UI without intending to change user-visible behavior. Warning SQLite table change This PR modifies persisted SQLite tables in Merge readiness⛔ Blocked before merge - 6 items remain This remains a substantive change absent from current main. I found no definite introduced defect, but final-head upgrade compatibility is not yet established. Priority: P2 Review scores
Verification
How this fits togetherPlugin settings, provider responses, and agent events pass through shared contracts and runtime helpers. Those helpers feed Gateway and channel delivery, stored activity, and the Control UI. flowchart LR
A[Plugin settings] --> B[Shared contracts]
C[Provider responses] --> D[Runtime helpers]
B --> D
D --> E[Gateway and channels]
E --> F[Stored activity]
F --> G[Control UI]
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: Keep the canonical helper ownership once final-head checks demonstrate compatible emitted plugin declarations and a successful upgrade and restart with existing state. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR proposes a behavior-preserving refactor rather than reporting a current-main bug. Is this the best way to solve the issue? Unclear: folding duplicates onto existing owners fits the repository design, but final-head upgrade checks must establish the claimed compatibility. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6786cc7c7e30. 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 (8 earlier review cycles)
|
b1fa680 to
33804be
Compare
1738f8d to
12340bc
Compare
Reuse existing transport, message, usage, deferred, schema, and store owners while preserving public surfaces and ordering. Workboard Doctor now skips null legacy attachments with the existing warning path instead of interrupting valid sibling migration. Independent review completed; both reported findings were disproved by the existing string and rendering owners. Remote validation follows on the rebased candidate.
Reuse the existing deferred constructor for desktop audio and invoke the queue owner directly without a forwarding method. Keep the null-attachment repair and regression with the already-open Workboard maintainer PR #158847 instead of duplicating it.
Keep Workboard method names correlated with their argument tuples through the existing operation contract. Remove redundant host-owned header selectors and an unnecessary narrowed-object assertion. Shrink only the assertion baseline entries removed by the refactor.
Remove redundant module and code narration while retaining contract and lifecycle guidance. Keep the single tool-result details declaration from main after the overlapping type fold.
12340bc to
8249d75
Compare
Clone census: canonical helper foldsBase commit: Blacksmith Testbox; jscpd 5.3.0 through Scope:
The table above preserves the raw jscpd summary. The rankings exclude residual test-support matches whose nonstandard names evade the scanner globs. No test cluster is selected for cleanup. Rankings group identical reported fragments and count redundant lines as fragment lines times (distinct locations minus one). Overlapping windows are not merged. These cluster scores are for prioritization and are separate from jscpd's aggregate metrics. Production reduction is measured separately with Git. Before: largest production clusters2 residual test-support matches excluded from ranking.
After: largest production clusters2 residual test-support matches excluded from ranking.
Owner decisionsThe PR removes 1,020 net lines from production files (892 added, 1,912 removed). Literal clone reduction captures part of that change; type reuse, forwarding-layer removal, deferred construction, and redundant comment cleanup account for the rest.
Run identityProvider: Prepared Testbox run. The wrapper verified the candidate commit and tree above before executing the checks. Both census trees used jscpd 5.3.0 with the same options; the base was materialized with |
) * refactor: fold duplicated helpers onto canonical owners Reuse existing transport, message, usage, deferred, schema, and store owners while preserving public surfaces and ordering. Workboard Doctor now skips null legacy attachments with the existing warning path instead of interrupting valid sibling migration. Independent review completed; both reported findings were disproved by the existing string and rendering owners. Remote validation follows on the rebased candidate. * refactor: finish deferred cleanup and defer owned Workboard fix Reuse the existing deferred constructor for desktop audio and invoke the queue owner directly without a forwarding method. Keep the null-attachment repair and regression with the already-open Workboard maintainer PR openclaw#158847 instead of duplicating it. * fix: preserve typed operation bindings through canonical helper folds Keep Workboard method names correlated with their argument tuples through the existing operation contract. Remove redundant host-owned header selectors and an unnecessary narrowed-object assertion. Shrink only the assertion baseline entries removed by the refactor. * refactor: reuse deferred owner for response and route lifecycles * refactor: repair type ownership and finish canonical helper folds * refactor: preserve lint contracts in helper consolidation * refactor: reuse existing browser and plugin command contracts * refactor: share deferred lifecycle construction * fix: include shared node parser in wrapper extraction * refactor: finish session and plugin cleanup Remove redundant module and code narration while retaining contract and lifecycle guidance. Keep the single tool-result details declaration from main after the overlapping type fold.
What Problem This Solves
Runtime adapters and public type declarations repeat logic already owned elsewhere, making equivalent paths harder to keep consistent.
User Impact
No intended user-visible change. The candidate removes 1,020 net production lines while preserving public Plugin SDK names, package export maps, configuration, CLI behavior, Gateway protocol, persisted data, dynamic entry points, and callback timing. No migration or operator action is required.
Why This Change Was Made
This combines bounded folds onto existing owners:
runtimeContext.Fixes found along the way
The census reproduced the legacy Workboard
attachment: nullDoctor crash. Its fix and regression landed in #158847 and are retained unchanged from main. CI also caught the shared node parser missing from the trusted PR wrapper extraction inventory; the inventory now includes that runtime dependency, and the existing extracted-wrapper tests cover the correction.Evidence
READY-TO-LAND, intentionally unmerged with auto-merge off. Candidate
8249d759183cab1db46da03e2979b003e985f34f, tree9c658c0e50eca15c00bd8e31f3d4e88f43fb113e, based onc991b6bf8f1ba5ab76b8bc15bdbda6e17e520cf9.Exact-head CI passed, including the CI gate, dependency review, and security review. Independent reviews cover the folds, type repairs, wrapper inventory correction, and final narration cleanup; no accepted actionable findings remain.
Final remote proof used Blacksmith Testbox (
blacksmith-testbox), leasetbx_01m3hmfk63w0qkxjz47pfmhq3c, prepared run. The wrapper verified the source tree before execution. The combined command completed with zero failures; the lease is stopped. External lease cleanup can mark the prepared Actions run cancelled; the wrapper command result is the proof outcome.node scripts/check-changed.mjs --base <pinned-base> --head HEADpnpm check:madge-import-cyclespnpm buildpnpm plugin-sdk:check-exportsandpnpm plugin-sdk:api:diffpnpm protocol:checkpnpm test test/scripts/eager-import-closure.test.ts --maxWorkers=1node scripts/run-vitest.mjscross-shard core selectionpnpm test:extensions:batch browser,discord,tts-local-cli,workboardpnpm test:docker:published-upgrade-survivor[email protected]published driver × candidate tarball,legacy-operator-state,auto-authrestartnpx --no-install jscpdmatched before/after scanThe selected Vitest runs total 11,856 passing executions across 755 files, including the existing wrapper regression suite. This PR does not change test files, assertions, retry policies, or skip rules.
The published-driver receipt reports successful update and automatic restart by the baseline updater. State survival, Gateway probes/status, agent/plugin operation, no-op update behavior, and backup/rollback with raw transcript restoration passed. Its initial post-core exit snapshot is unavailable, so that intermediate outcome remains unknown; final acceptance and rollback evidence are recorded separately.
The ordinary Testbox build emitted a startup-JavaScript advisory (371,432 B against 371,332 B). The controlled exact-head CI performance comparison passed both budgets: startup 371,208 B / 371,332 B and largest ordinary JS 214.8 KiB / 215.0 KiB. No budget or baseline was raised. Earlier inherited type/line-cap failures are absent from the final gates.
SDK declaration text changes reflect canonical type reuse, preserving modifiers and optionality. Public entrypoints, package export maps, configuration, CLI/protocol surface, and Workboard table/SQL/migration definitions remain unchanged by this PR.
Clone census
Full before/after census, ranked production clusters, and owner decisions.
jscpd 5.3.0 ran through
npx --no-install, minimum 60 tokens / 5 lines, oversrc,extensions,packages, andui/src. Both trees use the same exclusion filters. Two residual test-support matches are excluded from the production rankings; aggregate values above preserve the raw scanner summary. The report was posted directly to the PR after the artifact broker failed to return an upload receipt.