Skip to content

refactor(channels): deslop Slack and Matrix - #163740

Merged
steipete merged 2 commits into
mainfrom
deslop/l304-deslop-slack-matrix-20261002
Oct 2, 2026
Merged

steipete merged 2 commits into
mainfrom
deslop/l304-deslop-slack-matrix-20261002

Conversation

@steipete

@steipete steipete commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

This maintainer-requested batch addresses duplicated Slack and Matrix runtime contracts, forwarding paths, and migration-only code predating the supported July configuration shapes. This batch removes 1,103 net production lines without moving code elsewhere.

User Impact

July 2026+ configuration, persisted data, wire payloads, model-facing descriptions, and visible UI remain unchanged. Matrix pairing cooldown state now stays bounded when every request is newly created, and the public compatibility chunker terminates for nonpositive limits.

Why This Change Was Made

  • Matrix recovery-key verification uses one settlement/result owner while preserving cached-key versus newly committed-key diagnostics. Identity trust shares one cleanup path; unused verification wrappers and legacy-state projections are removed.
  • Matrix startup verification and room metadata caches share their existing state and cache owners. Nullable configuration updates share one writer while retaining omission, explicit clears, normalization and cloning.
  • Matrix poll aggregation consumes its already parsed input; reaction bindings have one ordered descriptor; action and approval adapters drop redundant forwarding.
  • Slack uses SDK-owned types, one setup proxy/base, one channel-policy decision, one chat classification for routing, and parsed interaction targets. Runtime streaming consumes canonical validated configuration; Doctor streaming migration and visible help remain intact.
  • Retire Matrix trusted-DM, flat private-network and room-allow migrations, plus Slack channel-allow migration. These shapes were already retired before July; supported July+ migrations remain. The existing Doctor retirement detector refuses these inputs before backup/include recovery and names the intermediate upgrade, preserving the authored files.

Fixes found along the way

  • Newly created Matrix pairing requests bypassed the 512-sender cooldown map cap. Both new and reminder writes now use the existing bounded-map owner; the regression exercises eviction and retained cooldown through the real handler.
  • Matrix's public compatibility chunker loop never advanced at zero/negative limits. It now returns the original text, preserving whitespace and matching the shared chunker's disabled-limit behavior.

Evidence

  • Linux, Node 24.21.0, pnpm 12.5.1, frozen lockfile. Verified base commit and SHA-256 of all 61 changed files before execution.
  • Full node scripts/check-changed.mjs --base d20ba7392c1de16a0eb9dab79336ade5ebf996a3 passed, including typechecks, lint, Doctor closure checks, all structural ratchets, and zero unused exports.
  • Both import-cycle gates passed with zero cycles.
  • 973 focused Slack/Matrix tests and all 1,132 plugin-contract tests passed. The original 12 changed test files also passed individual pnpm test <file> --maxWorkers=1 runs.
  • Original-code reproductions ran on macOS: the pairing regression failed on original code (expected 514 sends, observed 513), then passed on the candidate. The exact original public chunker entered its zero-limit call and did not return; the candidate returned unchanged text.
  • Independent review completed; no accepted/actionable findings remain. The original-state path and crypto binding cleanup were checked directly when review raised false positives.
  • Full Linux pnpm build passed (13m 0.7s), including plugin SDK export and CLI bootstrap guards. The Slack/Matrix dependency audit passed with no unused dependencies.
  • Isolated Slack and Matrix imports completed and their child process groups were cleaned up. The memory snapshot is intentionally reported as unqualified because the proof used an uncommitted, source-hash-verified candidate; no memory comparison is claimed.
  • The initial hosted CI run passed on b61119eba245d9d687db5c25108b8eb26a1b4104: https://github.com/openclaw/openclaw/actions/runs/37055017214. That review identified a missing retirement guard; the follow-up adds the guard and real Doctor include/backup preservation coverage. The correction independently reviewed clean at P0/P1. Its two new retirement cases failed with the original detector; all 15 candidate Doctor include/backup cases passed, preserving root, include and backup bytes. OpenClaw 2026.9.5 was checked to contain every named intermediary transform. The correction passed its changed-file gate (all 27 core test type graphs, lint, dead exports, and ratchets), both zero-cycle gates, the Doctor preflight/Slack/Matrix tests, and all plugin-contract tests. Final-head CI passed on e2890be6a6569991fea73777fb2510e302943f5c: https://github.com/openclaw/openclaw/actions/runs/37062141593. ClawSweeper revision 2 reviewed that head with no actionable findings and confirmed the prior Doctor issue resolved.
