Skip to content

refactor(core): deslop single-use core abstractions - #165124

Merged
steipete merged 4 commits into
mainfrom
deslop/l370-single-use-core-20261004
Oct 4, 2026
Merged

steipete merged 4 commits into
mainfrom
deslop/l370-single-use-core-20261004

Conversation

@steipete

@steipete steipete commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Single-consumer factories, forwarding modules, and parameter bags obscured existing core owners and added unnecessary code to maintain.

User Impact

No user-visible behavior change is intended. Public Plugin SDK contracts, configuration, persisted data, protocol responses, model-facing text, and lifecycle/authority checks remain unchanged.

Why This Change Was Made

This second pass after #164806 removes 1,009 net production lines in one batch, including nine private forwarding modules.

  • Inline model discovery, catalog evaluation, declared-tool/node-tool policy, and cooldown adapters into their concrete consumers. Retain caches, prepared facts, and lazy plugin boundaries.
  • Remove conversation RPC/list/turn projection layers and the single-use session PR snapshot factory. Retain idempotency, publication lifetimes, and authorization checks.
  • Replace the bound-delivery factory with its sole strict routing operation, removing unused injection and unreachable modes.
  • Inline npm peer-plan and catalog-scheduling adapters, eliminating an unnecessary policy-to-argv-to-environment round trip.
  • Simplify usage rollup/cache forwarding and specialize MiniMax parsing for its two actual response modes, preserving field precedence and overflow handling.
  • Remove the uncalled proxy-only timeout path and inline runtime FormData preparation. Retain coverage on the active timeout API and multipart boundary behavior.
  • Inline approval projections and plugin extractor, Control UI, and catalog registration adapters into their existing owners. Keep SDK wrappers where their wider types are a real contract.

Existing behavior coverage is retained or moved to the surviving boundary. No timeouts, assertions, or fixture isolation were weakened.

Evidence

  • The final catalog-row type correction passed pnpm build:plugin-sdk:dts, focused lint, all 12 registry provider tests, and both cycle checks (0 cycles) on Blacksmith Testbox (run 37242540329). The source bytes were verified before execution and the lease is stopped.
  • Independent Codex review found no actionable P0–P2 defects in the batch or the final correction. Typed entry iteration resolves TS2322 without casts, assertions, fallback shapes, or suppressions.
  • Earlier remote batch proof passed 1,033 focused tests / 53 files, 1,135 plugin contract tests / 48 files, all selected typechecks and boundaries, and a full build. The later projection corrections passed 99 focused tests / 8 files, focused lint, and both zero-cycle checks. The final correction changes no imports or public SDK surface.
  • Production diff: −1,009 lines. Test/support and tooling reductions are counted separately. Existing coverage is retained at surviving boundaries; no assertions, timeouts, retries, or fixture isolation were weakened.
  • Earlier overloaded-Mac archive runs recorded two unchanged 120s timeouts. All ten archive tests passed on both clean base and candidate on the same isolated runner; no flake fix is claimed from those replays. An additional local contract repeat was interrupted without a result and is not counted as passing evidence.
  • The first hosted run exposed shadowed names and map-spread lint errors, which were corrected. Its separate unchanged saved-draft UI case timed out taking a screenshot. The next head exposed the strict indexed-access declaration error now covered by the passing final SDK build above. The final head 12fa4361d80faceb78d836f09f030edd3712e641 passed hosted CI run 37243504484. GitHub completed the GraphQL squash auto-merge pinned with expectedHeadOid; merge commit: dc518bfca481d64aef69f9a4f8435fc6d46ed46d. No admin exception was needed.
  • Test-cost sample: node scripts/run-vitest.mjs src/plugins/document-extractors.runtime.test.ts --maxWorkers=1 passed 13 tests in 17.40s wall time, including fresh worker preparation. No new test suites are added.

Inline internal single-consumer factories, policy adapters, projection helpers and forwarding modules into their concrete owners. Preserve public SDK seams, user-visible behavior, model context, and runtime ownership. Remove uncalled internal modes and keep boundary coverage on the retained flows.
@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.

