Repository navigation
refactor(runtime): deslop single-use abstractions - #164806
Conversation
Remove the internal ACP-only binding consumer registry and inline private one-use model, channel, installer, parser, memory, and UI adapters. Keep public SDK contracts, lazy loading, runtime authority, user-visible behavior, and existing behavior coverage intact.
|
🦞👀 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 4, 2026, 3:02 AM ET / 07:02 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR removes private single-use wrappers, registries, factories, and option bags across channel routing, model authentication, CLI setup, memory, worker operations, and Control UI loading. Merge readiness⛔ Blocked before merge - 1 item remains This remains useful maintainer-owned cleanup that current main has not incorporated. The pinned diff preserves the reviewed behavior and contracts; no actionable correctness or security finding remains, and the earlier confidence-only blocker is resolved. Priority: P3 Review scores
Verification
How this fits togetherThese runtime owners turn configuration, channel events, model catalogs, and memory queries into agent routing, outbound messages, and UI results. The refactor moves existing decisions into their callers while retaining lifecycle and authorization boundaries. flowchart LR
A[Configuration and requests] --> B[Existing runtime owners]
C[Channel events] --> B
D[Model and memory facts] --> B
B --> E[Lifecycle and scope checks]
E --> F[Agent routing and delivery]
E --> G[CLI and UI results]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -1081, Tests -75, Other -4. Total -1160 across 68 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep one existing owner for each flow, with private adapters removed and public contracts, lazy loading, lifecycle checks, and observable results preserved. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR proposes internal restructuring, and no concrete behavior defect was found in the introduced changes. Is this the best way to solve the issue? Yes: removing private single-consumer layers while retaining the existing owners is a maintainable simplification, supported by source comparison and exact-head validation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d65e8ec89bb3. 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 (1 earlier review cycle)
|
|
Merged via squash.
|
5f65675 (#164806) inlined createTelegramPluginBase into channel.ts but left the guardrail inventory pointing at deleted shared.ts. Guard both existing own-SDK patterns at the composition's new owner and report missing guardrail sources explicitly instead of failing with ENOENT. Validation: baseline 1 failed/19 passed; candidate 20/20. A temporary forbidden internal-SDK reference in channel.ts triggered the intended guard. Linux Testbox passed all four channel-contract configs (49 files, 347 tests), check-changed including types and lint, explicit boundary lint, and independent P2 review. No assertions or cases were removed.
Guard Telegram's setup-plugin base alongside its inlined channel composition with the same own-SDK patterns. The shared.ts deletion in 5f65675 (#164806) was already retargeted to channel.ts by 349b337. Capture the SQLite prepare callable through its scoped spy and restore it in finally, removing the unbound-method suppression added by 877f0c1 (#164760). Restore the typed optional-entry loader contract from 26bcc94, reversed by dc5b3bc (#164617). Infer each result from its canonical loader input and remove the private return-only generic exception. Shrink both corresponding suppression inventory entries. Leave provider-auth-persistence unchanged at count 3, already allowlisted upstream by 4d47471. No exception allowance grows in this commit; the strict suppression inventory passes with that inherited provider-auth entry. Validation: 131 tests across the channel guardrail, suppression inventory, ratchet parser, CLI history/encoding, and SDK entry/lifecycle suites passed. Both cycle checks report zero cycles. Core, Gateway-test, SDK-test and root script typechecks, focused type-aware lint, formatting and diff checks pass. The initial full channel scan timed out during overlapping typechecks; serial qualification passed all 20 cases, with that scan taking 59 seconds under its unchanged 120-second timeout.
* refactor(runtime): deslop single-use abstractions Remove the internal ACP-only binding consumer registry and inline private one-use model, channel, installer, parser, memory, and UI adapters. Keep public SDK contracts, lazy loading, runtime authority, user-visible behavior, and existing behavior coverage intact. * fix(runtime): retain auth status runtime store typing * test(ui): exercise provider add through rendered controls * refactor(telegram): inline single-use audit resolvers * test(runtime): preserve mock contracts and shrink baselines * refactor(runtime): remove leftover abstraction exports * refactor(runtime): simplify inline result projections
dd60582 (openclaw#164806) inlined createTelegramPluginBase into channel.ts but left the guardrail inventory pointing at deleted shared.ts. Guard both existing own-SDK patterns at the composition's new owner and report missing guardrail sources explicitly instead of failing with ENOENT. Validation: baseline 1 failed/19 passed; candidate 20/20. A temporary forbidden internal-SDK reference in channel.ts triggered the intended guard. Linux Testbox passed all four channel-contract configs (49 files, 347 tests), check-changed including types and lint, explicit boundary lint, and independent P2 review. No assertions or cases were removed.
Guard Telegram's setup-plugin base alongside its inlined channel composition with the same own-SDK patterns. The shared.ts deletion in dd60582 (openclaw#164806) was already retargeted to channel.ts by 4cad08e. Capture the SQLite prepare callable through its scoped spy and restore it in finally, removing the unbound-method suppression added by b4091a0 (openclaw#164760). Restore the typed optional-entry loader contract from f5b3b2e, reversed by 7cdb407 (openclaw#164617). Infer each result from its canonical loader input and remove the private return-only generic exception. Shrink both corresponding suppression inventory entries. Leave provider-auth-persistence unchanged at count 3, already allowlisted upstream by 6572c15. No exception allowance grows in this commit; the strict suppression inventory passes with that inherited provider-auth entry. Validation: 131 tests across the channel guardrail, suppression inventory, ratchet parser, CLI history/encoding, and SDK entry/lifecycle suites passed. Both cycle checks report zero cycles. Core, Gateway-test, SDK-test and root script typechecks, focused type-aware lint, formatting and diff checks pass. The initial full channel scan timed out during overlapping typechecks; serial qualification passed all 20 cases, with that scan taking 59 seconds under its unchanged 120-second timeout.
What Problem This Solves
Internal flows carry registries, factories, option bags, and forwarding modules that have only one production consumer and duplicate facts their caller already owns.
User Impact
No user-visible change. Config keys, persisted data, protocol payloads, CLI output, model-facing descriptions, and UI rendering remain unchanged. Public plugin SDK seams and runtime authority, cleanup, ordering, and lazy-loading boundaries stay intact.
Why This Change Was Made
One batch removes 1,081 net production lines (1,366 added, 2,447 deleted; tests and baselines excluded):
Existing behavior tests now exercise the retained owners. Removed test cases only exercised deleted private options or the synchronous loader that production never supplies.
Evidence
d67466800fc1da6d576b52269a90e8ae8d2c9320.pnpm buildpassed in 7m31s. Focused coverage passed across 64 files / 1,205 cases; plugin contracts passed across 48 files / 1,132 cases.--maxWorkers=1(4.99s Vitest wall time). The deferred agent-switch race and warning assertions remain intact. No retries, timer increases, skipped assertions, or weakened thresholds.--maxWorkers=1; the last auth-profile adjustment passed all 53 auth-status cases again (31.91s). The embedding-policy file passed 45 cases in 9.71s; its existing error fixtures now use real retry/split behavior with immediate waits.node --import ./scripts/tsx.mjs scripts/check-madge-import-cycles.tsandnode --import ./scripts/tsx.mjs scripts/check-import-cycles.tsreport 0.node scripts/run-vitest.mjs src/plugins/contractspassed again after rebasing.35f60579010cbase /706a5de0959candidate): same-toolchain builds both make 8 startup requests and contain 1,212,210 raw / 344,258 Brotli bytes. gzip is 374,821 / 374,833 bytes, a 12-byte difference within the checker's existing 64-byte build variance. Both exceed the existing 373,454-byte advisory ceiling; no budget changed.pnpm deadcode:knippassed with no unused-file/dependency findings. Core, UI, plugin, and plugin-test types passed. The initial full changed-file sweep found an unrelated MCP cursor-test type error already fixed on main; that main fix was incorporated and its type shard passed. The sweep's own unused-export and lint findings were repaired and verified with the same check owners on the affected scope.Review Disposition
ClawSweeper completed the exact-head review with no correctness or security findings. Its confidence and data-model prompts are resolved by the maintainer source audit and recorded execution evidence:
profile: "index"andisSplittableMemoryEmbeddingBatchError. Those same choices now live inside the private retry helper.persistGeneratedEmbeddings, its arguments, generation checks, metadata, and ordering are unchanged.d67466800fcprovide the confidence for landing. The dependency and security-sensitive gates also passed. No migration is needed for unchanged stored data.