Measured changed-test wall times

These one-worker Linux measurements include test-process, transform, import, and compiled-worker setup. No new process boots, real timers, sleeps, or polling were added. The new pairing case itself took 44 ms; each new chunk-limit case took 5 ms. Long wall times in the existing handler/outbound suites are dominated by their pre-existing worker/import preparation (76–92% transform in the cold runs), not the new assertions. The added Matrix/Slack refusal cases took 1.172 s and 0.670 s; their canonical control took 12.874 s through the real Doctor flow. This protects include and backup preservation before repair, which a detector-only unit test cannot establish. The first hosted CI run completed in 458 s; the final-head run completed in 559 s.

Test file Wall time
extensions/matrix/src/doctor.test.ts 5.76 s
extensions/matrix/src/matrix/monitor/handler.pairing.test.ts 81.41 s
extensions/matrix/src/matrix/poll-types.test.ts 4.30 s
extensions/matrix/src/outbound.test.ts 41.55 s
extensions/slack/src/accounts.test.ts 5.54 s
extensions/slack/src/doctor.test.ts 4.35 s
extensions/slack/src/monitor/message-handler/prepare.route-owner-admission.test.ts 82.31 s
extensions/slack/src/monitor/message-handler/prepare.thread-session-key.test.ts 44.98 s
extensions/slack/src/monitor/slash.test.ts 61.43 s
extensions/slack/src/shared.test.ts 40.41 s
extensions/slack/src/stream-mode.test.ts 3.35 s
src/plugins/contracts/plugin-sdk-runtime-api-guardrails.test.ts 33.89 s
src/commands/doctor-config-flow.include-refusal.test.ts 69.26 s

Consolidate channel policy, routing and metadata handling with their existing
owners; unify Matrix recovery-key settlement and remove redundant wrappers,
types and state projections. Retire configuration migrations for shapes that
were already obsolete before July while preserving supported configuration,
persisted data, wire payloads, tool descriptions and visible UI.

Bound newly created Matrix pairing cooldown records to the existing sender
cap, and make the public compatibility chunker terminate for nonpositive
limits. Regression proof demonstrates both original failures. Shrink the
assertion-safety ratchet after removing ten unsafe casts.
@clawsweeper

clawsweeper Bot commented Oct 2, 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: matrix Channel integration: matrix channel: slack Channel integration: slack size: XL labels Oct 2, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 2, 2026, 5:01 PM ET / 21:01 UTC (Revision 3).

ClawSweeper review

What this changes

The branch consolidates Slack and Matrix handling, retires older configuration migrations with recovery guidance, bounds Matrix pairing cooldown records, and fixes chunking with nonpositive limits.

Merge readiness

✅ Ready for maintainer review

The PR remains useful: current main and the latest release retain the two reported Matrix defects. The earlier Doctor blocker is resolved, and this review found no actionable introduced defect.

Priority: P2
Reviewed head: e2890be6a6569991fea73777fb2510e302943f5c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent maintenance patch with resolved prior feedback, meaningful regressions, and successful final-head CI.
Proof confidence 🌊 off-meta tidepool Not applicable: The verified repository-admin author is exempt from ordinary contributor proof, and the inspected refactors do not materially expand authority. Stored-state layouts remain unchanged; real Doctor preflight coverage and reported passing runs establish refusal preservation and canonical-config compatibility.
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 ordinary contributor proof, and the inspected refactors do not materially expand authority. Stored-state layouts remain unchanged; real Doctor preflight coverage and reported passing runs establish refusal preservation and canonical-config compatibility.
Evidence reviewed 9 items Introduced patch and review continuity: Reviewed the pinned merge-base-to-head hunks across Slack, Matrix, Doctor, documentation, and contract tests. The follow-up changes the retirement detector and preservation coverage, resolving the earlier Doctor finding. The supplied test merge is stale and was not used to infer removal of main-branch behavior.
Current main still needs the fixes: Current main's public chunker lacks the nonpositive-limit guard, and newly created pairing requests still bypass cooldown-map eviction.
Latest release remains affected: The v2026.9.7 source retains the chunker loop without a disabled-limit guard. Its pairing handler also retains the unbounded newly-created-request branch.
Findings None None.
Security None None.

How this fits together

