Skip to content

refactor(channels): deslop channel plugins - #162603

Merged
steipete merged 4 commits into
mainfrom
deslop/l269-dup-channel-plugins2-20261001
Oct 1, 2026
Merged

steipete merged 4 commits into
mainfrom
deslop/l269-dup-channel-plugins2-20261001

Conversation

@steipete

@steipete steipete commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Related: #162339, #162409. Maintainer-requested continuation of channel-plugin deduplication.

What Problem This Solves

Channel plugins still repeat parsing, target projection, small lifecycle primitives, and parameter contracts that already have an owner.

User Impact

The refactoring preserves delivery text, pairing and allowlists, transport behavior, config, stored data, and public SDK input shapes. Mattermost interaction callbacks containing JSON null now return the existing invalid-body HTTP 400 response instead of throwing into the outer route handler.

Why This Change Was Made

This continuation removes 279 net production lines (+281/−560 across 49 production files); six test/support files gain 76 net lines, including the preserved Slack suite split. It adds no public SDK helper or dependency.

  • Discord shares ordered-range search mechanics and read-target facts, reuses its existing allowlist/config guards, and drops redundant component bookkeeping. Strict versus inclusive chunk boundaries and fetched versus listed target policy remain explicit.
  • Bundled SDK entries share private optional-loader construction; every invocation still uses the guarded loader and current plugin instance. Core status redaction, dedupe timestamp parsing, webhook limits and parameter declarations reuse their existing owners.
  • ClickClack reuses immutable generation cleanup facts and nonce inputs; Feishu and Buzz use the existing deferred-promise owner. Feishu comment fallback converges on one send while keeping provider-specific validation and errors.
  • Matrix calls its concrete asynchronous client and avoids an unnecessary array copy. LINE shares its allowlist normalizer and JSON parser. Nostr validates strict outbound targets once; Signal derives a repeated parameter type from its owner.
  • Mattermost shares content sending, retires its private test-only unscoped secret setter while retaining the public single-account fallback, and simplifies error classification. Slack action replies reuse the existing Web API responder while retaining explicit credentials and ephemeral delivery. Twilio uses existing JSON/record parsers. Zalo drops a narrating chat-action comment; other endpoint comment cleanup already landed independently.

Fixes Found Along the Way

Mattermost parsed JSON through a type assertion, then dereferenced payload.context outside the parser catch. JSON null escaped as a TypeError. Reusing safeParseJson sends that input through the existing invalid-body response; the HTTP-entry regression also keeps source admission and token checks intact. The public account-free attachment signing contract has an explicit HMAC assertion.

Evidence

Remote proof on Blacksmith Testbox: initial leases tbx_01m3tz28g8jk9sfmwhcek7yekr / tbx_01m3v6fasqekt80trap7xqe9wd; final rebased candidate on tbx_01m3vck01mdexgyasxjdfa6znt (workflow).

  • Original Mattermost null regression failed with the expected context TypeError; the corrected handler passes.
  • The rebased candidate passed the 62-file focused selection across 16 Vitest shards (215s). The Slack menu/policy/native Stop selection passed 105 tests across 3 files.
  • Plugin contracts passed 48 files / 1,133 tests; core/plugin/SDK import-boundary inventories and SDK export registration passed. Both cycle checks report 0 on the final candidate.
  • Build passed (419s). Native SDK API rendering passed (148s): existing parameter types now reference their owners; no public exports were added or removed.
  • Managed isolated Codex P0-P2 review is scoped-clean for the production batch and final test split/baseline updates.
  • Full suites passed for the twelve touched plugins across the recorded runs. The corrected Slack and ordinary Buzz/ClickClack/SMS/Zalo groups were repeated successfully on the rebased candidate (226s). Prior full-suite evidence was retained for unchanged sibling code.
  • Core and extension lint pass on the final candidate. The earlier full changed check passed all core/extension/test typechecks and all three Knip scans; its lint findings were repaired. Hosted CI run 36846673376 passed on exact head 0764ad982ae491ef4d0f3dfea0f00846834968e9; every job passed or was correctly skipped. The final remote node scripts/check-changed.mjs --base b614356e014c802d6a12696d97c74c7400116933 passed in 1,779.86s, including all typechecks, three Knip scans, lint and guards.

The Slack assertion extension initially hit the old oversized-test growth cap. The entire native-menu suite was moved to a sibling with shared command fixtures, retaining the separate native Stop fixture and every assertion. Actual Vitest proof caught and resolved a hoisted-export restriction and missing moved import. Only seven task-owned assertion allowances and the obsolete Slack line-cap allowance were reduced; no baseline was widened. The first Testbox ended during broad proof, so its interrupted suite is not counted as a pass.

