Repository navigation
refactor(channels): deslop channel plugins - #162603
Conversation
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.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. Reviewed October 1, 2026, 6:07 AM ET / 10:07 UTC. ClawSweeper reviewWhat this changesThe 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 Review scores
Verification
How this fits togetherChannel 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]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -279, Tests +76, Other -2. Total -205 across 57 files. View PR surface stats
Review metrics
Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
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.
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.
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.
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.
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
nullnow 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.
Fixes Found Along the Way
Mattermost parsed JSON through a type assertion, then dereferenced
payload.contextoutside the parser catch. JSONnullescaped as a TypeError. ReusingsafeParseJsonsends 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 ontbx_01m3vck01mdexgyasxjdfa6znt(workflow).0764ad982ae491ef4d0f3dfea0f00846834968e9; every job passed or was correctly skipped. The final remotenode scripts/check-changed.mjs --base b614356e014c802d6a12696d97c74c7400116933passed 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.