Skip to content

refactor(slack): deslop Slack - #156773

Merged
steipete merged 1 commit into
mainfrom
deslop/l19-slack-owners-0923
Sep 23, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/l19-slack-owners-0923

Conversation

@steipete

@steipete steipete commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • Register paired Slack events through shared handlers while preserving event-specific routing and labels.
  • Share action context, send options, history result projection, and direct attachment-scope checks.
  • Let the streaming delivery owner construct native streams; reuse append settlement, identity encoding, and per-part send receipts.
  • Consolidate native-data fallback parsing and action-ID encoding onto existing renderers and descriptors.
  • Share media-download preparation, cache eviction, metadata coercion, and abort waiting through existing local or SDK helpers.
  • Reuse approval account selection, setup allowlist prompts, migration iteration, thread projection, and canonical Slack SDK types.
  • Remove private forwarding helpers and duplicate projections without changing tests. Shrink the assertion baseline by 28 removed casts; no allowance increases.

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).
  • Cross-area node scripts/run-vitest.mjs selection 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.
  • Clean merge-base and final candidate extension typechecks passed. Focused action/context replay: 2 files / 151 tests passed (183.64s wrapper wall). The explicit monitor context fields and validated placement union were retained after typechecking rejected their simplification; tests and ratchet enforcement remain intact.
  • 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 Testbox tbx_01m37x667hcf9q05m9z14zk4kw after 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
node scripts/run-vitest.mjs \
  test/slack-outbound-permanent-rejection-loopback.test.ts \
  test/slack-download-read-authority.integration.test.ts \
  test/channel-message-read-authority.integration.test.ts \
  test/cli-message-authority.integration.test.ts \
  extensions/qa-lab/src/live-transports/slack/slack-plugin.runtime.test.ts \
  src/channels/turn/message-turn-guardrails.test.ts \
  src/channels/message-access/context-builder-callers.test.ts \
  test/scripts/check-session-accessor-boundary.test.ts \
  test/scripts/lint-suppressions.test.ts