@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: 12fa4361d80faceb78d836f09f030edd3712e641
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/tool-policy-declared-context.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-approval-reply.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling size: XL labels Oct 4, 2026
@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: needs maintainer review before merge. Reviewed October 4, 2026, 7:31 PM ET / 23:31 UTC (Revision 4).

ClawSweeper review

What this changes

The PR moves single-use model, conversation, approval, plugin, networking, usage, and update helpers into their existing owners and removes unused internal paths.

Merge readiness

✅ Ready for maintainer review

The prior catalog-row typing blocker is resolved, and the introduced diff reveals no remaining actionable correctness or security findings. Current main retains the abstractions being removed, so this remains useful cleanup.

Priority: P3
Reviewed head: 12fa4361d80faceb78d836f09f030edd3712e641

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent simplification with the prior typing defect repaired, retained boundary coverage, and no remaining actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: Verified repository-admin authorship exempts this internal refactor from ordinary contributor runtime proof. Source comparison preserves conversation delivery checks, approval descriptors, and plugin selection boundaries without materially changing authority; reported tests and builds remain supplemental. No stored-data contract changes were identified.
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 internal refactor from ordinary contributor runtime proof. Source comparison preserves conversation delivery checks, approval descriptors, and plugin selection boundaries without materially changing authority; reported tests and builds remain supplemental. No stored-data contract changes were identified.
Evidence reviewed 10 items Pinned introduced diff: Inspected the GitHub comparison from the verified merge base to the exact PR head, including all 60 file patches. Local git diff encountered an unavailable-object fetch returning HTTP 403; the read-only GitHub API supplied the pinned patches instead. Endpoint drift and the stale test merge were not treated as introduced changes.
Previous finding resolved: The final commit replaces spreading rows[index] with spreading the concrete row from rows.entries(), preserving required catalog fields and the copy of plugin-owned values. This directly addresses the retained TS2322 finding.
Current-main necessity: The fetched main revision still imports and invokes the separate model-catalog registration factory. The provided latest release does not establish that this subsequent cleanup shipped, and no merged fixing PR establishes redundancy.
Findings None None.
Security None None.

How this fits together

These core components connect configured providers, plugins, and Gateway requests to model selection, conversation delivery, approvals, and update operations. The refactor consolidates their internal implementation while preserving the existing inputs and outputs.

flowchart TD
  A[Configuration and plugin metadata] --> C[Existing core owners]
  B[Gateway and agent requests] --> C
  C --> D[Model and tool selection]
  C --> E[Conversation and approval handling]
  C --> F[Usage and update operations]
  D --> G[Existing public results]
  E --> G
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -1009, Tests -91, Other -5. Total -1105 across 60 files.

View PR surface stats
Area Files Added Removed Net
Source 45 1384 2393 -1009
Tests 12 113 204 -91
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 3 2 7 -5
Total 60 1499 2604 -1105

Review metrics

None.

Technical review

Best possible solution:

Keep the consolidated implementation with its existing public contracts, lifecycle fences, and coverage at the surviving owners.

Do we have a high-confidence way to reproduce the issue?

Not applicable to the cleanup itself. The previously recorded declaration failure has a source-confirmed repair in the final commit; this read-only review did not execute it.

Is this the best way to solve the issue?

Yes. The diff removes private forwarding layers while retaining the existing SDK contracts, production policies, and state owners.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 382c987dbe1c.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Verified repository-admin authorship exempts this internal refactor from ordinary contributor runtime proof. Source comparison preserves conversation delivery checks, approval descriptors, and plugin selection boundaries without materially changing authority; reported tests and builds remain supplemental. No stored-data contract changes were identified.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P3: This is internal cleanup intended to preserve existing user-visible behavior.
  • 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 internal refactor from ordinary contributor runtime proof. Source comparison preserves conversation delivery checks, approval descriptors, and plugin selection boundaries without materially changing authority; reported tests and builds remain supplemental. No stored-data contract changes were identified.

Evidence

