Repository navigation
refactor(channels): deslop discord and slack second pass - #158085
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
Codex review: blocked before merge. Reviewed September 25, 2026, 11:23 AM ET / 15:23 UTC (Revision 5). ClawSweeper reviewWhat this changesThe branch consolidates Discord and Slack plugin messaging and interaction code, removes private forwarding helpers, and ties Slack webhook cleanup to the registration that created it. Merge readiness⛔ Blocked before merge - 3 items remain Current main still has the Slack route-disposal defect, and the earlier merged cleanup PRs do not cover this second pass. The inspected changes show no actionable introduced defect. Priority: P3 Review scores
Verification
How this fits togetherThe Discord and Slack plugins turn platform events into authorized agent turns and deliver replies through each platform. Slack's HTTP route registry selects the webhook handler before an incoming event reaches the plugin. flowchart LR
A[Slack webhook] --> B[Slack route registry]
B --> C[Plugin policy checks]
D[Discord event] --> C
C --> E[Agent turn]
E --> F[Plugin reply delivery]
F --> G[Platform API]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep the channel responsibilities in their existing plugins and retain the registration-specific Slack route cleanup with its dispatch-level regression. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source shows that an older Slack route disposer can delete a replacement, and the PR adds a registered-dispatch regression for that sequence; I did not execute it in this read-only checkout. Is this the best way to solve the issue? Yes. Capturing the registration and making its disposer single-use repairs the route lifecycle at its owner, while direct SDK exports remove forwarding without changing the inspected contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 25d74027a95d. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
9406d6e to
57b4fe6
Compare
Consolidate transport preparation, result projection, interaction handling, and private SDK helper ownership after #156579 and #156773. Preserve channel authorization, registration payloads, credentials, public exports, and persisted state. Fix stale Slack HTTP route disposal so repeated cleanup cannot unregister a replacement handler. Keep a boundary regression for same-callback re-registration and preserve transport assertions through fixture cutovers.
Move RequestData to its serializer owner and import it directly from private consumers. Give voice listeners a leaf contract implemented by the manager, removing both type-import cycles reported by the architecture CI gate. Preserve request fields, listener method signatures, and runtime behavior.
57b4fe6 to
6108a3f
Compare
|
Merged via squash.
|
…8085) * refactor(channels): deslop discord and slack second pass Consolidate transport preparation, result projection, interaction handling, and private SDK helper ownership after openclaw#156579 and openclaw#156773. Preserve channel authorization, registration payloads, credentials, public exports, and persisted state. Fix stale Slack HTTP route disposal so repeated cleanup cannot unregister a replacement handler. Keep a boundary regression for same-callback re-registration and preserve transport assertions through fixture cutovers. * fix(discord): keep shared transport contracts acyclic Move RequestData to its serializer owner and import it directly from private consumers. Give voice listeners a leaf contract implemented by the manager, removing both type-import cycles reported by the architecture CI gate. Preserve request fields, listener method signatures, and runtime behavior.
What Problem This Solves
Maintainer-requested second-pass cleanup removes redundant execution paths and obsolete private adapters from the Discord and Slack plugins, following the first passes in #156579 and #156773.
User Impact
The refactor preserves authorization and pairing, interaction/webhook verification, credential precedence and diagnostics, outbound formatting and rate limits, command registration, public exports, configuration, tool schemas, and persisted state. The accompanying Slack fix keeps a replacement webhook handler registered when cleanup from an older registration runs again.
Why This Change Was Made
Fixes found along the way
Slack's HTTP route disposer previously deleted whichever handler currently occupied its path. Reusing an old disposer after replacement could remove the new route. Cleanup is now idempotent and tied to its captured registry/handler. The regression invokes the registered HTTP dispatch boundary, deliberately reuses the same callback for the replacement, and verifies both replacement survival and normal removal.
Resolution against current main
Rebased onto
9e5c2e2458416d5491be7135757f92151592bfe2, including #157185 (8518d3913e4). Only the four pre-authorized files conflicted.message-handler.hydration.ts: use main byte-for-byte. Drop this PR's older merge/fallback/parser cleanup; main's direct nativeMessageconstruction supersedes it. No old hydration helper is restored.prepare-thread-context.ts: keep main's inline thread-history and bot-root handling. Retain only the directopenclaw/plugin-sdk/session-store-runtimeimport forreadSessionUpdatedAtandresolveChannelResetConfig, because this PR deletes the old forwarding module that re-exported those exact helpers.prepare-thread-context-root.ts: use main byte-for-byte and drop this PR's predicate/policy simplifications. Upstream retained a 24-lineisSlackThreadAuthorCurrentBotowner used by thread context and room history; it did not delete the file. The six removed helper exports stay removed.scripts/check-assertion-safety-ratchet.mts --base origin/main --prune, then enforced the coordinator’s shrink-only rule. Every retained row matches the current count; 28 allowances are removed relative to main. The tool found one inherited, unlisted assertion in unchangedsrc/gateway/server-methods/send.ts; its row stays absent as on main rather than adding an allowance. The canonical verification command passes.The automatically merged Discord run-queue hunk retains only the approved single-use cancellation-wrapper inline, preserving main's new prepared context/job ownership.
Evidence
Current rebased head:
6108a3f3104a3554bdabbac429065fdbb2c72afe. Independent review of the complete rebased diff through P2 is clean. Production shortstat against the pinned main is 187 files, +1,566/-3,332, net -1,766 lines; test/support remains net -134.Fresh proof on Blacksmith Testbox
tbx_01m3cgct955ekj7484g8mw0bzw(lease workflow); the lease is stopped:pnpm test:extensions:batch discord: 297 files / 4,210 tests passed in 169 seconds.pnpm test:extensions:batch slack: 174 files / 3,136 tests passed in 130 seconds.node scripts/run-vitest.mjs.78e0afa6eb53c85ad548e46c6e2a6df428aa9f6972c9371ca011fa755dc3a3b6, identical locally and remotely.node scripts/check-changed.mjspassed its earlier selected stages, then stopped at the existing coreagents-rootinventory: 721 roots, limit 720. This PR changes neither those roots nor their configs/guard. A same-Testbox A/B reproduced the identical 721/720 message and exit 1 on both the candidate and clean base9e5c2e2458416d5491be7135757f92151592bfe2, using separate physical frozen dependencies for the base. An initial shared-install probe was rejected by the declaration-ownership guard and is not counted as baseline proof. The repository's documented policy makes size/count limits advisory only in actual GitHub Actions; no limit, baseline, or environment signal was altered. The full delegated changed-file gate is not claimed green. Fresh exact-head CI completed the remaining type/lint/architecture gates successfully under the repository’s existing GitHub Actions policy.The previously approved head
57b4fe6937481a66b6e0b52209ce731eb193d1e2passed CI, includingopenclaw/ci-gate; the rebased head passed exact-head CI, includingopenclaw/ci-gate(112 successful jobs).Earlier CI found two type-import cycles repaired in this PR, and an unrelated model-discovery fixture failure fixed upstream by #158115. No production model-catalog change is included.
Prior scoped proof:
Blacksmith Testbox
tbx_01m3bst4eh467kks5c3q5xb8km(lease workflow):pnpm build: passed in 576 seconds, including plugin assets, declarations, bootstrap import checks, and SDK generation.node scripts/run-vitest.mjscross-shard consumer selection: 15 files across five shards passed in 143 seconds, covering read authority, transcript lifecycle, secret targets, bundled plugin shape, and public runtime exports.pnpm test:extensions:batch discord: 298 files / 4,213 tests passed in 130 seconds.pnpm test:extensions:batch slack: 174 files / 3,152 tests passed in 118 seconds. Final hosted CI also passed the full Discord and Slack selections; the timing table below records changed-file test execution from that run.node scripts/check-changed.mjs: passed on replacement Testboxtbx_01m3bzgh6byb0cc7cbykkxk0nm(lease workflow), including production/test types, full extension/tooling lint (zero warnings/errors), dead exports, runtime import cycles, ratchets, storage and plugin boundaries. The original lease had completed before this last run could start.GOGC=30 GOMEMLIMIT=3GiB pnpm check:architecturecommand now passes, including Madge (zero cycles); independent review of this repair is scoped-clean through P2.tbx_01m3c3zzs8s0mc9t6n00dtxbpb(lease workflow): the full architecture command,node scripts/run-tsgo.mjs -p tsconfig.extensions.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/extensions.tsbuildinfo, and targetednode scripts/run-oxlint.mjs --tsconfig extensions/tsconfig.jsonover the ten changed repair files all passed.node scripts/run-vitest.mjs extensions/discord/src/internal/api.test.ts extensions/discord/src/internal/rest.test.ts extensions/discord/src/voice/manager.ready-listener.test.tspassed 3 files / 63 tests in 55.16 seconds. The combined frozen-install and proof payload completed in 841 seconds.Production change after the authorized rebase: 1,766 net lines removed; test/support change: 134 net lines removed. The assertion allowance ledger decreases by 28, confined to these plugins. No SDK export changes. All 180 production files over 200 lines were read during the scoped sweep, along with the smaller modules. All three deslop proof leases are stopped. The separate clean-main diagnosis used Blacksmith Testbox
tbx_01m3c688ds0hpwyba4t6cdm21t(lease workflow), which is also stopped.Standalone changed-test cost
Measured with
pnpm test <file> --maxWorkers=1on Testbox. Wall time includes runner startup; the new route-registry regression performs no I/O, polling, or sleeps. Other test changes update fixtures and preserve their existing assertions. CI test seconds below sum the verbose reporter’s per-test durations for each file on the previously approved head57b4fe69374; they exclude import/setup time and are not wall time.discord/src/actions/message-bodies.test.tsdiscord/src/actions/runtime.test.tsdiscord/src/internal/client.test.tsdiscord/src/internal/interactions.test.tsdiscord/src/monitor/listeners.thread-update.test.tsdiscord/src/monitor/provider.startup.test.tsdiscord/src/monitor/provider.test.tsslack/src/actions.download-file.test.tsslack/src/actions.read.test.tsslack/src/channel-type.test.tsslack/src/channel.outbound-preparation.test.tsslack/src/channel.test.tsslack/src/http/registry.test.tsslack/src/monitor/allow-list.test.tsslack/src/monitor/dm-auth.test.tsslack/src/monitor/events/interactions.test.tsslack/src/monitor/media.test.tsslack/src/monitor/message-handler/dispatch.preview-fallback.test.tsslack/src/monitor/message-handler/prepare.test.tsslack/src/monitor/provider.reconnect.test.tsslack/src/monitor/relay-source.test.tsslack/src/monitor/slash.test.tsslack/src/monitor/thread-history.test.tsslack/src/outbound-delivery.test.ts