fix(discord): prevent stale gateway error listeners after restart#101617
Merged
steipete merged 3 commits intoJul 9, 2026
Merged
Conversation
Contributor
|
Codex review: stale review; fresh review needed. Summary Next step Review history (3 earlier review cycles)
|
steipete
force-pushed
the
fix/problem-discord-gateway-error-listener
branch
from
July 9, 2026 03:14
297f545 to
38a5333
Compare
Contributor
|
Maintainer refactor and land-ready proof are complete on What changed:
Proof:
The behavior is exercised through the production supervisor with a real EventEmitter; no external Discord connection was needed for this teardown invariant. |
steipete
force-pushed
the
fix/problem-discord-gateway-error-listener
branch
from
July 9, 2026 03:17
a53657a to
9603dbc
Compare
Contributor
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Jul 9, 2026
…enclaw#101617) * fix(discord): remove gateway error listener on dispose * fix(discord): preserve late gateway error guard * fix(discord): retain late gateway diagnostics --------- Co-authored-by: Peter Steinberger <[email protected]>
wheakerd
pushed a commit
to wheakerd/clawdbot
that referenced
this pull request
Jul 15, 2026
…enclaw#101617) * fix(discord): remove gateway error listener on dispose * fix(discord): preserve late gateway error guard * fix(discord): retain late gateway diagnostics --------- Co-authored-by: Peter Steinberger <[email protected]> (cherry picked from commit 1017ea5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Restarting or cleaning up the Discord gateway supervisor removed the disposed listener from a shared EventEmitter but could leave two bad outcomes: retaining old supervisor/runtime closures across restart cycles, or removing the last
errorlistener so a delayed gateway error crashed the process.Why This Change Was Made
The supervisor now owns one emitter-scoped late-error guard. Disposal removes the active supervisor listener and installs the guard only when no other error listener exists. A replacement supervisor removes the guard before attaching its active listener, so listener count stays bounded and no disposed runtime closure is retained.
The guard logs each distinct late error through the Discord gateway subsystem logger instead of silently swallowing it. Repeated identical late errors are deduplicated until the next supervisor starts.
User Impact
Discord channel restart and startup-cleanup paths no longer accumulate stale gateway listeners or crash on delayed emitter errors. Operators retain a bounded diagnostic when a late gateway error occurs.
Evidence
coral-crab(tbx_01kx2dacsrr1z0hjxenejbt9s5): 72 focused Discord tests passed across gateway supervisor, provider, gateway monitor, and provider lifecycle suites.git diff --checkpassed.The refactor preserves contributor authorship. Release-note context remains in this PR body for the release-owned changelog flow.