Skip to content

v0.3.0 — fix Slack socket created inside the host invocation context

Choose a tag to compare

@0xCVH 0xCVH released this 01 Aug 18:51

Fixes all Slack chat failing with the worker referenced a missing, expired, or unknown invocation scope.

The bug (introduced in 0.2.0). Node's AsyncLocalStorage propagates into sockets created inside it — every later callback from that socket runs in the captured store. The plugin SDK wraps host→worker calls that carry an invocation (like configChanged) in that storage, and echoes the current store's invocation id on every worker→host call. 0.2.0 moved Bolt gateway creation out of setup() and into onConfigChanged, so the Slack WebSocket was created inside the configChanged invocation context. Every subsequent Slack event echoed the id of an invocation the host had long since completed, and the host denied the call.

The fix. Config applies now run on a pump loop started in setup(), whose continuations execute in the clean context — so the socket is created outside any invocation. onConfigChanged enqueues and returns a promise that resolves once the config is applied. A regression test asserts, using real AsyncLocalStorage, that the gateway is constructed with an undefined store.

Also: a first-time configuration no longer needs a plugin restart.

142 tests.

🤖 Generated with Claude Code