[Brev][Agent&Skills] Discord gateway fails in sandbox — Proxy URL must target a loopback host
Description
Description
Discord messaging channel cannot connect inside the NemoClaw sandbox. Discord.js requires the REST proxy URL to target a loopback host (127.0.0.1), but the sandbox HTTPS_PROXY is set to the OpenShell gateway proxy at 10.200.0.1:3128 (non-loopback). This causes Discord.js to reject the proxy with "Proxy URL must target a loopback host", and the gateway websocket repeatedly fails with 1006 close codes until all 10 restart attempts are exhausted. Telegram does not have this restriction and works correctly in the same sandbox environment. Slack has a separate issue (NVBug 6154848).Environment
Device: Brev n2d-standard-4 OS: Ubuntu 22.04.5 LTS Architecture: x86_64 Node.js: v22.22.2 NemoClaw: v0.0.35 OpenClaw: v2026.4.24 OpenShell CLI: 0.0.36 Docker: 28.2.2Steps to Reproduce
1. Onboard with Discord token: DISCORD_BOT_TOKEN=MTQ5MD... nemoclaw onboard --fresh 2. Check gateway logs inside sandbox: ssh into sandbox → cat /tmp/gateway.log | grep discord 3. Observe repeated failures: [discord] gateway: Gateway websocket closed: 1006 [discord] invalid rest proxy: Error: Proxy URL must target a loopback host [discord] [default] channel exited: Failed to resolve Discord application id [discord] [default] auto-restart attempt 7/10 in 300sExpected Result
Discord bot connects to the Discord gateway via the sandbox proxy and goes online in the configured server.Actual Result
Discord.js rejects the sandbox proxy (10.200.0.1:3128) because it is not a loopback address. The Discord gateway websocket fails repeatedly with 1006 close codes, and after 10 restart attempts the channel gives up. Root cause: sandbox sets HTTPS_PROXY=http://10.200.0.1:3128 which is the OpenShell L7 proxy. Discord.js (discord.js library) has a security check that requires proxy URLs to target loopback (127.0.0.1 or ::1). This check exists in Discord.js but not in the Telegram or Slack SDKs, which is why Telegram works in the same environment. Possible fix: route Discord traffic through a local proxy shim (127.0.0.1 → 10.200.0.1:3128), similar to how the Ollama proxy on port 11435 works.Logs
2026-05-07T09:13:11.566+00:00 [discord] gateway: Gateway websocket closed: 1006 2026-05-07T09:13:11.567+00:00 [discord] gateway: Gateway reconnect scheduled in 7293ms 2026-05-07T09:13:11.773+00:00 [discord] gateway error: Error: Socket is closed 2026-05-07T09:13:20.295+00:00 [discord] gateway was not ready after 15000ms; restarting gateway 2026-05-07T09:20:41.345+00:00 [discord] [default] starting provider 2026-05-07T09:20:41.346+00:00 [discord] invalid rest proxy: Error: Proxy URL must target a loopback host 2026-05-07T09:20:41.348+00:00 [discord] invalid rest proxy: Error: Proxy URL must target a loopback host 2026-05-07T09:20:48.365+00:00 [discord] [default] channel exited: Failed to resolve Discord application id 2026-05-07T09:20:48.366+00:00 [discord] [default] auto-restart attempt 7/10 in 300s
Bug Details
| Field | Value |
|---|---|
| Priority | Unprioritized |
| Action | Dev - Open - To fix |
| Disposition | Open issue |
| Module | Machine Learning - NemoClaw |
| Keyword | NemoClaw, NemoClaw_Agent&Skills, NEMOCLAW_GH_SYNC_APPROVAL, NemoClaw_Policy&Network, NemoClaw-SWQA-RelBlckr-Recommended |
[NVB#6154854]
same for me
This was fixed by #3323 (merged 2026-05-13, first released in v0.0.40), which removed the in-sandbox Discord facade/proxy workaround and routed Discord Gateway traffic through OpenShell's native WebSocket policy.
Root cause path: scripts/generate-openclaw-config.py used to inject account.proxy = "http://10.200.0.1:3128" for both telegram AND discord channels. OpenClaw's extensions/discord/src/proxy-fetch.ts:validateDiscordProxyUrl() rejects any non-loopback proxy hostname, which is where the Proxy URL must target a loopback host error came from. After #3323, only telegram gets account.proxy set; Discord's account config no longer carries a proxy field, so withValidatedDiscordProxy returns undefined and the loopback check is bypassed cleanly.
Verification on current main (v0.0.44+):
-
generate-openclaw-config.pylines 487–488: ```python if ch == "telegram": # was ("telegram", "discord") pre-#3323 account["proxy"] = proxy_url ``` -
Regression guard at
test/generate-openclaw-config.test.ts:277: ```ts expect(config.channels.discord.accounts.default.proxy).toBeUndefined(); ``` -
Ran the script locally with
NEMOCLAW_MESSAGING_CHANNELS_B64containing["telegram","discord"]: ``` telegram proxy='http://10.200.0.1:3128' ← expected discord proxy=None ← fixed ✓ ```
@zNeill — could you retest on v0.0.44 with nemoclaw onboard --fresh + Discord token, and confirm the channel goes online? If the 1006 close codes or any other Discord failure persists, please reopen with cat /tmp/gateway.log | grep discord from the new sandbox so we can chase whatever's left separately from the loopback-host path.
Closing as already fixed by #3323.