Slack and Matrix plugins translate channel events and configuration into OpenClaw agent sessions, approvals, and outbound messages. Doctor prepares older configuration before those plugins start.

flowchart TD
  A[Channel configuration] --> B[Doctor compatibility checks]
  B --> C[Slack and Matrix plugins]
  B --> D[Intermediate upgrade guidance]
  E[Messages and interactions] --> C
  C --> F[Agent sessions and approvals]
  F --> G[Channel replies]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -1103, Tests -202, Docs +3, Other -1. Total -1303 across 64 files.

View PR surface stats
Area Files Added Removed Net
Source 49 590 1693 -1103
Tests 13 200 402 -202
Docs 1 3 0 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 1 4 5 -1
Total 64 797 2100 -1303

Review metrics

Metric Value Why it matters
Configuration retirement 4 legacy setting families; 0 new settings Older inputs now receive an intermediate-upgrade refusal before Doctor can rewrite their files.

Stored data model

Persistent data-model change detected: durable storage schema: extensions/matrix/src/matrix/client/storage.ts, migration/backfill/repair: extensions/matrix/src/doctor-contract.ts, migration/backfill/repair: extensions/matrix/src/matrix/crypto-state-store.ts, migration/backfill/repair: extensions/slack/src/doctor-contract.ts, serialized state: extensions/matrix/src/matrix/client/storage.ts, unknown-data-model-change: extensions/matrix/src/doctor-contract.ts, and 2 more. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Technical review

Best possible solution:

Keep canonical channel behavior under its existing owners, with safe refusal and intermediate-upgrade guidance for retired configuration.

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

Yes, from source: current main and v2026.9.7 show the nonadvancing chunker loop and the pairing branch that bypasses eviction. This reviewer did not execute either path.

Is this the best way to solve the issue?

Yes. The changes consolidate existing owners, preserve supported contracts, and guard retired inputs before destructive recovery; no competing implementation or introduced correctness defect was found.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is bounded channel maintenance with two source-established edge-case fixes.
  • merge-risk: 🚨 compatibility: Retired Matrix and Slack inputs require upgrading through 2026.9.5; this documented admin-authored tradeoff is covered by preservation and canonical-admission evidence.
  • 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 ordinary contributor proof, and the inspected refactors do not materially expand authority. Stored-state layouts remain unchanged; real Doctor preflight coverage and reported passing runs establish refusal preservation and canonical-config compatibility.

Evidence

What I checked:

  • Introduced patch and review continuity: Reviewed the pinned merge-base-to-head hunks across Slack, Matrix, Doctor, documentation, and contract tests. The follow-up changes the retirement detector and preservation coverage, resolving the earlier Doctor finding. The supplied test merge is stale and was not used to infer removal of main-branch behavior. (e2890be6a656)
  • Current main still needs the fixes: Current main's public chunker lacks the nonpositive-limit guard, and newly created pairing requests still bypass cooldown-map eviction. (extensions/matrix/src/matrix/monitor/handler-state.ts:118, cb450bced528)
  • Latest release remains affected: The v2026.9.7 source retains the chunker loop without a disabled-limit guard. Its pairing handler also retains the unbounded newly-created-request branch. (extensions/matrix/runtime-api.ts:60, c074824a27c9)
  • Retirement policy and accepted operator impact: The existing retention policy permits pre-July formats to retire only with an intermediate-release refusal and preserved data. The admin-authored PR explicitly adopts that path: affected older setups must run Doctor on 2026.9.5 before upgrading; supported canonical settings remain eligible. Public docs: docs/gateway/doctor/config-migrations.md. (docs/gateway/doctor/config-migrations.md:33, e2890be6a656)
  • Upgrade preservation coverage: The inspected tests exercise the real Doctor preflight with root configuration, included channel configuration, and an existing backup. They assert refusal before mutation, byte preservation of all three files, and successful admission of canonical Matrix and Slack settings. The captured body reports these cases passed after failing against the original detector. (src/commands/doctor-config-flow.include-refusal.test.ts:108, e2890be6a656)
  • Authorization and persistence equivalence: Slack slash commands retain monitor-owned channel admission before command dispatch. Matrix HTTP requests retain captured request authority and send-currentness callbacks; the transport still checks them before network dispatch. Inspected storage refactors preserve namespaces, row layouts, versions, and migration/archive ordering. (extensions/matrix/src/matrix/sdk/http-client.ts:35, e2890be6a656)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: 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 (2 earlier review cycles)
  • reviewed 2026-10-02T19:40:51.437Z sha b61119e :: blocked before merge. :: [P1] Refuse retired channel inputs before removing their migrations
  • reviewed 2026-10-02T20:47:23.537Z sha e2890be :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime commands Command implementations labels Oct 2, 2026
