Skip to content

refactor(core): collapse internal facades and helper modules - #165322

Merged
steipete merged 1 commit into
mainfrom
unify/facades-core-1004
Oct 5, 2026
Merged

steipete merged 1 commit into
mainfrom
unify/facades-core-1004

Conversation

@steipete

@steipete steipete commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Core callers traverse internal facades and single-consumer modules to reach implementations that already have a clear owner.

User Impact

No user-visible behavior, configuration, protocol, or data-contract change. Public SDK entry points and lazy-loading boundaries remain intact.

Why This Change Was Made

Remove 16 internal modules by importing their existing owners directly or keeping private helpers with their sole consumer. This covers Gateway device authentication and timeouts, queue claims, transcript parsing, APNs payloads, plugin registrars and installation checks, and CLI formatting/update reporting.

Evidence

  • Focused Blacksmith Testbox proof: 1,074 tests across 30 files passed in 264.45 seconds with --maxWorkers=1.
  • Final targeted rerun: six files / 582 distinct tests passed in 119.97 seconds, including the changed path inventories and Gateway handlers.
  • Full pnpm check:changed passed in 1,825.18 seconds, including typechecking, lint, dead-export scans, and zero runtime value import cycles.
  • Codex autoreview: no actionable P0–P2 findings. No test cases were added or removed.
  • One conflict-free, patch-identical rebase onto b0c93a84e9e267a864d1bc89b0e6ea022a3d0637; only shared assertion-baseline context changed among the candidate paths. Hosted CI run 37261748237 tested exact head 12faf071401fe1eb0ebd69707b2db0bd9ad3fcff. Its sole test failure is the unrelated cron-authority lock timeout reproduced on pinned main 60e6081c2f6d1b40e1206e4ac363d3451d7227aa (1 failed / 2 passed, 584.99 seconds including cold preparation). Inherited-failure landing evidence. The supplemental Gateway comparison was cancelled after source sync stalled; it is not claimed as passing proof.
  • Production LOC: +606 / -699 / net -93 verified using the complete paginated GitHub files API (58 changed files; 35 production files). The assertion baseline only shrinks.

Route internal callers directly to their implementation owners and fold
single-consumer helpers into the existing Gateway, plugin, and CLI owners.
Preserve public SDK surfaces, lazy-loading boundaries, and runtime behavior.
@clawsweeper

clawsweeper Bot commented Oct 5, 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 5, 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: 12faf071401fe1eb0ebd69707b2db0bd9ad3fcff
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/device-auth.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/node-command-policy-mobile.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/gateway/node-command-policy.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/gateway/server/ws-connection/connect-device-metadata.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server/ws-connection/handshake-auth-helpers.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/security/audit-plugins-trust.ts: Controls product security checks or trust decisions. Check whether the change weakens detection, protection, or remediation.

Carefully review these changes before merging.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime cli CLI command changes size: XL labels Oct 5, 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 5, 2026
@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 5, 2026, 12:15 AM ET / 04:15 UTC (Revision 2).

ClawSweeper review

What this changes

The branch removes internal forwarding modules and moves private helpers into their existing Gateway, plugin, delivery, and CLI owners.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this remains useful internal cleanup, and no actionable introduced defect was found. The previous compatibility warning is unsupported by the actual patch: configuration, defaults, public APIs, and stored-data contracts remain unchanged.

Priority: P3
Reviewed head: 12faf071401fe1eb0ebd69707b2db0bd9ad3fcff

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent internal refactor with substantial reported validation and no actionable introduced defect found.
Proof confidence 🌊 off-meta tidepool Not applicable: Trusted-author internal cleanup is exempt from ordinary contributor runtime proof. Authentication, queue claims, plugin registration, and payload helpers retain their implementations; no material authority or stored-data contract change requires an additional proof gate.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Trusted-author internal cleanup is exempt from ordinary contributor runtime proof. Authentication, queue claims, plugin registration, and payload helpers retain their implementations; no material authority or stored-data contract change requires an additional proof gate.
Evidence reviewed 9 items Pinned patch and merge ownership: Inspected the introduced b0c93a8..12faf07 changes in bounded groups. The raw test-merge commit records the pinned base first and exact PR head second; later main changes were not attributed to this PR.
Previous compatibility warning resolved by inspection: The deleted types.installs module only re-exported InstallRecordBase from zod-schema.installs. Remaining consumers use type-only imports from that same owner. No schema, serialized field, configuration option, default, or migration is introduced.
Security-sensitive behavior preserved: Device-auth consumers now import the exact implementation previously re-exported by the facade. The relocated agent.wait handler retains validation, session visibility and lifecycle checks, including reauthorization after awaiting completion. Queue claims still resolve to the same kernel. These changes do not materially alter authority.
Findings None None.
Security None None.

How this fits together

OpenClaw’s Gateway, plugin loader, delivery queue, and CLI consume shared implementations for authentication, session reads, installation, and reporting. This refactor shortens those internal paths while preserving their existing outputs and checks.

flowchart TD
  A[Gateway requests] --> D[Existing implementation owners]
  B[Plugin registration and installation] --> D
  C[CLI and delivery operations] --> D
  D --> E[Authentication and policy checks]
  D --> F[Session and delivery operations]
  D --> G[Operator output]
