NemoClaw icon indicating copy to clipboard operation
NemoClaw copied to clipboard

Slack channel: bolt-app event_callback fails because gateway proxy denies HTTP CONNECT

Open AriOliv opened this issue 6 months ago • 4 comments

Summary

The Slack channel (added via nemoclaw <sandbox> channels add slack) consistently fails to handle incoming events. The NemoClaw gateway HTTP proxy rejects the CONNECT method, while @slack/bolt (via @slack/web-api and Node 22's bundled undici) issues CONNECT to tunnel HTTPS whenever HTTPS_PROXY is set in the sandbox environment. There appears to be no configuration path that makes this work today.

Direct GET/POST traffic to slack.com is allowed; only the CONNECT tunnel used by the Bolt event-callback handler is denied. The L4 OPA engine accepts the connection, but the L7 layer rejects CONNECT specifically.

Symptoms

After sending a DM to the bot, nemoclaw <sandbox> logs --follow shows:

[WARN]  bolt-app Authorization of incoming event did not succeed. No listeners will be called.
[ERROR] bolt-app Error: An HTTP protocol error occurred: statusCode = 403
    code: 'slack_bolt_authorization_error',
    statusCode: 403,
    statusMessage: 'Forbidden',
    body: {
      detail: 'CONNECT slack.com:443 not permitted by policy',
      error: 'policy_denied'
    },
[ERROR] An unhandled error occurred while Bolt processed (type: event_callback, error: ...)

For comparison, during channel startup a direct (non-CONNECT) call succeeds:

[INFO] HTTP:POST [INFO] ALLOWED POST http://slack.com:443/api/auth.test [policy:slack engine:l7]

The L4 engine allows the socket open, but the L7 layer denies CONNECT:

[OCSF] NET:OPEN [INFO] ALLOWED /usr/local/bin/node(290) -> slack.com:443 [policy:slack-custom engine:opa]
...
CONNECT slack.com:443 not permitted by policy

So the failure is specifically on the CONNECT verb at L7, not on reachability.

Workarounds attempted (all failing)

  • policy-remove slack && policy-add slack to refresh the built-in preset — no effect.
  • Custom YAML preset via policy-add --from-file granting tls: skip, access: full for slack.com:443, api.slack.com:443, hooks.slack.com:443, wss-primary.slack.com:443, wss-backup.slack.com:443. Schema rejected several variants; eventually accepted but reported as "recorded locally, not active on gateway" — i.e. sync drift.
  • shields down --policy permissive --timeout 30m — CONNECT is still denied.

While investigating, policy-list exposed broader drift between local recorded state and gateway-applied policy, e.g.:

discord — Discord API, gateway, and CDN access (active on gateway, missing from local state)

This suggests an underlying sync issue worth tracking separately.

Suggested fixes (starting points for discussion)

  1. Make the CONNECT method a first-class option in the policy preset schema, e.g. methods: [GET, POST, CONNECT] or an explicit allow_connect: true.
  2. Provide a per-channel toggle (env var or channel config) to opt out of HTTPS_PROXY injection, so undici makes direct TLS calls and never issues CONNECT.
  3. Document the recommended undici Agent / proxy configuration for channel runtimes that wrap third-party SDKs (Bolt, Discord, etc.).

Why this matters

With the current behavior, the Slack channel cannot service any event-driven flow (DMs, mentions, slash commands routed through events). The non-CONNECT auth.test succeeds during startup, which makes the channel look healthy until the first event arrives, so the failure mode is easy to miss in pre-flight checks. A documented or supported way to permit CONNECT (or to bypass HTTPS_PROXY for trusted hosts) would unblock the Slack channel out of the box.

Reproduction Steps

  1. Fresh Debian 12 host with Docker and Node 22.
  2. nemoclaw onboard --non-interactive --name testbot with NEMOCLAW_PROVIDER=anthropic, ANTHROPIC_API_KEY=..., TELEGRAM_BOT_TOKEN=....
  3. Create a Slack app from a manifest with socket mode and a connections:write app-level token.
  4. SLACK_BOT_TOKEN=xoxb-... SLACK_APP_TOKEN=xapp-... nemoclaw testbot channels add slack.
  5. Send a DM to the bot in Slack.
  6. nemoclaw testbot logs --follow — observe the failure pattern above.

Environment

  • NemoClaw v2026.4.24 (nemoclaw <sandbox> status reports Agent: OpenClaw v2026.4.24)
  • Node.js v22.22.2 inside the sandbox (path observed in the trace: /usr/local/bin/node(290) ... openclaw-unknown-.../node_modules/@slack/web-api/dist/WebClient.js)
  • Host: Debian 12 on a GCP Compute Engine VM (e2-standard-4), MTU 1460 on docker0
  • Sandbox provider: anthropic (claude-sonnet-4-6)
  • Slack app: socket mode enabled, scopes chat:write, app_mentions:read, channels:history, im:history, etc.; connections:write app-level token

Debug Output


Logs


Checklist

  • [x] I confirmed this bug is reproducible
  • [x] I searched existing issues and this is not a duplicate

AriOliv avatar May 05 '26 01:05 AriOliv

✨ Thanks for submitting this issue that identifies a problem with the Slack channel integration, where the gateway proxy rejects the CONNECT method used by @slack/bolt. This change involves a specific configuration issue with the Slack event callback handler, which is denied by the L7 layer of the NemoClaw gateway proxy.

wscurran avatar May 05 '26 06:05 wscurran

Hi @AriOliv, thank you for reporting this. Since you filed it, 39 releases have shipped and we are now on v0.0.73, with significant rework across onboarding, the sandbox runtime, and configuration handling. Could you give it a try on the latest version and confirm whether you are still seeing this? Cheers!

latenighthackathon avatar Jul 04 '26 03:07 latenighthackathon

Context: re-tested this against a fresh sandbox to check whether it still reproduces.

Working with Claude, we set up a clean sandbox (slack-repro, isolated from my other sandbox, same host) specifically to re-test this, using a free-tier Slack workspace with Socket Mode + the app_mention bot event enabled.

Environment: NemoClaw 0.0.79, OpenShell 0.0.72 (docker driver), Ubuntu 24.04, OpenClaw agent, Anthropic provider.

Result: this does not reproduce for me. Mentioning the bot in a channel produced a full, successful round trip in the gateway logs — no policy_denied, no 403 anywhere in the chain. The relevant log lines:

[slack] socket mode connected
[OCSF] NET:OPEN  ALLOWED /usr/local/bin/node -> slack.com:443        [policy:slack engine:opa]
[OCSF] HTTP:POST ALLOWED POST http://slack.com/api/auth.test        [policy:slack engine:l7]
[slack] Inbound app_mention ... -> bot:...
[OCSF] HTTP:POST ALLOWED POST http://slack.com/api/conversations.info
[OCSF] HTTP:POST ALLOWED POST http://slack.com/api/users.info
[OCSF] HTTP:POST ALLOWED POST http://slack.com/api/chat.postMessage
[OCSF] HTTP:POST ALLOWED POST http://slack.com/api/chat.update

The bot posted and then live-edited its reply in the Slack channel, confirming the round trip actually completed end-to-end, not just at the network layer.

I'm not actually seeing CONNECT in the logs, so it may be that the bot code is no longer using CONNECT or that the method is now allowed, but either way, the Slack bot works with no workaround needed.

mikemason avatar Jul 14 '26 00:07 mikemason

Closing as no longer reproducible on the current Slack runtime. A fresh v0.0.79 end-to-end Socket Mode retest completed inbound app_mention handling and the reply round trip without CONNECT, 403, or policy_denied; please reopen with a current-version trace if that behavior returns.

cv avatar Jul 14 '26 03:07 cv