Measured one-worker test wall times: Mattermost outbound 20.01s, interactions 31.72s, account snapshot 1.68s, Slack menus 19.58s, Slack policy 20.78s. The interactions run spent 89% of its 29.62s Vitest duration in transformation; the two-row malformed-body regression adds no process, real wait, or new fixture. Hosted changed-test jobs passed in 81–348s including job setup.

The scoped clone scan used 10-line / 60-token thresholds and found 48 pairs; AST search found 36 forwarding shapes. Transport, authorization, persistence and public-facade distinctions were retained. The requested detailed census stays local.

Twenty-one Zalo comment deletions landed independently during validation and were excluded from this PR's 279-line production reduction. Tests, builds and static validation run remotely.

Reuse channel-owned parsing, target projection, cleanup facts and shared SDK primitives without changing delivery or access policy. Reject Mattermost JSON-null interaction callbacks with the existing invalid-body response; retain public single-account attachment signing.
Keep the existing assertions and command fixtures in bounded sibling modules. Preserve the separate native Stop fixture and retire only task-owned assertion and max-lines allowances.
@clawsweeper

clawsweeper Bot commented Oct 1, 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: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: nostr Channel integration: nostr channel: signal Channel integration: signal channel: slack Channel integration: slack channel: zalo Channel integration: zalo channel: feishu Channel integration: feishu channel: sms Channel integration: sms channel: buzz extensions: clickclack size: XL labels Oct 1, 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 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed October 1, 2026, 6:07 AM ET / 10:07 UTC.

ClawSweeper review

What this changes

The PR consolidates repeated channel-plugin logic, preserves Slack coverage in smaller files, and makes Mattermost reject JSON-null callbacks with HTTP 400.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this useful cleanup remains distinct from the merged predecessors, and no introduced correctness or security defect was found.

Priority: P3
Reviewed head: 0764ad982ae491ef4d0f3dfea0f00846834968e9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, coherent consolidation with meaningful regression coverage and no actionable correctness findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The verified repository-admin author is exempt from the external-contributor proof gate. Reported remote tests supplement source review of channel consolidation and Mattermost null rejection; they are not treated as live channel proof. 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: The verified repository-admin author is exempt from the external-contributor proof gate. Reported remote tests supplement source review of channel consolidation and Mattermost null rejection; they are not treated as live channel proof. No stored-data contract changes were identified.
Evidence reviewed 10 items Pinned patch and merge ownership: Inspected the merge-base-to-head production hunks and corresponding source. Raw test-merge records confirm the pinned main parent followed by the exact PR head, so unrelated base changes are not attributed to this PR.
Mattermost fix remains necessary: Fetched main and v2026.9.7 still parse JSON through an assertion and subsequently dereference payload.context. The branch rejects null within the existing parser catch; the extended handler regression checks the existing HTTP 400 response.
Release comparison: The latest supplied release retains the old Mattermost parser; this PR's null rejection is not already supplied by that release.
Findings None None.
Security None None.

How this fits together

Channel plugins translate provider events and OpenClaw replies into channel-specific messages and callbacks. Shared SDK helpers support their loading, parsing, access checks, and lifecycle handling.

flowchart LR
  A[Provider events and callbacks] --> B[Channel plugins]
  C[OpenClaw replies and actions] --> B
  D[Shared SDK helpers] --> B
  B --> E[Parsing and access checks]
  E --> F[Provider transport]
  E --> G[Agent events and channel status]
Loading

Before merge

  • Complete next step (P2) - Finish the PR-body one-worker timing record for the Slack test split and Mattermost interaction tests, including CI seconds when available.
Agent review details

Security

None.

PR surface

Source -279, Tests +76, Other -2. Total -205 across 57 files.

View PR surface stats
Area Files Added Removed Net
Source 49 281 560 -279
Tests 6 1582 1506 +76
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 5 7 -2
Total 57 1868 2073 -205

Review metrics

Metric Value Why it matters
Slack coverage preservation 61 test declarations retained; 1 strengthened Source comparison shows the moved menu suite preserves its assertions and strengthens ephemeral-response coverage.

Technical review

Best possible solution:

Use the existing shared owners while retaining channel-specific delivery, authorization, loading, and public compatibility contracts.

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

Yes, from source: a Mattermost POST body of JSON null reaches payload.context on current main. This review did not execute it; the branch extends the existing handler regression for that input.

Is this the best way to solve the issue?

Yes: the consolidation reuses existing owners and preserves the inspected contracts, while the null fix stays within Mattermost's existing invalid-body response.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: The primary contribution is internal cleanup with a bounded invalid-input handling fix.
  • 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: The verified repository-admin author is exempt from the external-contributor proof gate. Reported remote tests supplement source review of channel consolidation and Mattermost null rejection; they are not treated as live channel proof. No stored-data contract changes were identified.