What I checked:

  • Pinned introduced diff: Inspected the GitHub comparison from the verified merge base to the exact PR head, including all 60 file patches. Local git diff encountered an unavailable-object fetch returning HTTP 403; the read-only GitHub API supplied the pinned patches instead. Endpoint drift and the stale test merge were not treated as introduced changes. (12fa4361d80f)
  • Previous finding resolved: The final commit replaces spreading rows[index] with spreading the concrete row from rows.entries(), preserving required catalog fields and the copy of plugin-owned values. This directly addresses the retained TS2322 finding. (src/plugins/registry-state.ts:28, 12fa4361d80f)
  • Current-main necessity: The fetched main revision still imports and invokes the separate model-catalog registration factory. The provided latest release does not establish that this subsequent cleanup shipped, and no merged fixing PR establishes redundancy. (src/plugins/registry-state.ts:2, 382c987dbe1c)
  • Authorization preserved: Conversation binding retains its synchronous assertCommitAllowed callback using current configuration after awaited route resolution. The introduced changes also preserve agent-scoped replay identities, session-reader lifetime fences, node-tool deny rules, and typed approval action fields; no material expansion or transfer of authority was identified. (src/gateway/conversation-turn.ts:236, 12fa4361d80f)
  • SDK and stored-state compatibility: The provider-entry edit moves an existing private catalog projection without changing its public signature or row fields. Removed helpers have no remaining SDK export references. Usage-cache edits retain the same refresh-lock request and storage owners, while npm manifest construction and usage-rollup shapes remain unchanged; no stored-data contract change requires migration. (src/plugin-sdk/provider-entry.ts:367, 12fa4361d80f)
  • Retained boundary coverage: Read the existing overlapping model-catalog hook test and the complete extractor runtime tests. Extractor sibling-failure coverage moves to the surviving resolver, while global-disablement and allowlist assertions remain. Dispatcher tests move to the active timeout operation and restore the previous global dispatcher. (src/plugins/registry.provider-like.test.ts:14, 12fa4361d80f)

Likely related people:

  • steipete: 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 (3 earlier review cycles)
  • reviewed 2026-10-04T21:38:57.564Z sha e791493 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-04T22:45:45.131Z sha f889e8d :: needs maintainer review before merge. :: none
  • reviewed 2026-10-04T22:57:02.209Z sha f889e8d :: needs changes before merge. :: [P2] Preserve the concrete catalog row type during iteration

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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
@steipete
steipete enabled auto-merge (squash) October 4, 2026 23:25
@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 4, 2026
@steipete
steipete merged commit dc518bf into main Oct 4, 2026
174 checks passed
@steipete
steipete deleted the deslop/l370-single-use-core-20261004 branch October 4, 2026 23:40
steipete added a commit that referenced this pull request Oct 5, 2026
Specialize private agent, Gateway, infrastructure, and plugin flows to their actual callers. Remove unused options, fixed-value forwarding, and unread result fields while preserving public SDK, configuration, protocol, and lifecycle contracts. Preserve the new commentary-media ownership hook during conflict integration.

Net production reduction: 969 lines. Independent review was clean; focused owner tests passed and both import-cycle checks reported zero. Matching inherited main failures and exact-head CI evidence are recorded in PR #165198. Related prior batches: #164268, #164810, #165124.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
Inline private single-consumer adapters into existing agent, Gateway, infrastructure, and plugin owners. Preserve public SDK, configuration, persistence, wire, and lifecycle/authority contracts.

Remove 1,009 net production lines. Validate the final catalog-row projection with SDK declaration generation, focused registry tests, both import-cycle checks, and independent review.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
Specialize private agent, Gateway, infrastructure, and plugin flows to their actual callers. Remove unused options, fixed-value forwarding, and unread result fields while preserving public SDK, configuration, protocol, and lifecycle contracts. Preserve the new commentary-media ownership hook during conflict integration.

Net production reduction: 969 lines. Independent review was clean; focused owner tests passed and both import-cycle checks reported zero. Matching inherited main failures and exact-head CI evidence are recorded in PR openclaw#165198. Related prior batches: openclaw#164268, openclaw#164810, openclaw#165124.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts 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