Skip to content

refactor(channels): remove redundant private forwarding modules - #130348

Merged
steipete merged 2 commits into
mainfrom
codex/cleanup20k-discord-zalouser-private-facades-20260826
Aug 26, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/cleanup20k-discord-zalouser-private-facades-20260826

Conversation

@steipete

@steipete steipete commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Maintainer-requested cleanup of private forwarding modules in Discord, Slack, WhatsApp, and Zalo Personal. These modules duplicate existing SDK or plugin ownership and make internal dependency paths harder to follow.

Why This Change Was Made

Remove six export-only private modules and import each binding from its existing owner. Discord callers now use the precise SDK, message, and native-command modules; Slack retains its existing lazy action loader; WhatsApp retains its parent runtime/security boundary; Zalo Personal uses narrow SDK entrypoints. No replacement aliases or broad core imports are added.

Production: +127/-300, net -173 lines. Tests and test support: +26/-40, net -14, counted separately. All eight public API/runtime entrypoint files remain byte-identical, preserving their complete value/type exports. There are no configuration, persistence, schema, protocol, dependency, or permission changes.

User Impact

No user-visible behavior change. Channel authentication, permission checks, native command callbacks, media handling, and message delivery continue through the same implementations. This is AI-assisted internal maintenance, not a feature retirement.

Evidence

  • Existing Discord native-command, component-send, media, channel-policy, and security tests: 12 files / 195 assertions passed.
  • WhatsApp real inbound dispatch, delivery receipts, routing, and media tests: 4 files / 83 assertions passed.
  • Slack action routing, reads, and downloads: 3 files / 151 assertions passed.
  • Complete Zalo Personal suite: 28 files / 287 assertions passed.
  • Public runtime SDK, channel import, and bundled shape guards: 3 files / 193 assertions passed.
  • Independent source review verified all 40 changed production modules retain identical non-import code, all 765 named bindings resolve to their original leaf owners, all 103 dynamic calls retain their owners, and the four plugin graphs remain acyclic with no new dangling imports.
  • The Discord media mock retains the real SDK namespace through vi.importActual; the removed WhatsApp mock was an identical subset of the retained canonical mock. Existing assertions remain intact.
  • Complete authenticated Codex precommit review passed again after the lint correction: the complete 62,981-byte final patch was explicitly provided alongside the 1,822-byte local correction, exit 0, no actionable findings.
  • Local configured syntax lint passed all 53 surviving changed files; formatting and git diff --check passed. Current head: fcc2cebd107ae517278a4612fb2203c9df37bd7c.
  • The first normal PR CI caught duplicate type-only imports in two Discord callers. Consolidated those imports, reproduced the original lint errors and verified their removal, and reran 47 existing Discord account/channel/security assertions successfully. No runtime behavior changed. The updated head gets a fresh complete independent review and normal PR CI.
  • The pre-publication Testbox changed-check attempt failed during source synchronization (exit 124), before checks or compilation started. Its targeted sync hit the two-minute transfer bound, then full sync failed the existing five-minute completion-marker guard. The lease is stopped; this is not passing check evidence. Normal pull-request CI on the published head must pass all selected lint, type, build, security, and owner-test checks before native preparation and merge.

Local dependency limitations: the linked worktree has no local dependency install, and the unchanged Canvas A2UI build resolves @lit/context only from worktree-local dependency paths, stopping before compilation. The configured extension lint wrapper also stops while preparing SDK declarations because the inherited install predates the branch's pinned dependencies: installed Google SDK 2.13.0 versus required 2.17.1, markdown-it 14.3.0 versus 15.0.0, and Pi TUI 0.82.1 versus 0.84.2. The corresponding errors concern newer SDK/TUI exports and markdown-it types, outside this patch. No shared dependencies were reconciled and neither failed command is claimed as passing. Clean hosted lint/type/artifact-build proof is required before merge. No live channel API behavior changes are claimed; existing owner-boundary tests exercise unchanged behavior.

@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord channel: slack Channel integration: slack channel: whatsapp-web Channel integration: whatsapp-web channel: zalouser Channel integration: zalouser size: M maintainer Maintainer-authored PR labels Aug 26, 2026
@steipete
steipete marked this pull request as ready for review August 26, 2026 20:06
@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 Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 4:32 PM ET / 20:32 UTC.

ClawSweeper review

What this changes

The PR deletes private forwarding modules in Discord, Slack, WhatsApp, and Zalo Personal and retargets callers to their existing owner modules or shared Plugin SDK subpaths.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this maintainer-owned cleanup open for human handling. Static review found the direct imports align with existing narrow Plugin SDK contracts and preserve Slack’s lazy boundary, but current-main comparison and exact-head CI completion are unavailable in this checkout.

