Skip to content

[Bug]: Discord gateway hang at 'awaiting gateway readiness' still reproduces on 2026.5.3-1 (macOS) — six closed dups, raw-ws test isolates failure to Carbon Client lifecycle #77668

Closed

Description

@RyanSandoval

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

On macOS, the Discord gateway plugin (Carbon) silently hangs at client initialized as <id>; awaiting gateway readiness after restart, never reaching READY, with no timeout/error event ever fired. A raw ws connection from the same Node binary, same node_modules/ws, same machine, same bot token completes the WS handshake to gateway.discord.gg in <1 second — proving the failure is purely inside Carbon's Client constructor → registerClient async flow, not the network/token/Discord. Still reproduces on 2026.5.3-1 despite #56492 / #57075 / #58290 / #59820 / #70841 / #63223 having been closed as duplicates over the past two months.

Steps to reproduce

  1. Install OpenClaw 2026.5.3-1 on macOS via npm global, run as a ~/Library/LaunchAgents/ai.openclaw.gateway.plist LaunchAgent.
  2. Configure a single Discord bot account, single guild, with commands.native: false and commands.nativeSkills: false (rules out the slash-deploy CPU spike from [Bug]: Discord gateway stuck at 'awaiting gateway readiness' — --verbose flag as workaround (v2026.4.2) #60559).
  3. launchctl bootout "gui/$(id -u)/ai.openclaw.gateway" → wait 60s → launchctl bootstrap …
  4. tail -f ~/.openclaw/logs/gateway.log | grep '\[discord\]'

Observed (every restart over the past 36+ hours, ~10 attempts):

[discord] [default] starting provider (@K2)
[discord] channels resolved: <guild_id> (guild:K2; aliases:guild:<guild_id>)
[discord] users resolved: <user_id>
[discord] channel users resolved: <user_id>
[discord] client initialized as <bot_id>; awaiting gateway readiness
                                                ^^^ silent forever — no further [discord] events
  1. Smoking-gun isolation test — same machine, same token, same ws library bundled with OpenClaw:
node -e '
const WebSocket = require("/path/to/openclaw/node_modules/ws");
const ws = new WebSocket("wss://gateway.discord.gg/?v=10&encoding=json");
ws.on("open",    () => console.log("OPEN"));
ws.on("message", (d) => { console.log("MSG:", d.toString().slice(0, 200)); ws.close(); process.exit(0); });
ws.on("error",   (e) => { console.log("ERROR:", e.message); process.exit(2); });
'

Output (every time, in <1s):

OPEN: WebSocket opened to Discord
MSG: {"t":null,"s":null,"op":10,"d":{"heartbeat_interval":41250,"_trace":[...]}}

So Discord IS sending HELLO. Carbon's GatewayPlugin just never processes it — the 'open' and 'message' handlers either aren't registered before the frame arrives, or registration completes after the frame is already buffered/dropped. This matches the un-awaited-registerClient race documented in #56492 root-cause.

Expected behavior

After [discord] client initialized as ..., within ~5 seconds:

[discord] logged in to discord as <bot_id> (<username>)

And inbound MESSAGE_CREATE events should be delivered to the agent.

Actual behavior

OpenClaw version

2026.5.3-1

Operating system

macOS 26.3.1 (build 25D771280a, Apple Silicon)

Install method

npm global (npm install -g openclaw), launched by ~/Library/LaunchAgents/ai.openclaw.gateway.plist

Model

anthropic/claude-opus-4-7 (via agentRuntime.id: "claude-cli" subprocess to local Claude Code CLI)

Provider / routing chain

discord ← openclaw-gateway → claude-cli subprocess → claude.ai OAuth (overage disabled at org level, irrelevant to this bug)

Additional provider/model setup details

Logs, screenshots, and evidence

2026-05-04T20:09:42.638-07:00 [discord] users resolved: <user_id>
2026-05-04T20:09:42.639-07:00 [discord] channel users resolved: <user_id>
2026-05-04T20:09:43.106-07:00 [discord] client initialized as <bot_id>; awaiting gateway readiness
[silence — no further discord events for 30+ minutes]
2026-05-04T20:12:20.690-07:00 [gateway] http server listening (3 plugins: anthropic, discord, memory-core; 3.8s)
2026-05-04T20:12:22.636-07:00 [discord] [default] starting provider (@K2)
2026-05-04T20:12:23.497-07:00 [discord] channels resolved: <guild_id>
2026-05-04T20:12:23.672-07:00 [discord] client initialized as <bot_id>; awaiting gateway readiness
[silence — same hang on second bootout/bootstrap cycle]

Last successful login over the past 36 hours: 2026-05-03 09:57:36 (one success across ~10 restart attempts on this host).

Discord session_start_limit on the affected bot at the time of writing: remaining: 960/1000, resets in 588 min — confirming Discord-side identify quota is not the cause.

Impact and severity

Additional information

Regression timeline (all closed as duplicates of root-cause issue #56492 which itself is closed):

Workarounds that work some of the time:

Workarounds that do NOT work on 2026.5.3-1:

  • kill -9 $GATEWAY_PID followed by launchd respawn
  • launchctl kickstart -k (leaves stale TCP sockets attached)
  • openclaw doctor --fix (does not touch the discord plugin lifecycle)

Suggested fix priority order:

  1. Make Client.registerClient(plugin) async-aware in @buape/carbon so the constructor's plugin loop awaits the promise. Per Discord gateway never connects: Carbon Client constructor doesn't await async GatewayPlugin.registerClient #56492 the constructor currently does for (const p of plugins) { p.registerClient?.(this); } with no await. This is the upstream fix.
  2. In OpenClaw's discord provider, after new Client(...), explicitly await client.getPlugin('gateway')?.registerClient?.(client) so the WebSocket connection is guaranteed to be established before lifecycleGateway.isConnected is polled. This is the OpenClaw-side fix that doesn't require waiting on Carbon upstream.
  3. Restore the [discord] logged in to discord as ... log line even when the underlying event flow has been refactored. Watchdogs and operators rely on this for liveness. Currently it is silently dropped per Gateway becomes zombie after system CA rotation; internal reconnect loop cannot recover; Discord READY log line also missing in 2026.4.5 #63223.
  4. Replace the ?? true nullish-default in the waitForGatewayReady guard with ?? false (or surface the actual hung-promise state) so the documented 15-second timeout actually fires. Per [Bug]: Discord plugin: post-restart gateway wedges at "awaiting gateway readiness" on macOS (no 15s timeout fires) #70841 this is currently masking the failure.

I am happy to test patches on this affected macOS host — the bug reproduces deterministically here.


Cross-references: #56492 (root cause, closed dup) · #57075 (single-account, closed dup) · #58290 (closed dup) · #59820 (closed dup) · #70841 (closed dup, macOS, ~80% rate) · #63223 (open, missing READY log) · #60559 (closed, --verbose workaround)

Activity

  1. clawsweeper commented on May 5, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve.

    Summary
    Keep open: this is a fresh shipped Discord regression with concrete macOS reproduction, and current main has adjacent post-release readiness/DNS hardening but not enough proof that it resolves this reporter's Carbon/internal client lifecycle hang.

    Reproducibility: no. high-confidence current-main reproduction is available. The issue provides strong shipped-package macOS steps for v2026.5.3-1, but this review could only inspect current main and related fixes, not run a live Discord gateway on the affected host.

    Next step
    This needs maintainer coordination or live macOS validation of the post-release Discord gateway fixes before a safe repair branch can be scoped.

    Review details

    Best possible solution:

    Keep this live regression open until the post-v2026.5.3 fixes are tested on the affected macOS setup; if it still hangs, land a narrow Discord gateway lifecycle fix and leave the READY log-line work to #63223.

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

    No high-confidence current-main reproduction is available. The issue provides strong shipped-package macOS steps for v2026.5.3-1, but this review could only inspect current main and related fixes, not run a live Discord gateway on the affected host.

    Is this the best way to solve the issue?

    Unclear. Current main has plausible post-release fixes in READY retry/backoff and Discord IPv4-first transport, but this report distinguishes itself from the earlier identify-race and network cases, so the best path is maintainer/live validation before closing.

    Acceptance criteria:

    • pnpm test extensions/discord/src/monitor/provider.lifecycle.test.ts extensions/discord/src/monitor/gateway-plugin.test.ts extensions/discord/src/monitor/provider.proxy.test.ts extensions/discord/src/monitor/provider.startup.test.ts extensions/discord/src/network-config.test.ts
    • Live macOS Discord gateway restart on a build containing e259938 and c3c7c2d, with raw gateway logs proving HELLO/IDENTIFY/READY or the exact stall point

    What I checked:

    Likely related people:

    • steipete: Authored the current Discord IPv4-first gateway startup fix, internalized the Discord client, and has repeated recent commits in Discord gateway lifecycle/startup paths. (role: recent maintainer and adjacent owner; confidence: high; commits: c3c7c2df6f62, f0adbd48e8bc, 78a431ed224b; files: extensions/discord/src/monitor/gateway-plugin.ts, extensions/discord/src/monitor/provider.lifecycle.ts, extensions/discord/src/internal/gateway.ts)
    • NikolaFC: Authored PR fix: harden startup readiness and discord replies #77478, whose merged current-main changes retry Discord READY waits with reconnect/backoff and update related lifecycle tests. (role: recent readiness hardening contributor; confidence: medium; commits: e259938e9643; files: extensions/discord/src/monitor/provider.lifecycle.ts, extensions/discord/src/monitor/provider.lifecycle.test.ts)
    • IVY-AI-gif: Authored fix(discord): prevent Identify silent-drop race in gateway startup #68159, the earlier gateway identify-race fix that the reporter confirms is present but insufficient for this newer reproduction. (role: introduced prior identify-race fix; confidence: medium; commits: 5adf9d261944; files: extensions/discord/src/monitor/gateway-plugin.ts, extensions/discord/src/monitor/gateway-plugin.test.ts)

    Remaining risk / open question:

    Codex review notes: model gpt-5.5, reasoning high; reviewed against b546aa91e19b.

  2. RyanSandoval commented on May 5, 2026

    @RyanSandoval
    Author

    Follow-up requested by maintainer: the closing note on #56492 explicitly invited fresh issues if the bug recurs after fix commit 5adf9d2619449b98b22f98bcd79d0a5051081f45 (#68159, merged 2026-04-24).

    Confirming the fix is in this version's code path: tag chain shows 5adf9d2619 → v2026.4.29-beta.4 → v2026.5.2 → v2026.5.3 → v2026.5.3-1 (the version under test here).

    So the SafeGatewayPlugin changes from #68159 (early this.client = client assignment + skip-super.registerClient-when-ws/isConnecting-set guard) are present and still allow the hang. This is a regression of the fix on macOS, not a missed-fix duplicate.

    I tried to leave this note on #56492 directly to bump the original thread but the issue is locked, hence consolidating here.

  3. wena369 commented on May 5, 2026

    @wena369

    @clawsweeper fix issue

    Please implement the narrow Discord gateway lifecycle fix suggested in this issue. Focus on the missing gateway handle / READY wait path, especially avoiding treating an undefined gateway as ready, and add regression coverage around startup readiness.

  4. wena369 commented on May 5, 2026

    @wena369

    Additional Windows evidence:

    I upgraded to OpenClaw 2026.5.4 (325df3e), restarted the gateway, waited 120 seconds, and the issue still reproduces.

    Probe:

    • Reachable: yes
    • Capability: admin-capable
    • Connect: ok
    • Read probe: failed - timeout

    Latest gateway log shows:

    • [discord] client initialized as 1476275479047700564; awaiting gateway readiness
    • [discord] discord gateway error: Error: Gateway heartbeat ACK timeout

    So v2026.5.4 does not resolve the Windows reproduction.

  5. wena369 commented on May 5, 2026

    @wena369

    OpenClaw 2026.5.4 still reproduces on Windows.

    Startup is very slow:

    • http server listening took 141.6s
    • Discord REST /users/@me fetch timed out after 2500ms with likely event-loop starvation
    • Telegram getMe fetch timed out after ~15s
    • gateway ready at 22:56:51
    • Discord resolved guild/channel/user IDs
    • Discord client initialized at 22:56:55 but stayed at awaiting gateway readiness

    Relevant logs:

  6. wena369 commented on May 5, 2026

    @wena369

    Additional test:

    I disabled Telegram (channels.telegram.enabled = false), restarted OpenClaw 2026.5.4, waited 120 seconds, and openclaw gateway probe still reports:

    • Reachable: yes
    • Capability: admin-capable
    • Connect: ok
    • Read probe: failed - timeout

    So the Windows reproduction is not caused only by Telegram startup.

  7. wena369 commented on May 5, 2026

    @wena369

    After disabling Telegram, openclaw gateway status --deep --require-rpc reports Read probe: ok and admin-capable, but Discord still does not post a reply. Discord shows typing/processing, and logs include:

    • discord client initialized ...; awaiting gateway readiness
    • liveness warning: event_loop_delay ... active=agent:main:discord:channel:... (processing,q=1)

    So the gateway RPC path recovers, but Discord message processing/reply delivery still appears stuck.

  8. wena369 commented on May 5, 2026

    @wena369

    Still reproduces on OpenClaw 2026.5.4 (325df3e).

    After disabling Telegram, gateway deep status can report Read probe: ok / admin-capable, but Discord still does not reply. The log repeatedly shows:

    • discord client initialized ...; awaiting gateway readiness
    • discord gateway error: Error: Gateway heartbeat ACK timeout
    • fetch-timeout for https://discord.com/api/v10/users/@me with event-loop starvation, including timer delays up to tens of seconds

    This looks like the Discord gateway heartbeat/READY path is still blocked by event-loop starvation on Windows, not just a generic gateway listener failure.

  9. wena369 commented on May 5, 2026

    @wena369

    After disabling browser and Telegram, gateway deep status reports Read probe: ok / admin-capable. Startup now loads 5 plugins instead of 6-7, but Discord still stops at:

    discord client initialized ...; awaiting gateway readiness

    The browser symlink warnings disappeared after disabling browser, so that was not the only cause. The remaining issue still appears specific to Discord gateway readiness/heartbeat on Windows.

  10. wena369 commented on May 5, 2026

    @wena369

    Update after narrowing config:

    I minimized the gateway to only 2 loaded plugins: discord and memory-core. openclaw gateway status --deep --require-rpc reports Read probe: ok and Capability: admin-capable, so the local gateway listener/RPC path is healthy.

    The Discord channel still does not become ready:

    • discord client initialized ...; awaiting gateway readiness
    • discord gateway error: Error: Gateway heartbeat ACK timeout
    • fetch-timeout ... https://discord.com/api/v10/users/@me
    • liveness warnings show event-loop delay while channels.discord.start-account is active

    This reproduces on Windows with OpenClaw 2026.5.4 (325df3e), even after disabling Telegram, browser, device-pair, phone-control, and talk-voice.

  11. wena369 commented on May 5, 2026

    @wena369

    Additional network check:

    From the same Windows host, Discord HTTPS itself is fast and stable:

    Invoke-WebRequest https://discord.com/api/v10/gateway:
    1: ok 230ms
    2-10: ok 46-52ms

    So this does not look like general Discord network latency. OpenClaw still logs fetch-timeout for https://discord.com/api/v10/users/@me and Gateway heartbeat ACK timeout while the gateway is minimized to discord + memory-core. This points more toward OpenClaw Discord plugin event-loop starvation / readiness handling than raw network reachability.

  12. wena369 commented on May 5, 2026

    @wena369

    Additional token-authenticated Discord REST check:

    From the same Windows host and using the same bot token from channels.discord.token, direct REST calls to https://discord.com/api/v10/users/@me are fast and successful:

    1: ok 415ms
    2: ok 240ms
    3: ok 245ms
    4: ok 266ms
    5: ok 279ms
    6: ok 251ms
    7: ok 259ms
    8: ok 324ms
    9: ok 236ms
    10: ok 254ms

    So the bot token and Discord REST reachability are OK outside OpenClaw.

    However, OpenClaw still logs:

    • fetch-timeout ... https://discord.com/api/v10/users/@me
    • discord client initialized ...; awaiting gateway readiness
    • discord gateway error: Error: Gateway heartbeat ACK timeout
    • liveness warnings with event-loop delay while channels.discord.start-account is active

    This reproduces on Windows with OpenClaw 2026.5.4 (325df3e), minimized to only discord + memory-core. This strongly suggests the timeout is caused inside the OpenClaw process, not by network latency or an invalid token.

  13. wena369 commented on May 5, 2026

    @wena369

    I found a likely heartbeat lifecycle bug. The first Discord heartbeat is randomized, but ACK timeout checking is driven by a fixed interval started at HELLO time. If the randomized first heartbeat fires late in the interval, the next fixed interval can check lastHeartbeatAck only a short time after that heartbeat was sent, causing a false Gateway heartbeat ACK timeout, especially when the event loop is delayed on Windows.

    I attached a patch that changes the heartbeat timer to schedule the ACK check one full interval after each heartbeat send, with a regression test.

  14. mfbergmann commented on May 5, 2026

    @mfbergmann

    Confirming Linux repro on OpenClaw 2026.5.4 (325df3e), Linux 6.8.0-106-generic x86_64, npm global install, systemd-managed user gateway.

    Same signature as the macOS/Windows reports above:

    ```
    [discord] [default] starting provider
    [discord] channels resolved: <guild_id>
    [discord] channel users resolved: <user_id>
    [discord] client initialized as <bot_id>; awaiting gateway readiness
    [no further [discord] events; no `logged in to discord` ever]
    [diagnostic] liveness warning: ... phase=channels.discord.start-account ...
    ```

    `gateway ready` is logged but the startup-phase state machine stays pinned on `channels.discord.start-account`. Inbound MESSAGE_CREATE events never reach the agent (no `agent/embedded` model call follows the bootstrap injection on the matched session). Outbound REST keeps working fine — cron-driven posts deliver normally — matching the inbound/outbound asymmetry @RyanSandoval documented.

    Confirming @wena369's narrowing: disabling `channels.telegram.enabled` only shifts the hang. With Telegram off, the same `start-account` lock simply re-pins on Discord:

    ```
    phase=channels.telegram.start-account → (telegram disabled, restart) → phase=channels.discord.start-account
    ```

    So this isn't Telegram-specific; it's the channel `start-account` flow becoming non-progressing under event-loop delay on a busy gateway. Adds Linux to the macOS + Windows repro list — platform-agnostic, as expected for a heartbeat-lifecycle / promise-await race.

    (Note: the comment above mentions an attached patch but I don't see an attachment, link, or referenced PR in this thread — happy to test if a diff or PR gets posted.)

  15. holgergruenhagen commented on May 5, 2026

    @holgergruenhagen
    Contributor

    Adding a Linux reproduction on OpenClaw 2026.5.4. The issue currently lists macOS and Windows reports — Linux reproduces the same hang.

    Environment

    • OpenClaw 2026.5.4 (npm global, /usr/lib/node_modules/openclaw)
    • Ubuntu (kernel 6.8), Node.js 22.22.2, systemd user service
    • 7 plugins loaded: active-memory, browser, codex, discord, flybridge, lossless-claw, memory-core
    • Single Discord bot, single guild, ~10 channels with per-agent lanes

    Repro

    Three consecutive restarts today (UTC), all hung at awaiting gateway readiness:

    Restart Time (UTC) Outcome
    #1 16:03 hung — READY never fired
    #2 16:31 hung — READY never fired
    #3 16:48 hung — READY never fired

    Each one ends with the same final discord log line and then goes completely silent in the discord namespace:

    [discord] [default] starting provider
    [discord] [default] Discord bot probe resolved @OpenClaw
    [discord] [default] Discord Message Content Intent is limited; bots under 100 servers can use it without verification.
    [discord] channels resolved: <guild>/<channel> (...)
    [discord] users resolved: <user_id>
    [discord] channel users resolved: <user_id>
    [discord] truncating native command description (command:lossless) ...
    [discord] client initialized as <bot_id>; awaiting gateway readiness
                                                                        ^^^ silent forever
    

    Notable on Linux: no heartbeat ACK timeout

    In all three hangs there is no Gateway heartbeat ACK timeout — the 41-second heartbeat ACK check never fires at all. That suggests the heartbeat lifecycle is never started, which fits the hypothesis in the issue body that the HELLO frame from Discord arrives but Carbon's Client lifecycle never processes it.

    Network is fine

    • [discord] [default] Discord bot probe resolved @OpenClaw succeeds on every boot — REST works.
    • ss -tnp during the hang shows ESTABLISHED connections to 162.159.x.x:443 (Discord/Cloudflare).
    • Direct curl https://discord.com/api/v10/users/@me with the same bot token from the same host returns 200.

    Trigger context for restart #1

    Restart #1 was preceded by a UI-initiated bulk operation: I disabled ~25 skills in the OpenClaw control UI in quick succession. Between 16:27:31 and 16:30:08 UTC the gateway log shows ~25 back-to-back gateway/reload cycles, one per skill, each skills snapshot invalidated by config change taking ~600–1900ms. During and after that we see:

    [fetch-timeout] fetch timeout after 10000ms (elapsed 12188ms)
      url=https://discord.com/api/v10/oauth2/applications/@me
    [fetch-timeout] fetch timeout after 2500ms (elapsed 4866ms) timer delayed 2366ms,
      likely event-loop starvation
    [discord] interaction handler failed: AbortError: This operation was aborted
    

    This event-loop pressure is a plausible aggravator for restart #1, but restarts #2 and #3 had no comparable storm and still hung the same way. So the race appears to be the real driver — pressure makes it more likely, but a clean boot can hang too.

    Resources during the hangs

    On the heartbeat-lifecycle patch

    The patch posted earlier today scheduling the ACK check one full interval after each heartbeat send addresses the case where the heartbeat lifecycle at least starts. My Linux logs show a path where the lifecycle never starts at all — possibly the same root cause depending on how the registration race resolves. If the registration finally completes late, the heartbeat schedule is exactly where things would otherwise drift out of sync, so the patch may help on this path too.

    Thanks for staying on top of this.

  16. wena369 commented on May 5, 2026

    @wena369

    I applied the proposed heartbeat timer patch locally and ran the Discord gateway unit test:

    node scripts/run-vitest.mjs run --config test/vitest/vitest.extension-discord.config.ts
    with OPENCLAW_VITEST_INCLUDE_FILE=["extensions/discord/src/internal/gateway.test.ts"]

    Result:

    • extensions/discord/src/internal/gateway.test.ts passed
    • 21 tests passed

    The patch changes heartbeat ACK checking so the ACK timeout is scheduled one full interval after each heartbeat send, instead of using a fixed interval that can fire shortly after the randomized first heartbeat.

  17. RyanSandoval commented on May 6, 2026

    @RyanSandoval
    Author

    Update from the original reporter — heartbeat patch tested, does not fix this failure mode.

    I hand-applied the heartbeat fix from #77956 (replace setInterval with recursive setTimeout in GatewayHeartbeatTimers.start) directly to my installed dist:

    ~/.openclaw/npm/node_modules/@openclaw/discord/dist/provider-Cy1aml6b.js
    

    After also clearing the ~/.openclaw/tmp/jiti/ cache to force regeneration, I confirmed the patched code IS being executed (3× scheduleNext references in the regenerated dist-provider-Cy1aml6b.2f84d366.mjs).

    Result: Discord still hangs at client initialized as <id>; awaiting gateway readiness indefinitely. No login ever fires. After ~15 minutes the WS gets a 1006 close (Discord's idle timeout) and the cycle repeats with no recovery.

    This confirms @holgergruenhagen's earlier observation — when the heartbeat lifecycle never starts (no Gateway heartbeat ACK timeout event ever fires), the heartbeat-timer fix is a no-op. The bug is upstream of heartbeats: the IDENTIFY → READY exchange never completes, so heartbeats are never scheduled in the first place.

    Symptom timeline on this host:

    T+0     [discord] client initialized as <id>; awaiting gateway readiness
    T+15min [discord] gateway: Gateway websocket closed: 1006   ← Discord idle-closes the WS
    T+15min [discord] gateway: Gateway reconnect scheduled       ← Carbon retries, same race
    [silent forever after that — no login event, no heartbeat lifecycle]
    

    This means #77956 / #78087 (heartbeat fixes) — while still useful for the post-identify-success false-timeout cycle — won't address this issue's primary failure mode on macOS. The needed fix is in the Carbon Client.registerClient async path that #56492 / #68159 addressed back in April; that fix landed (commit 5adf9d2619) and is in v2026.5.3-1, but the race apparently still fires on this macOS configuration.

    I'm leaving the heartbeat patch in place locally — it's a no-op for this failure mode but won't hurt and will help once the IDENTIFY race is genuinely fixed.

    Happy to test any patch targeting the Carbon registration / Identify race; the bug is 100% reproducible on this host.

  18. wena369 commented on May 6, 2026

    @wena369

    Thanks, that makes sense. I’ll keep my Windows findings scoped as a separate/possibly related failure mode rather than claiming the heartbeat patch fixes the macOS Carbon/IDENTIFY race.

    For my host, the strongest signal was gateway event-loop starvation while deferred/missed cron work was active. After disabling/removing those cron jobs, the gateway is currently healthy:

    Runtime: running
    Read probe: ok
    Listening: 127.0.0.1:18789
    
  19. added a commit that references this issue on May 6, 2026
    218fcea
  20. steipete commented on May 6, 2026

    @steipete
    Contributor

    Landed the narrow Discord heartbeat scheduler fix in #78087: b5c33bc

    I verified the surviving current-main bug was the ACK timeout race, not the older Carbon registerClient theory: the first heartbeat was randomized, but the ACK check was scheduled from timer start, so a late first heartbeat could falsely trigger Gateway heartbeat ACK timeout and reconnect while the channel was still awaiting READY.

    Keeping this issue open for now. @RyanSandoval, if you can run the promised 5 launchctl bootout + bootstrap cycles on the affected macOS host after updating to a build that includes the landed commit, that would be the best close proof.

  21. steipete commented on May 6, 2026

    @steipete
    Contributor

    Reopening for affected-host verification. The fix is landed in #78087 / b5c33bc, but we should keep this open until the macOS launchd restart retest confirms the readiness hang is gone.

  22. steipete commented on May 6, 2026

    @steipete
    Contributor

    Verified fixed on current main by b5c33bc.

    That commit changes the Discord Gateway heartbeat scheduler so ACK timeout checks are measured from the actual heartbeat send rather than from the fixed HELLO-time interval, which covers the false reconnect loop behind this report's awaiting gateway readiness/heartbeat ACK timeout path. It also added extensions/discord/src/internal/gateway-lifecycle.test.ts coverage and records focused test, formatting, diff, and real-behavior proof in the commit message.

    Closing as fixed on main. Release pickup still depends on the next published build containing b5c33bc.

  23. locked as resolved and limited conversation to collaborators on May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions