Skip to content

fix(slack): require an acknowledgement sender for envelope guards - #150656

Merged
steipete merged 1 commit into
mainfrom
upd/redmain-slack-envelope-guard
Sep 17, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/redmain-slack-envelope-guard

Conversation

@steipete

@steipete steipete commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Related: #150608, #150630

What Problem This Solves

Completes the Socket Mode envelope-guard construction repair for the regression introduced by #150608, originally observed in run 35184520594. Main now contains the shared-fixture and RawData fixes; this PR makes acknowledgement an explicit guard dependency and covers the remaining receiver construction fixture.

User Impact

Preserves acknowledgement of event-less Slack envelopes and continued normal message delivery. No operator action or configuration migration is needed. The installed SDK already supplies the sender; no missing-sender production path was found.

Why This Change Was Made

The guard now requires a typed acknowledgement callback. Receiver construction validates and binds Slack's real sender, retaining SDK ownership of acknowledgement serialization and transport. Slack's declarations hide the private sender's signature, so that dependency check remains explicit at construction. The interop fixture now supplies a client, sender, and listener registry instead of bypassing guard installation.

The rebase preserves #150406's event contracts derived from upstream Slack types. It also retains #149291's shared EventEmitter/sender fixture and explicit ArrayBuffer narrowing for RawData. Those main changes absorb the original overlap with #150630; this PR follows up #150608 by @pash-openai.

Review: the lead review pr-150656-autoreview.md is scoped-clean on d431b50f64ad0e8075835a85e59df24f0766a06a, with the sender contract checked against @slack/socket-mode 3.0.1. The subsequent rebase is patch-identical (git range-diff reports =), preserving that reviewed change without another semantic resolution.

Evidence

Before the original repair, reproduced TS2769 at provider.interop.test.ts:508:81 and the exact Slack baseline: 87 failed / 2,975 passed / 85 unhandled errors.

Reviewed and locally tested candidate: d431b50f64ad0e8075835a85e59df24f0766a06a, on main 8f463a22fce001fdf43e385a6a800c5afb42c84a. Current head: 936e06b4b2e06f5d6ee57739168972e028868278, rebased onto main a3bea6a8e38652729bfc32bbfde4124a911f6eb4. Range-diff: d431b50f64a = 936e06b4b2e. Frozen-lockfile installation passed again without dependency changes; a fresh exact-head CI run follows the new base.

  • pnpm install --frozen-lockfile: passed; no dependency changes.
  • Full pnpm check:test-types: passed.
  • pnpm test extensions/slack: 3,063 passed across 165 files, no unhandled errors.
  • Explicit single-worker startup test: 1 selected test passed.
  • Fresh worker autoreview (--mode branch --base origin/main --max-priority P1): scoped-clean. Artifact: rebase-1/autoreview-branch.log; the separate lead review is also scoped-clean as recorded above.

The original single-worker repeat observed candidate flake 58: “starts an org-wide Socket Mode account with its bot identity when auth.test omits app_id” missed a default one-second polling deadline for appStartMock. The test now awaits the mock's actual start signal and retains the exact one-call assertion. No configured timeout changed, and the construction repair adds no awaited startup work.

pnpm check:changed passed every step before extension lint, which hit the documented nested-checkout declaration-input error. The authorized direct oxlint substitute was checked with a temporary violation and exact restoration:

socket-mode-envelope.ts:57:7: eslint(no-unused-vars):
Variable 'l548LintCanary' is declared but never used.
canary exit=1
restored files exit=0

All four remaining database-store, media-download, runtime-sidecar, and import-cycle guards passed (exit 0); the import-cycle scan found zero runtime value cycles. CI's extension lint remains the authority for this host-specific substitution.

Production: +18 / -15 lines (net +3). Tests: +9 / -2 lines (net +7). No tests were disabled or assertions weakened. Proof uses isolated local state and loopback sockets, not authenticated Slack.

The previous exact-head run 35189702655 passed test types and the Slack extension shard. Its only failure was package-boundary compilation of the codex plugin exceeding the 120-second deadline (120,849 ms observed), tracked separately as candidate flake 59. That job was not rerun.

@clawsweeper

clawsweeper Bot commented Sep 17, 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 the channel: slack Channel integration: slack label Sep 17, 2026
@steipete
steipete marked this pull request as ready for review September 17, 2026 05:58
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Sep 17, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Sep 17, 2026
@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 17, 2026, 2:47 AM ET / 06:47 UTC (Revision 3).

ClawSweeper review

What this changes

The PR makes Slack envelope acknowledgements an explicit receiver-construction dependency, completes the receiver fixture, and replaces startup-test polling with an explicit signal.

Merge readiness

✅ Ready for maintainer review

