Repository navigation
refactor(slack): deslop Slack - #156773
Conversation
|
Codex review: needs maintainer review before merge. Reviewed September 23, 2026, 6:31 PM ET / 22:31 UTC (Revision 4). ClawSweeper reviewWhat this changesThe branch consolidates repeated Slack plugin event, action, approval, media, streaming, setup, and channel-migration logic without intending to change user-visible behavior. Merge readiness✅ Ready for maintainer review Keep open. Current main lacks this distinct Slack cleanup. Source comparison and the existing migration tests address the prior upgrade-compatibility question, and this review found no concrete blocking defect. Priority: P3 Review scores
Verification
How this fits togetherThe Slack plugin receives workspace events and agent actions, applies account authorization and conversation routing, then sends replies through Slack. Its channel-migration helper updates configured channel IDs when Slack reports an ID change. flowchart LR
A[Slack workspace events] --> B[Slack plugin ingress]
C[Account configuration] --> B
B --> D[Authorization and routing]
D --> E[Agent turns and actions]
E --> F[Slack delivery and streams]
F --> G[Slack workspace replies]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -1264, Other -8. Total -1272 across 60 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Retain the single-owner Slack helpers while preserving the registered event, delivery, authorization, and config-migration contracts demonstrated by the existing boundary coverage. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR reports a behavior-preserving refactor rather than a failing bug. Existing registered-handler and local transport tests provide preservation evidence. Is this the best way to solve the issue? Yes: the branch consolidates repeated logic inside the Slack plugin and its existing SDK helpers while keeping the observed routing, delivery, and config-migration contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4d1c5d19ecc8. 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 (3 earlier review cycles)
|
a3a6119 to
dd95ae6
Compare
|
Merged via squash.
|
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.
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.
* refactor(channels): deslop discord and slack second pass 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. * 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.
…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
Slack maintains repeated event registration, payload projection, native-stream setup, and small forwarding layers that make the same transport contracts harder to maintain. This is the maintainer-requested Slack subsystem deslop sweep.
User Impact
No user-visible behavior change. Socket and HTTP activation, bot/app/user token identities, authorization, human-reply draft boundaries, configuration, stored state, and public SDK exports are preserved.
Why This Change Was Made
Keep decisions with their existing owners and remove repeated translations around them:
Evidence
Verified Linux proof run, Blacksmith Testbox
tbx_01m37x667hcf9q05m9z14zk4kw: all 63 expected source hashes matched before checks, tests, and build.pnpm test:extensions:batch slack: 173 files / 3,143 tests passed (118.85s on Linux).node scripts/run-vitest.mjsselection below: 9 files / 204 tests passed across five shards (79.91s on Linux), including registered message, CLI, and attachment-read authority plus permanent-send rejection.pnpm build: passed on Linux (7m32s), including 95 plugin bundles, declarations, SDK export checks, and Control UI. The build reported a non-enforced Mermaid gzip-size warning (1,555.8 KiB versus 960 KiB); this branch changes no UI source.git diff --check: passed. Codex autoreview at P0–P2: scoped-clean with full owner context.node scripts/check-changed.mjs --base origin/main: passed on Blacksmith Testboxtbx_01m37x667hcf9q05m9z14zk4kwafter verifying all 63 source hashes. No checks or guards skipped.The production code removes 1,264 net lines. The campaign's exact measurement command reports
60 files changed, 969 insertions(+), 2241 deletions(-)(1,272 net), including eight lines removed from the shrink-only assertion baseline. Tests are unchanged. No SDK export or barrel moved, so the conditional SDK API-surface commands do not apply; the full build's SDK checks passed.Cross-area test selection and measurement
The initial guards required a documented error-data assertion and a shrink-only baseline refresh. Typechecking kept the explicit monitor context fields and placement union; the final candidate passes. A clean-base replay also reproduced the unrelated Vitest peer mismatch, so this branch rebased onto main’s existing fix 3d66eb5. The dead-export guard identified the private created-event alias made obsolete by the handler migration; it is deleted. The baseline only shrinks for Slack. The final native Blacksmith command completed with exit 0; its optional portal sync reported a timeout after completion.
Delivery boundaries and migration compatibility
The full Slack run above includes the existing registered-handler and delivery-owner tests, with no test changes:
monitor/provider.auth-test-token.test.ts: a registeredmessagehandler processes another user's DM through reply dispatch and sendshello back; the same handler drops a self-authored DM and leaves reply/send counts at one.monitor/provider.transport-credentials.test.ts: the real provider and Bolt transport start against local HTTP/WebSocket endpoints in socket, relay, and HTTP modes, resolving only each mode's active credentials.monitor/message-handler/dispatch.preview-fallback.test.ts: the real dispatch owner starts native progress before final text, appends completion after start, stops exactly once, and never duplicates the final through ordinary delivery.streaming.test.ts: the real SDK stream implementation flushes committed short replies and finalizes through mocked Web API methods; structured chunk and task-update paths are also covered.draft-stream.test.ts: after a human message interrupts an in-progress reply, the surviving owner creates a second card below the human message, edits only that card, and does not delete the earlier card.These are mock-Gateway, registered-handler, SDK, and local transport boundary proofs, not a real Slack-workspace observation. That live limitation remains explicit. This behavior-preserving cleanup changes no Slack API contract. The repository's maintainer/testing contract accepts covering isolated boundary proof; the bot's request for a real-workspace trace is not treated as an additional required gate without a concrete uncovered regression.
channel-migration.tsdoes not change any stored-data model or migration policy. It combines the existing account-then-global iteration and preserves the existing no-op/conflict checks. The unchangedchannel-migration.test.tspassed all four cases: global migration, account migration, case-insensitive account matching, and preserving an already-present destination. There are no SQLite/schema/version/config-shape changes or new operator migration steps.Exact-head CI investigation
The first exact-head CI run is 35922111983,
pull_request, branchdeslop/l19-slack-owners-0923, heada3a611924380528fb1de6a60d48425d00078f4a1. Slack checks passed; two core test shards failed. Neither failed fixture nor its core owners is changed by this branch. Both failures were independently reproduced on the already-merged control PR below, before this Slack run.service.test.ts: the Date-only fake clock is fixed at August 30 while worker-acquired leases use real time. CI loggedTimeoutOverflowWarningfor 2,150,840,661 ms; Node reduced that delay to 1 ms and the fixture lost its lease.compact.foreground-resources.test.ts: deferred factory-service disposal missed an unchanged 1,000 ms fixture deadline. The base already includes asynchronous task settlement before disposal; load sensitivity remains a hypothesis, not a claimed fix.Merged-PR controls were checked before judging base health: #156775 and #156750 were green. The already-merged #156760 independently failed with the same Workshop overflow/lease error in job 107378362947 and the same deferred factory-service disposal timeout in job 107378362761; the latter also failed the deferred-factory-signal sibling. That run was verified as
pull_request, head56860aa2fd8f5a0b0398b8b3dfe6460172c88cf4, before this Slack CI run.Main's owning fix 764c9331a31 removes the unnecessary Workshop fixture clock without weakening assertions or changing lease behavior. Its recorded proof includes the original 37-file Linux selector. This branch rebased onto that fix at
dd95ae614ba8730f31ab4e1dae81fd38450697fe. All 59 Slack production files are byte-identical to the fully tested/reviewed candidate, andgit range-diffreports the patch unchanged. The assertion baseline also incorporates disjoint upstream maintenance. Fresh exact-head CI run 35926546653 completed successfully ondd95ae614ba8730f31ab4e1dae81fd38450697fe(pull_request). The separate review workflow also completed successfully. No merge has been requested; this lane stops for coordinator review.A separate source-verified Linux A/B attempt did not execute tests: its first run had a generated-script syntax error, and its corrected run encountered a temporary baseline-worktree registration invalidated by native Testbox resync. These are harness failures, not passing or failing test evidence. The attempt was retired after the independent merged-PR control and landed Workshop owner proof established attribution; its Testbox lease was stopped. The initial compaction timeout remains disclosed, without claiming a green replay proves a fix.
No failed checks were rerun, weakened, or hidden, and no out-of-scope core files were edited.