@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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 2, 2026
@steipete
steipete merged commit 887c62b into main Oct 2, 2026
156 of 159 checks passed
@steipete
steipete deleted the deslop/l304-deslop-slack-matrix-20261002 branch October 2, 2026 21:08
@steipete

steipete commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Oct 2, 2026
* commit '79be075e5aa46be9e42dbd53ed6e30e81469210a': (33 commits)
  fix(ui): keep selected-text comment input readable while scrolling (#163772)
  test(memory): open corpus database explicitly
  fix: bound Doctor migration capture to plugin data (#163780)
  fix(ui): gate system information at the shared reader (#160982)
  chore(db): reclassify worker inventory sites with caller evidence (#163754)
  refactor(channels): deslop Slack and Matrix (#163740)
  fix(agents): reject empty sessions_search queries in the tool schema (#129120)
  perf(nodes): load only what a worker turn needs (#160442)
  test(cli): assert concise Gateway failure copy in CLI process tests (#163649)
  refactor(discord): deslop discord (#163728)
  fix(workboard): make Sessions boards work on multi-agent Gateways (#163761)
  test(gateway): add sustained heap retention diagnostics (#163764)
  test(ui): disambiguate session filter controls
  refactor(plugins): deslop imessage, mattermost, and voice-call (#163767)
  fix(qa): run Telegram plugin source in --source-gateway userbot runs (#163718)
  feat(macos): add a --no-activate launch flag for background automation (#163758)
  fix(agents): preserve host authority across module reloads (#163725)
  perf(gateway): serve the listener before multi-gigabyte store validation and honor clean-close receipts at startup (#163690)
  fix: keep video widgets scrollable and preload initial frames (#163762)
  feat(memory): add a provider-neutral memory provider runtime (#162175)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 3, 2026
* refactor(channels): deslop Slack and Matrix

Consolidate channel policy, routing and metadata handling with their existing
owners; unify Matrix recovery-key settlement and remove redundant wrappers,
types and state projections. Retire configuration migrations for shapes that
were already obsolete before July while preserving supported configuration,
persisted data, wire payloads, tool descriptions and visible UI.

Bound newly created Matrix pairing cooldown records to the existing sender
cap, and make the public compatibility chunker terminate for nonpositive
limits. Regression proof demonstrates both original failures. Shrink the
assertion-safety ratchet after removing ten unsafe casts.

* fix(doctor): guard retired Slack and Matrix config
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Oct 3, 2026
* commit '1fda703fb4d3630e4633461967b2a2186e8f15fd': (33 commits)
  fix(ui): keep selected-text comment input readable while scrolling (openclaw#163772)
  test(memory): open corpus database explicitly
  fix: bound Doctor migration capture to plugin data (openclaw#163780)
  fix(ui): gate system information at the shared reader (openclaw#160982)
  chore(db): reclassify worker inventory sites with caller evidence (openclaw#163754)
  refactor(channels): deslop Slack and Matrix (openclaw#163740)
  fix(agents): reject empty sessions_search queries in the tool schema (openclaw#129120)
  perf(nodes): load only what a worker turn needs (openclaw#160442)
  test(cli): assert concise Gateway failure copy in CLI process tests (openclaw#163649)
  refactor(discord): deslop discord (openclaw#163728)
  fix(workboard): make Sessions boards work on multi-agent Gateways (openclaw#163761)
  test(gateway): add sustained heap retention diagnostics (openclaw#163764)
  test(ui): disambiguate session filter controls
  refactor(plugins): deslop imessage, mattermost, and voice-call (openclaw#163767)
  fix(qa): run Telegram plugin source in --source-gateway userbot runs (openclaw#163718)
  feat(macos): add a --no-activate launch flag for background automation (openclaw#163758)
  fix(agents): preserve host authority across module reloads (openclaw#163725)
  perf(gateway): serve the listener before multi-gigabyte store validation and honor clean-close receipts at startup (openclaw#163690)
  fix: keep video widgets scrollable and preload initial frames (openclaw#163762)
  feat(memory): add a provider-neutral memory provider runtime (openclaw#162175)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: matrix Channel integration: matrix channel: slack Channel integration: slack commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. 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