This remains a useful, bounded follow-up to the merged Slack crash fix; current main has not absorbed the remaining work. No blocking correctness or security findings were identified.

Priority: P2
Reviewed head: 936e06b4b2e06f5d6ee57739168972e028868278

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-consistent repair with relevant real-transport coverage and no actionable findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The reported Slack run covers the production receiver and real SDK client over loopback sockets, observing control-envelope acknowledgements and exactly one subsequent ordinary event. All four touched files match the tested revision; this proves the internal transport contract without claiming authenticated Slack coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The reported Slack run covers the production receiver and real SDK client over loopback sockets, observing control-envelope acknowledgements and exactly one subsequent ordinary event. All four touched files match the tested revision; this proves the internal transport contract without claiming authenticated Slack coverage.
Evidence reviewed 8 items Verified introduced change: The merge-base-to-head diff matches the four supplied introduced files. Receiver construction binds the existing SDK sender; the guard retains ordinary dispatch and catches acknowledgement rejection. The helper has one production caller and remains private to the Slack plugin.
Remaining work is absent on main: Fetched main still discovers the sender inside the guard and silently returns when a receiver has no client. Its construction fixture still lacks a client. The guard file is absent from the supplied latest release, v2026.9.4; the September guard work is newer.
Release boundary: The guard path is not present in v2026.9.4. This does not establish a released production regression from the remaining construction repair.
Findings None None.
Security None None.

How this fits together

The Slack plugin receives Socket Mode envelopes before Bolt dispatches events into OpenClaw. Its guard acknowledges event-less control notifications through Slack’s SDK while ordinary messages continue through the existing delivery path.

flowchart TD
  A[Slack Socket Mode connection] --> B[Envelope guard]
  B --> C{Event type present?}
  C -->|No| D[Warning and SDK acknowledgement]
  C -->|Yes| E[Bolt event dispatch]
  E --> F[OpenClaw durable ingress]
  D --> A
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +3, Tests +7. Total +10 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 18 15 +3
Tests 2 9 2 +7
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 27 17 +10

Review metrics

None.

Technical review

Best possible solution:

Keep one SDK-owned acknowledgement path with an explicit construction contract and real-transport coverage for control envelopes and continued ordinary delivery.

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

Not applicable to the remaining internal contract repair: the original crash protection already exists on main, and real-SDK loopback cases define the acknowledgement behavior being preserved.

Is this the best way to solve the issue?

Yes. Moving sender validation to receiver construction preserves SDK ownership, removes the fixture bypass, and introduces no public plugin API or configuration change.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded Slack construction-contract and validation improvement with no demonstrated remaining production outage.
  • 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. Sufficient (terminal): The reported Slack run covers the production receiver and real SDK client over loopback sockets, observing control-envelope acknowledgements and exactly one subsequent ordinary event. All four touched files match the tested revision; this proves the internal transport contract without claiming authenticated Slack coverage.
  • proof: sufficient: Contributor real behavior proof is sufficient. The reported Slack run covers the production receiver and real SDK client over loopback sockets, observing control-envelope acknowledgements and exactly one subsequent ordinary event. All four touched files match the tested revision; this proves the internal transport contract without claiming authenticated Slack coverage.

Evidence

What I checked:

  • Verified introduced change: The merge-base-to-head diff matches the four supplied introduced files. Receiver construction binds the existing SDK sender; the guard retains ordinary dispatch and catches acknowledgement rejection. The helper has one production caller and remains private to the Slack plugin. (extensions/slack/src/monitor/provider-support.ts:365, 936e06b4b2e0)
  • Remaining work is absent on main: Fetched main still discovers the sender inside the guard and silently returns when a receiver has no client. Its construction fixture still lacks a client. The guard file is absent from the supplied latest release, v2026.9.4; the September guard work is newer. (extensions/slack/src/monitor/socket-mode-envelope.ts:7, 8b9739cc48c0)
  • Release boundary: The guard path is not present in v2026.9.4. This does not establish a released production regression from the remaining construction repair. (extensions/slack/src/monitor/socket-mode-envelope.ts, 3a9d69db306c)
  • Pinned acknowledgement contract: The patch directly depends on Socket Mode 3.0.1. npm metadata identifies this repository and revision. Its receive handler accepts string or ArrayBuffer, and send(id, body = {}) returns a Promise, checks the current socket, serializes the envelope, and performs the write. The proposed callback preserves that owner and contract. (packages/socket-mode/src/SocketModeClient.ts:404, e0fa7455eedf)
  • Receiver construction compatibility: npm metadata identifies Bolt 5.1.0 with this repository and revision. SocketModeReceiver declares a required client and constructs SocketModeClient synchronously, so removing the missing-client bypass does not remove a supported production setup. (src/receivers/SocketModeReceiver.ts:125, ffbe0b6c03a6)
  • Real transport coverage and reported execution: The existing loopback cases construct the production receiver with real Bolt and Socket Mode clients, inject rate-limit and incomplete envelopes, observe control and message acknowledgements, and require exactly one subsequent ordinary event on one connection. The captured PR body reports 3,063 passing Slack tests without unhandled errors on d431b50f64ad0e8075835a85e59df24f0766a06a. This reviewer inspected the cases but did not execute tests. (extensions/slack/src/monitor/provider.interop.test.ts:490, 936e06b4b2e0)