Loading

Before merge

  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
Agent review details

Security

None.

PR surface

Source -93, Tests +1, Config -1, Other -1. Total -94 across 58 files.

View PR surface stats
Area Files Added Removed Net
Source 37 608 701 -93
Tests 19 24 23 +1
Docs 0 0 0 0
Config 1 0 1 -1
Generated 0 0 0 0
Other 1 0 1 -1
Total 58 632 726 -94

Review metrics

None.

Technical review

Best possible solution:

Keep direct internal imports and private helpers with their existing owners while preserving public exports, lazy loading, authorization checks, and persisted formats.

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

Not applicable: this PR proposes internal cleanup rather than a reported behavior defect; no introduced failing path was established.

Is this the best way to solve the issue?

Yes: removing forwarding modules and keeping single-consumer helpers private is consistent with existing ownership, and the inspected patch preserves the relevant contracts.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is internal simplification with no identified change to user-visible behavior or product contracts.
  • 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: Trusted-author internal cleanup is exempt from ordinary contributor runtime proof. Authentication, queue claims, plugin registration, and payload helpers retain their implementations; no material authority or stored-data contract change requires an additional proof gate.

Evidence

What I checked:

  • Pinned patch and merge ownership: Inspected the introduced b0c93a8..12faf07 changes in bounded groups. The raw test-merge commit records the pinned base first and exact PR head second; later main changes were not attributed to this PR. (bc001038f94d)
  • Previous compatibility warning resolved by inspection: The deleted types.installs module only re-exported InstallRecordBase from zod-schema.installs. Remaining consumers use type-only imports from that same owner. No schema, serialized field, configuration option, default, or migration is introduced. (src/config/types.hooks.ts:7, 12faf071401f)
  • Security-sensitive behavior preserved: Device-auth consumers now import the exact implementation previously re-exported by the facade. The relocated agent.wait handler retains validation, session visibility and lifecycle checks, including reauthorization after awaiting completion. Queue claims still resolve to the same kernel. These changes do not materially alter authority. (src/gateway/server-methods/agent.ts:57, 12faf071401f)
  • Workflow admission preserved: The workflow removes the deleted mobile-helper path while retaining node-command-policy.ts, where its constants now live. Action references, permissions, executed commands, and scheduled reuse inputs are unchanged. (.github/workflows/node-runtime-conformance.yml:15, 12faf071401f)
  • Cleanup remains absent from fetched main: At fetched main cbe3ff1, registry-registrars still composes the separate capability and memory modules. The device-auth and install-type forwarding modules also remain. No merged fixing PR establishing redundancy was supplied or identified. (src/plugins/registry-registrars.ts:1, cbe3ff13b844)
  • Validation claims and proof applicability: The captured PR body reports 1,074 focused tests, a 582-test targeted rerun, and passing check:changed. These are supplemental validation claims, not independently executed runtime proof. The provided MEMBER association and security-guard comment identifying admin access establish trusted-author treatment; no material authority change triggers additional final-effect proof. (12faf071401f)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: 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-05T04:05:42.983Z sha 12faf07 :: blocked before merge. :: none

@steipete
steipete enabled auto-merge (squash) October 5, 2026 04:10
@steipete

steipete commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Exact-head landing evidence for 12faf071401fe1eb0ebd69707b2db0bd9ad3fcff:

  • Hosted CI run 37261748237 completed on this head. Its only failing test job is checks-node-changed-9; the CI gate fails downstream. The other 102 jobs passed and 24 were skipped.
  • The failure is test/gateway.multi.e2e.test.ts → “preserves scheduler runtime across a scheduler-disabled Gateway edit”, at the child scheduler's stderr assertion. The child receives file_lock_timeout for openclaw.sqlite.cron-authority before the update assertions.
  • Independently reproduced the same test and error on main commit 60e6081c2f6d1b40e1206e4ac363d3451d7227aa, in a separate exact-commit worktree on Blacksmith Testbox tbx_01m4550szawxfcq7cfy4a96xj1 (lease run). Installed full dependencies, then ran pnpm test test/gateway.multi.e2e.test.ts --maxWorkers=1: 1 failed / 2 passed; Vitest 42.31 seconds, cold command including preparation 584.99 seconds.
  • The test, its instance fixture, cron receipt-authority owner, and file-lock implementation are byte-identical between the reproduced main and this PR head. This PR does not change the failure's lock acquisition path. The test helper import change points device authentication at the unchanged implementation owner.
  • The candidate's focused tests and full check:changed passed on Blacksmith, and Codex autoreview was clean through P2. The rebase retained an identical patch. Production diff verified with full GitHub files pagination: +606/-699, net -93.

Landing the exact reviewed head under the explicitly authorized inherited-main-failure exception. The cron cross-process custody failure remains an unrelated follow-up; this is not a green-CI claim.

@steipete
steipete merged commit fa468f6 into main Oct 5, 2026
199 of 203 checks passed
@steipete
steipete deleted the unify/facades-core-1004 branch October 5, 2026 04:45
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
…w#165322)

Route internal callers directly to their implementation owners and fold
single-consumer helpers into the existing Gateway, plugin, and CLI owners.
Preserve public SDK surfaces, lazy-loading boundaries, and runtime behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes 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. 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