Priority: P3
Reviewed head: fcc2cebd107ae517278a4612fb2203c9df37bd7c
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a coherent deletion-oriented refactor with preserved lazy loading and focused test seam updates, pending normal exact-head validation.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored internal refactor claims no user-visible behavior change, so external-contributor real-behavior proof is not required.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored internal refactor claims no user-visible behavior change, so external-contributor real-behavior proof is not required.
Evidence reviewed 6 items Plugin SDK contract: The directly imported action and config symbols remain declared narrow SDK exports, so replacing the Discord forwarding barrel does not introduce a new public SDK surface.
Slack lazy owner retained: Slack still loads its action implementation through createLazyRuntimeModule; only the dynamic-import target moved from the re-export module to the existing actions owner.
Discord inbound ownership remains split by responsibility: The message dispatcher now imports channel identity, sticker, and text helpers from their existing focused owner modules; its debounce and preflight path is unchanged.
Findings None None.
Security None None.

Live Verification

Command: pnpm test:channels -- extensions/discord/src/monitor/message-text.test.ts extensions/discord/src/monitor/message-media.test.ts extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.test.ts

Result: FAIL (failed) — step 1 run pnpm test:channels -- extensions/discord/src/monitor/message-text.test.ts extensions/discord/src/monitor/message-media.test.ts extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.test.ts: previous terminal command was still running after 30 seconds: "pnpm test:channels -- extensions/discord/src/monitor/message-text.test.ts extensions/discord/src/monitor/message-media.test.ts extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.test.ts"

$ node scripts/run-vitest.mjs run --config test/vitest/vitest.channels.config.ts -- extensions/discord/src/monitor/message-text.test.ts extensions/discord/src/m
onitor/message-media.test.ts extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.test.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130348-wcBUdj/target

No test files found, exiting with code 0

