Skip to content

refactor(runtime): deslop single-use abstractions - #164806

Merged
steipete merged 7 commits into
mainfrom
deslop/l369-single-use-abstractions-20261003
Oct 4, 2026
Merged

steipete merged 7 commits into
mainfrom
deslop/l369-single-use-abstractions-20261003

Conversation

@steipete

@steipete steipete commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

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):

  • Compile the sole ACP configured-binding consumer directly; remove its global consumer registry, registration layer, matching/session-lookup wrappers, and unused lifecycle method. Keep the stateful driver registry and its post-await identity fence. The internal driver calls the session lifecycle owner directly; the public SDK adapter remains intact.
  • Put model-selection metadata and selection logic in their single callers. Move Gateway model-list and auth-status projections into their existing owners, removing large forwarding bags and duplicate result envelopes.
  • Send CLI channel messages directly through the lazily loaded adapter, removing stateless sender objects and their per-channel cache while retaining rejected-load eviction.
  • Require the asynchronous CUA SDK loader used in production; remove its synchronous test-only path and empty reset forwarding.
  • Remove private LINE defaults/overrides and timer knobs that its sole production caller never uses; retain user-configured media limits and reload ownership.
  • Inline private Discord startup/delivery, Slack setup/routing, and Telegram plugin-base/startup wrappers; keep setup-only loading separate from channel runtime.
  • Inline memory-wiki search/read projections and voice-call polling adapters, and bind memory embedding retries to their only production policy. Keep batch-error classification private and exercise its fixtures through actual retry/split behavior.
  • Collapse one-use tool-call parsing/promotion and retained-operation adapters without changing parser precedence or settlement ordering.
  • Inline npm onboarding's single-use installer callback layer, consume its prepared source facts, and remove the configure wizard's unused update mode and forwarding prompts.
  • Let the existing model-provider core loader own catalog retry state; remove its callback adapter and Usage's one-call failure DTO. Preserve request generations and connection/agent guards.

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

  • Independent Codex autoreview of the batch and each correction: scoped-clean at P1+, no actionable findings. Final source: d67466800fc1da6d576b52269a90e8ae8d2c9320.
  • AWS Crabbox (Linux / Node 24.19.0 / pnpm 12.5.1): pnpm build passed in 7m31s. Focused coverage passed across 64 files / 1,205 cases; plugin contracts passed across 48 files / 1,132 cases.
  • The removed private UI method exposed two stale tests. They now click the rendered Save button and await the real mutation owner; all 37 cases in that file passed with --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.
  • After the final export/projection corrections, all 209 focused cases across 8 files passed with --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.
  • The final Telegram follow-up passed 25 focused cases (41.22s and 13.63s for the two single-worker test files). Assertion baselines shrink to match the two removed casts.
  • The branch incorporates the concurrent Control UI cleanup without restoring its removed wrappers. The affected 37 UI cases passed again (5.91s); both node --import ./scripts/tsx.mjs scripts/check-madge-import-cycles.ts and node --import ./scripts/tsx.mjs scripts/check-import-cycles.ts report 0. node scripts/run-vitest.mjs src/plugins/contracts passed again after rebasing.
  • An earlier-head UI startup bundle comparison established the inherited advisory (35f60579010c base / 706a5de0959 candidate): 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.
  • Touched test mocks preserve real exports where appropriate. The ACP driver fixture retains its existing closed lifecycle mock with a documented isolation reason; its real control-plane initialization depends on intentionally excluded session-state exports. Obsolete exact mock signatures are removed from the baseline.
  • pnpm deadcode:knip passed 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.
  • Final source replay: focused core/plugin lint passed with zero warnings/errors; production, full-tree, and script export scans each report zero unused exports; both cycle checks report zero; all 1,132 plugin contract cases passed again (37.62s).
  • No live Gateway was changed. This is behavior-preserving internal restructuring; focused owner/entry-point tests provide the relevant boundary proof.

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:

  • The embedding caller previously supplied profile: "index" and isSplittableMemoryEmbeddingBatchError. Those same choices now live inside the private retry helper. persistGeneratedEmbeddings, its arguments, generation checks, metadata, and ordering are unchanged.
  • The wiki edits inline read/search result projections after the same owners and visibility checks. Field names and conditional field presence are preserved. No schema, persisted shape, migration, retention, or storage writer changes. All 81 selected wiki cases and 45 embedding-policy cases passed on the final corrections.
  • Independent scoped reviews, the byte-identical tested tree, and successful hosted CI on d67466800fc provide the confidence for landing. The dependency and security-sensitive gates also passed. No migration is needed for unchanged stored data.

@clawsweeper

clawsweeper Bot commented Oct 4, 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 channel: discord Channel integration: discord channel: line Channel integration: line channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: voice-call Channel integration: voice-call app: web-ui App: web-ui gateway Gateway runtime extensions: memory-core Extension: memory-core cli CLI command changes commands Command implementations agents Agent runtime and tooling extensions: memory-wiki plugin: cua-computer labels Oct 4, 2026
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: d67466800fc1da6d576b52269a90e8ae8d2c9320
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/server-methods/models-auth-status-facts.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server-methods/models-auth-status.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 4, 2026, 3:02 AM ET / 07:02 UTC (Revision 2).