Label justifications:

  • P3: The primary contribution is internal cleanup with a bounded invalid-input handling fix.
  • 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: The verified repository-admin author is exempt from the external-contributor proof gate. Reported remote tests supplement source review of channel consolidation and Mattermost null rejection; they are not treated as live channel proof. No stored-data contract changes were identified.

Evidence

What I checked:

  • Pinned patch and merge ownership: Inspected the merge-base-to-head production hunks and corresponding source. Raw test-merge records confirm the pinned main parent followed by the exact PR head, so unrelated base changes are not attributed to this PR. (a2aef20b1d01)
  • Mattermost fix remains necessary: Fetched main and v2026.9.7 still parse JSON through an assertion and subsequently dereference payload.context. The branch rejects null within the existing parser catch; the extended handler regression checks the existing HTTP 400 response. (extensions/mattermost/src/mattermost/interactions.ts:362, 43c68a5838a9)
  • Release comparison: The latest supplied release retains the old Mattermost parser; this PR's null rejection is not already supplied by that release. (extensions/mattermost/src/mattermost/interactions.ts, c074824a27c9)
  • Guarded loading and public contracts: The new private loader factory invokes the existing guarded export loader on every call. Current plugin-instance selection, optional exports, public parameter shapes, and lazy loading remain intact. (src/plugin-sdk/channel-entry-contract.ts:472, 0764ad982ae4)
  • Signing and response safeguards: Mattermost's removed unscoped setter branch had only test callers; production registers scoped secrets, and the public account-free attachment fallback remains covered by an independent HMAC expectation. Slack continues passing the same explicit bot token, thread target, and forced ephemeral response through its shared responder. (extensions/mattermost/src/mattermost/interactions.test.ts:108, 0764ad982ae4)
  • Persistence compatibility: Persistent dedupe substitutes an existing equivalent finite-number timestamp reader. Stored rows, keys, namespaces, TTL decisions, comparison writes, and migration behavior are unchanged; no stored-data contract change was identified. (src/plugin-sdk/persistent-dedupe.ts:76, 0764ad982ae4)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • stevenlee-oai: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Complete the PR-body cost record for the Slack test split and Mattermost interaction tests.

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
steipete enabled auto-merge (squash) October 1, 2026 10:08
@steipete
steipete merged commit 5cc4c3b into main Oct 1, 2026
158 of 169 checks passed
@steipete
steipete deleted the deslop/l269-dup-channel-plugins2-20261001 branch October 1, 2026 10:14
steipete added a commit that referenced this pull request Oct 1, 2026
Record both existing caller-selected export-type suppressions after #162603. No production suppression is added or changed. The exact failing inventory check reproduces before this correction and passes all three cases afterward; removing the existing directive reproduces the lint error.
MarMarLabs added a commit to MarMarLabs/openclaw that referenced this pull request Oct 1, 2026
227 upstream commits, including the option to omit tools on conversational
turns (openclaw#153340), which changes the core config baseline, and a channel plugin
cleanup (openclaw#162603) that touches eight Feishu files.

One conflict, in docs/.generated/config-baseline.sha256. Main changed the
core hash and this branch changes the channel hash, so the file was
regenerated from this merge rather than hand-merged. build:docker ran in a
separate detached checkout of this commit. The counts stay at core 2486,
channel 3788, plugin 4468. The core and plugin hashes now match
upstream/main and the channel hash stays this branch's, as predicted, and
the three generated-file checks pass there.

One code file merged cleanly with changes on both sides.
extensions/feishu/src/reply-dispatcher.ts takes main's createDeferred helper
for streaming delivery finalization, away from this branch's import and
table routing changes. None of this branch's new Feishu modules import the
other seven files main changed.

Feishu: 103 files and 1532 tests in the extension project, 17 files and
250 tests in the database-workers project. The forwarder test and the
routing guards pass, 444 tests. tsgo:core, tsgo:extensions,
tsgo:extensions:test, tsgo:test:root, the line-cap, max-lines and
assertion-safety ratchets against upstream/main, oxlint and oxfmt on the
43 changed code files all pass.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
Reuse canonical parsing, target projection, lifecycle primitives and parameter contracts across channel plugins and the channel SDK. Preserve delivery text, allowlists, pairing, transport behavior, persisted data and public input shapes.

Reject Mattermost JSON-null interaction callbacks through the existing invalid-body HTTP 400 path. Preserve single-account attachment signing and all Slack native command coverage.

Related: openclaw#162339, openclaw#162409.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
Record both existing caller-selected export-type suppressions after openclaw#162603. No production suppression is added or changed. The exact failing inventory check reproduces before this correction and passes all three cases afterward; removing the existing directive reproduces the lint error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: buzz channel: discord Channel integration: discord channel: feishu Channel integration: feishu channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: nostr Channel integration: nostr channel: signal Channel integration: signal channel: slack Channel integration: slack channel: sms Channel integration: sms channel: zalo Channel integration: zalo extensions: clickclack P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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