include:
exclude:  dist/**, test/fixtures/**, apps/macos/**, apps/macos/.build/**, **/node_modules/**, **/vendor/**, dist/OpenClaw.app/**, **/._*, **/*.live.test.ts, **/
*.e2e.test.ts, src/gateway/**, src/channels/plugins/contracts/**

Assertions:

  • FAIL expect_output: Test Files

How this fits together

Channel plugins translate transport events and actions into OpenClaw’s shared Plugin SDK behavior. The refactor changes internal import routing while retaining the same channel action, inbound-dispatch, and delivery owners.

flowchart LR
  A[Channel event or action] --> B[Channel plugin]
  B --> C[Owner-specific module]
  C --> D[Shared Plugin SDK]
  D --> E[Message delivery or action result]
Loading

Decision needed

Question Recommendation
After exact-head CI succeeds and the latest ClawSweeper rank-up list is checked, should this protected maintainer cleanup land without further changes? Land after exact-head verification: Accept the direct-import cleanup once required CI is green and any current rank-up move is satisfied.

Why: The PR carries the protected maintainer label and is maintainer-authored; the review worker cannot independently establish current-main equivalence from this partial checkout.

Before merge

  • Resolve merge risk (P1) - The checkout cannot independently compare the PR with current main or inspect the full parent diff because required promisor objects are unavailable and GitHub DNS is unreachable; selected exact-head CI is also still running.
Agent review details

Security

None.

PR surface

Source -190, Tests +3. Total -187 across 59 files.

View PR surface stats
Area Files Added Removed Net
Source 47 127 317 -190
Tests 12 26 23 +3
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 59 153 340 -187

Review metrics

Metric Value Why it matters
Production versus test delta production +127/-299 (net -172); tests/test support +26/-40 (net -14) This is deletion-oriented internal cleanup, with no net production growth to justify.

Stored data model

Persistent data-model change detected: persistent cache schema: extensions/discord/src/actions/runtime.guild.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the direct owner imports, finish exact-head CI, and confirm the latest ClawSweeper rank-up instructions before landing the maintainer-owned refactor.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the direct owner imports, finish exact-head CI, and confirm the latest ClawSweeper rank-up instructions before landing the maintainer-owned refactor.

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

Not applicable: this PR refactors internal module ownership rather than fixing a reported user-visible defect.

Is this the best way to solve the issue?

Yes, subject to exact-head verification: removing redundant private forwarders and importing narrow existing owners is the cleaner Plugin SDK boundary, and Slack retains its lazy runtime load.

AGENTS.md: found but not applied because it conflicted with ClawSweeper's review contract.

Codex review notes: model internal, reasoning high; reviewed against d9b41332e458.

Labels

Label changes:

  • add P3: This is an internal channel-plugin cleanup with no claimed user-visible behavior change.
  • 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: This maintainer-authored internal refactor claims no user-visible behavior change, so external-contributor real-behavior proof is not required.

Label justifications:

  • P3: This is an internal channel-plugin cleanup with no claimed user-visible behavior change.
  • 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: This maintainer-authored internal refactor claims no user-visible behavior change, so external-contributor real-behavior proof is not required.

Evidence

What I checked:

  • Plugin SDK contract: The directly imported action and config symbols remain declared narrow SDK exports, so replacing the Discord forwarding barrel does not introduce a new public SDK surface. (src/plugin-sdk/channel-actions.ts:3, fcc2cebd107a)
  • Slack lazy owner retained: Slack still loads its action implementation through createLazyRuntimeModule; only the dynamic-import target moved from the re-export module to the existing actions owner. (extensions/slack/src/action-runtime.ts:55, fcc2cebd107a)
  • Discord inbound ownership remains split by responsibility: The message dispatcher now imports channel identity, sticker, and text helpers from their existing focused owner modules; its debounce and preflight path is unchanged. (extensions/discord/src/monitor/message-dispatcher.ts:19, fcc2cebd107a)
  • WhatsApp test seam follows the retained owner: Inbound dispatch now imports its runtime functions from the retained local runtime API, whose colocated test already mocks that exact module. (extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.ts:46, fcc2cebd107a)
  • Historical ownership: Recent feature and fix history on the Slack action path includes substantial work by Peter Steinberger, Josh Avant, and Sarah Fortune; this supports routing rather than a regression attribution. (extensions/slack/src/action-runtime.ts:55, a968d15f6383)
  • Checkout limitation: The supplied PR head is readable, but its recorded base and first commit objects are absent locally; Git attempted an unreachable promisor fetch, so current-main and full PR-diff comparison could not be independently completed.

Likely related people:

  • steipete: Authored the checked-out refactor and multiple recent Slack action and channel changes in the local history. (role: recent channel-area contributor; confidence: high; commits: fcc2cebd107a, 2aa5eee34e51, 9ad09970b49d; files: extensions/slack/src/action-runtime.ts, extensions/discord/src/monitor/message-dispatcher.ts)
  • joshavant: Recent history includes Slack action authorization and file-download work near the lazy action boundary. (role: recent adjacent contributor; confidence: medium; commits: f68b80887e3b, ed31a4dd79bf; files: extensions/slack/src/action-runtime.ts)
  • Sarah Fortune: Introduced substantial Slack action and Enterprise Grid behavior carried by the affected runtime path. (role: feature contributor; confidence: medium; commits: a968d15f6383, cdaea2d6b67c; files: extensions/slack/src/action-runtime.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Wait for the selected exact-head CI checks to complete and verify the latest ClawSweeper rank-up list before landing.

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.

@steipete

Copy link
Copy Markdown
Contributor Author

Final maintainer verification for fcc2ceb: the normal pull-request CI run 33010464955 completed green. Complete precommit review and a distinct authenticated full published two-commit review both completed without actionable findings; the latter covered all 59 changed files in one complete pass.

The latest ClawSweeper rank-up request is satisfied: exact-head CI has finished, and I read the current rank-up list. Its partial-checkout/promisor limitation does not apply to the maintainer checkout: the full parent range, original private exports, canonical owners, callers, and current-main overlap were inspected. The eight public API roots are unchanged, and all retained production bodies retain their original behavior. The flagged runtime.guild.ts persistent-cache/schema item is not a storage change: that file changes imports only, with no schema, SQL, migration, cache-state, or runtime-body edits.

Focused proof passed 909 existing assertions across all four channel owners and the public SDK, channel import, and bundled-shape guards. After the two duplicate type imports were consolidated, the configured syntax lint passed all 53 retained changed files and 47 Discord account/security assertions passed. The review bot's test:channels command selected no plugin tests; the owner tests were actually executed through their proper repository Vitest configurations. This is an internal routing refactor, not a claim of live authenticated channel testing.

Final production delta is +127/-300, net -173. Tests and test support are separately +26/-40, net -14, and receive no production credit. The earlier Testbox run 33007275912 failed during source sync before checks (exit 124), and local build/declaration preparation had inherited dependency prerequisites missing; neither is passing evidence. The clean installed normal hosted gates on the final head are the full lint/type/build proof. Proceeding through native review validation and Testbox-gated prepare/merge, without changing the reviewed head.

@steipete
steipete merged commit 7713364 into main Aug 26, 2026
143 checks passed
@steipete
steipete deleted the codex/cleanup20k-discord-zalouser-private-facades-20260826 branch August 26, 2026 21:09
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…claw#130348)

* refactor(channels): remove private forwarding modules

* refactor(discord): consolidate config type imports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord channel: slack Channel integration: slack channel: whatsapp-web Channel integration: whatsapp-web channel: zalouser Channel integration: zalouser maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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