ClawSweeper review

What this changes

The 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
Reviewed head: d67466800fc1da6d576b52269a90e8ae8d2c9320

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, behavior-preserving cleanup with substantial recorded validation and no supported blocking finding.
Proof confidence 🌊 off-meta tidepool Not applicable: Verified repository-admin authorship exempts this private refactor from ordinary contributor live proof. Existing owner tests and successful exact-head CI are supplemental validation; no material authority change triggers final-effect proof, and no stored-data contract changes require migration evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Verified repository-admin authorship exempts this private refactor from ordinary contributor live proof. Existing owner tests and successful exact-head CI are supplemental validation; no material authority change triggers final-effect proof, and no stored-data contract changes require migration evidence.
Evidence reviewed 13 items Pinned introduction and merge ownership: Reviewed the merge-base-to-head introduced hunks across all listed surfaces. Raw test-merge records confirm the pinned base first and exact PR head second; its result retains the ACP and embedding changes.
Still distinct from current main: Fetched main still compiles bindings through the consumer registry and factory wrapper removed by this branch, establishing that the central cleanup remains unincorporated.
ACP lifecycle and public boundary preserved: The internal driver calls the same session lifecycle owner used by the former readiness wrapper, forwarding assertActive. Account-match precedence and the driver registry's post-await identity fence remain. Searches found no public SDK export of the removed consumer registry; the existing public readiness adapter remains.
Findings None None.
Security None None.

How this fits together

These 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]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source -1081, Tests -75, Other -4. Total -1160 across 68 files.

View PR surface stats
Area Files Added Removed Net
Source 47 1352 2433 -1081
Tests 19 180 255 -75
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 2 6 -4
Total 68 1534 2694 -1160

Review metrics

None.

Stored data model

Persistent data-model change detected: unknown-data-model-change: extensions/memory-wiki/src/query-shared-memory.ts, vector/embedding metadata: extensions/memory-core/src/memory/manager-embedding-ops.ts, vector/embedding metadata: extensions/memory-core/src/memory/manager-embedding-policy.ts, vector/embedding metadata: extensions/memory-wiki/src/query-shared-memory.ts, vector/embedding metadata: extensions/memory-wiki/src/query.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best 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.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is behavior-preserving internal cleanup with no reported user-facing regression or new capability.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Verified repository-admin authorship exempts this private refactor from ordinary contributor live proof. Existing owner tests and successful exact-head CI are supplemental validation; no material authority change triggers final-effect proof, and no stored-data contract changes require migration evidence.

Evidence

What I checked:

  • Pinned introduction and merge ownership: Reviewed the merge-base-to-head introduced hunks across all listed surfaces. Raw test-merge records confirm the pinned base first and exact PR head second; its result retains the ACP and embedding changes. (7dce79ff2c4d)
  • Still distinct from current main: Fetched main still compiles bindings through the consumer registry and factory wrapper removed by this branch, establishing that the central cleanup remains unincorporated. (src/channels/plugins/configured-binding-compiler.ts:10, d65e8ec89bb3)
  • ACP lifecycle and public boundary preserved: The internal driver calls the same session lifecycle owner used by the former readiness wrapper, forwarding assertActive. Account-match precedence and the driver registry's post-await identity fence remain. Searches found no public SDK export of the removed consumer registry; the existing public readiness adapter remains. (src/channels/plugins/acp-stateful-target-driver.ts:62, d67466800fc1)
  • Authentication projection security: The inlined provider projection retains admin-scoped identity fields, external-profile distinctions, configuration locks, expiry calculation, and profile ordering. Credential mutation handlers are unchanged. (src/gateway/server-methods/models-auth-status.ts:465, d67466800fc1)
  • Memory compatibility audit: Embedding retries retain the sole caller's existing index policy and split classifier; persistence arguments and generation checks are unchanged. Wiki read/search projections preserve fields and visibility checks. No stored-data contract, schema, migration, or storage writer changes. (extensions/memory-core/src/memory/manager-embedding-policy.ts:179, d67466800fc1)
  • Control UI request ownership: Catalog retry state moves into the existing loader while preserving request identity, connection epoch, agent identity, and agent epoch checks. Provider mutations retain their existing owner and guards; changed tests invoke the rendered Save control. (ui/src/pages/model-providers/model-providers-page.ts:352, d67466800fc1)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • SunnyShu0925: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • chelsealong: 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 (1 earlier review cycle)
  • reviewed 2026-10-04T06:45:45.564Z sha d674668 :: blocked before merge. :: none

@steipete
steipete merged commit 5f65675 into main Oct 4, 2026
179 of 191 checks passed
@steipete
steipete deleted the deslop/l369-single-use-abstractions-20261003 branch October 4, 2026 07:04
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Oct 4, 2026
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.
steipete added a commit that referenced this pull request Oct 4, 2026
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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
* 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
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
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.
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: discord Channel integration: discord channel: line Channel integration: line channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: voice-call Channel integration: voice-call cli CLI command changes commands Command implementations extensions: memory-core Extension: memory-core extensions: memory-wiki gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. plugin: cua-computer rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security-sensitive-changed 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