fix(slack): bind this context for app.options() in slash command arg menus#19911
fix(slack): bind this context for app.options() in slash command arg menus#19911myra-tapcart wants to merge 1 commit intoopenclaw:mainfrom
this context for app.options() in slash command arg menus#19911Conversation
…arg menus The `registerArgOptions` helper in `registerSlackMonitorSlashCommands` destructures `ctx.app.options` into a local variable, which detaches the `this` binding from the Bolt `App` instance. When the detached function is invoked, `this` is `undefined`, causing: TypeError: Cannot read properties of undefined (reading 'listeners') This crashes the entire Slack channel provider on startup, entering a retry loop that never recovers. Fix: add `.bind(ctx.app)` to preserve the `this` context, consistent with how other Bolt methods (`ctx.app.action()`, `ctx.app.command()`, `ctx.app.view()`) are called directly on the app instance elsewhere in the same file. Fixes openclaw#19788
|
Confirmed on Nimbus (macOS, OpenClaw 2026.2.17): this exact failure signature is still reproducible pre-fix and matches the detached Observed in
I also validated locally that current Slack test coverage passes without exercising the |
) Fixes crash-loop: Cannot read properties of undefined (reading 'listeners') Upstream PR openclaw#19911 still open — applying locally until merged. Co-authored-by: Bob
|
The current version of Opanclaw crashes with Slack. Please add this fix asap. |
|
I tested this and this fix resolves the reported issue 👍 |
|
This needs to be merged in soon. Still broken on the newest version |
|
This pull request has been automatically marked as stale due to inactivity. |
Problem
Since v2026.2.17, the Slack channel provider crashes immediately on startup with:
The provider enters a 1/10 → 10/10 crash loop and never recovers. Slack is completely non-functional.
Root Cause
registerSlackMonitorSlashCommands→registerArgOptions()destructuresctx.app.optionsinto a local variable:Bolt's
App.options()pushes tothis.listeners, butthisisundefinedbecause the method was called without its receiver.Other Bolt methods in the same file (
ctx.app.action(),ctx.app.command(),ctx.app.view()) are called directly on the app instance and work fine. Onlyoptionswas destructured.Fix
One-line fix. Preserves
thisbinding. The optional chain (?.) keeps the existing guard for environments whereoptionsmay not exist.Stack Trace
Verification
Patched the bundled dist on a live 2026.2.17 instance. Before: crash loop. After:
slack socket mode connected— full inbound/outbound working.Affected Versions
Fixes #19788
Ref: #8404
Greptile Summary
One-line fix for a critical crash-loop in the Slack channel provider introduced in v2026.2.17. The
App.options()method from@slack/boltwas destructured into a local variable, detaching it from itsthiscontext. Since Bolt'sApp.options()internally accessesthis.listeners, calling the detached method throwsCannot read properties of undefined (reading 'listeners'), crashing the provider on startup..bind(ctx.app)when extractingoptionsfrom the Bolt app instance, preserving the method'sthiscontext?.optional chain is retained so environments whereoptionsdoesn't exist continue to work via the existingtypeof optionsHandler !== "function"guardctx.app.command(),ctx.app.action()) are called directly on the instance and were unaffectedConfidence Score: 5/5
this-binding issue. The root cause and solution are clear, the author verified it on a live instance, and the change has no side effects on surrounding code. No new logic or risk is introduced.Last reviewed commit: cf31361
(2/5) Greptile learns from your feedback when you react with thumbs up/down!