git diff --shortstat $(git merge-base origin/main HEAD) -- . \
  ':(exclude)**/*.test.*' ':(exclude)**/test/**' ':(exclude)docs/**'

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 registered message handler processes another user's DM through reply dispatch and sends hello 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.ts does 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 unchanged channel-migration.test.ts passed 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, branch deslop/l19-slack-owners-0923, head a3a611924380528fb1de6a60d48425d00078f4a1. 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.

  • Workshop service.test.ts: the Date-only fake clock is fixed at August 30 while worker-acquired leases use real time. CI logged TimeoutOverflowWarning for 2,150,840,661 ms; Node reduced that delay to 1 ms and the fixture lost its lease.
  • Compaction 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, head 56860aa2fd8f5a0b0398b8b3dfe6460172c88cf4, 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, and git range-diff reports the patch unchanged. The assertion baseline also incorporates disjoint upstream maintenance. Fresh exact-head CI run 35926546653 completed successfully on dd95ae614ba8730f31ab4e1dae81fd38450697fe (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.

@openclaw-barnacle openclaw-barnacle Bot added channel: slack Channel integration: slack size: XL labels Sep 23, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 23, 2026
@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 23, 2026, 6:31 PM ET / 22:31 UTC (Revision 4).

ClawSweeper review

What this changes

The 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
Reviewed head: dd95ae614ba8730f31ab4e1dae81fd38450697fe

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Broad but coherent Slack simplification with substantial reported boundary coverage, successful exact-head checks, and no supported blocking finding.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The changed Slack event, delivery, and streaming owners are covered by the PR's reported registered-handler tests and real Bolt transport against local endpoints; no real Slack-workspace result is claimed. The MEMBER-authored external-contributor proof gate does not apply. Source comparison and the four migration cases support compatibility with existing channel configuration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The changed Slack event, delivery, and streaming owners are covered by the PR's reported registered-handler tests and real Bolt transport against local endpoints; no real Slack-workspace result is claimed. The MEMBER-authored external-contributor proof gate does not apply. Source comparison and the four migration cases support compatibility with existing channel configuration.
Evidence reviewed 9 items Current-main necessity: The fetched main revision has no Slack source changes after the PR base; the branch's Slack cleanup remains absent from main.
Streaming owner: The introduced stream path delegates initial append to the existing append owner, which retains buffering, acknowledgement, stop, and failure handling.
Migration compatibility: The refactor still visits account channels before global channels and keeps the existing no-op and destination-conflict behavior; the event caller still previews and writes through the same config-mutation path.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -1264, Other -8. Total -1272 across 60 files.

View PR surface stats
Area Files Added Removed Net
Source 59 955 2219 -1264
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 7 15 -8
Total 60 962 2234 -1272

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: extensions/slack/src/channel-migration.ts, unknown-data-model-change: extensions/slack/src/channel-migration.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Technical review

Best 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.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is an internal cleanup with no intended user-visible change or demonstrated urgent regression.
  • merge-risk: 🚨 message-delivery: The refactor touches Slack event registration, native stream setup, and reply receipts, where a behavioral slip could affect delivered messages; the existing boundary suite covers the reviewed paths.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 changed Slack event, delivery, and streaming owners are covered by the PR's reported registered-handler tests and real Bolt transport against local endpoints; no real Slack-workspace result is claimed. The MEMBER-authored external-contributor proof gate does not apply. Source comparison and the four migration cases support compatibility with existing channel configuration.

Evidence

What I checked:

  • Current-main necessity: The fetched main revision has no Slack source changes after the PR base; the branch's Slack cleanup remains absent from main. (extensions/slack/src/streaming.ts:222, 4d1c5d19ecc8)
  • Streaming owner: The introduced stream path delegates initial append to the existing append owner, which retains buffering, acknowledgement, stop, and failure handling. (extensions/slack/src/streaming.ts:215, dd95ae614ba8)
  • Migration compatibility: The refactor still visits account channels before global channels and keeps the existing no-op and destination-conflict behavior; the event caller still previews and writes through the same config-mutation path. (extensions/slack/src/channel-migration.ts:65, dd95ae614ba8)
  • Migration contract tests: Four existing cases cover global and account channel IDs, case-insensitive account matching, and preservation of an existing destination; the PR body reports they passed on the tested candidate. (extensions/slack/src/channel-migration.test.ts:33, dd95ae614ba8)
  • Read-authority boundary: The file-download refactor still requires a matching channel or thread share before fetching media; media fetch retains an authority check immediately before network I/O. (extensions/slack/src/actions.ts:613, dd95ae614ba8)
  • Reported validation: The PR body reports 3,143 Slack tests, local Bolt transport and registered-handler coverage, a build, and successful exact-head CI. It expressly identifies the absence of a real Slack-workspace observation. (dd95ae614ba8)

Likely related people:

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

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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-23T21:32:52.207Z sha a3a611924380528fb1de6a60d48425d00078f4a1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-23T21:58:49.383Z sha a3a611924380528fb1de6a60d48425d00078f4a1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-23T22:16:16.586Z sha dd95ae6 :: blocked before merge. :: none

@steipete
steipete force-pushed the deslop/l19-slack-owners-0923 branch from a3a6119 to dd95ae6 Compare September 23, 2026 22:07
@clawsweeper clawsweeper Bot added 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 23, 2026
@steipete
steipete merged commit 0b07dbd into main Sep 23, 2026
193 checks passed
@steipete
steipete deleted the deslop/l19-slack-owners-0923 branch September 23, 2026 22:51
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 24, 2026
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
steipete added a commit that referenced this pull request Sep 25, 2026
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.
steipete added a commit that referenced this pull request Sep 25, 2026
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.
steipete added a commit that referenced this pull request Sep 25, 2026
* 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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 26, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: slack Channel integration: slack merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. 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