Likely related people:

  • pash-openai: Raw commit 179982f adds extensions/slack/src/monitor/socket-mode-envelope.ts:28 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 179982f31fc6; files: extensions/slack/src/monitor/socket-mode-envelope.ts)
  • steipete: 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-09-17T06:07:47.228Z sha 067f2b0 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-17T06:33:19.035Z sha d431b50f64ad0e8075835a85e59df24f0766a06a :: needs maintainer review before merge. :: none

Require a typed acknowledgement callback and bind Slack's checked private
sender at receiver construction. Complete the Socket Mode fixtures and decode
ws RawData without an ambiguous Buffer.from overload.

Await the Enterprise startup fixture's actual start signal instead of polling
its mock under a one-second deadline, retaining the exact call-count assertion.

Follow up #150608 by @pash-openai while preserving its protection against
event-less Events API envelopes. No operator configuration or migration changes.
@steipete
steipete force-pushed the upd/redmain-slack-envelope-guard branch from d431b50 to 936e06b Compare September 17, 2026 06:40
@steipete
steipete merged commit d768ad2 into main Sep 17, 2026
95 of 96 checks passed
@steipete
steipete deleted the upd/redmain-slack-envelope-guard branch September 17, 2026 07:05
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 17, 2026
Derive compiler concurrency and native worker shares from available CPUs, then schedule larger plugin implementations first. Compile Codex from its packaged entrypoints while preserving the production closure and excluding test-only roots.

Related: #150656
steipete added a commit that referenced this pull request Sep 17, 2026
Prevent extension package-boundary checks from timing out when CI requests more compiler concurrency than the available CPUs can support. Bound compiler processes and native worker shares by CPU capacity, and schedule larger plugin implementations first.

Derive temporary compiler projects from the canonical packaged-source inventory, declared exports/main targets, and ambient declarations while preserving shared tsconfig inheritance, package roots, and SDK aliases. Bind root-selection metadata to the existing compiler receipts. The 120-second per-plugin deadline remains unchanged; no runtime behavior or operator-state migration changes.

Validation: all 124 plugins compiled in three candidate Linux trials; Codex took 3.972–5.573 seconds. The recorded owner suite passed 19 tests, plugin contracts passed 47 files / 1,132 tests, and changed-file checks passed. Exact-head PR CI was green on run 35208148229. The scoped autoreview found no accepted/actionable findings.

Related: #150656
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
…enclaw#150656)

Complete the Slack Socket Mode envelope-guard construction repair following openclaw#150608 by @pash-openai. Require an explicit acknowledgement callback and bind the SDK sender during receiver construction, preserving SDK ownership of serialization and transport, event-less envelope acknowledgements, and continued ordinary message delivery.

Complete the receiver fixture and await the Enterprise startup fixture's actual start signal while retaining the exact call-count assertion. No operator action, configuration change, or migration is required.

Validation: 3,063 Slack tests across 165 files and full test typechecking passed on the patch-identical reviewed revision. Exact-head CI run 35190855262 is green; the scoped-clean review and exact-head ClawSweeper review have no actionable findings. Transport proof uses the real Slack SDK over isolated loopback sockets.

Related: openclaw#150608, openclaw#150630
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
…50721)

Prevent extension package-boundary checks from timing out when CI requests more compiler concurrency than the available CPUs can support. Bound compiler processes and native worker shares by CPU capacity, and schedule larger plugin implementations first.

Derive temporary compiler projects from the canonical packaged-source inventory, declared exports/main targets, and ambient declarations while preserving shared tsconfig inheritance, package roots, and SDK aliases. Bind root-selection metadata to the existing compiler receipts. The 120-second per-plugin deadline remains unchanged; no runtime behavior or operator-state migration changes.

Validation: all 124 plugins compiled in three candidate Linux trials; Codex took 3.972–5.573 seconds. The recorded owner suite passed 19 tests, plugin contracts passed 47 files / 1,132 tests, and changed-file checks passed. Exact-head PR CI was green on run 35208148229. The scoped autoreview found no accepted/actionable findings.

Related: openclaw#150656
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: slack Channel integration: slack maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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