fix(discord): recover from failed gateway resumes#103596
Merged
Merged
Conversation
Contributor
Author
|
Land-ready proof completed for exact PR head What changed:
Validation:
Known proof gaps: none for the changed Gateway reconnect surface. This is non-visual behavior, so screenshots are not applicable. |
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Jul 11, 2026
* fix(discord): recover from failed gateway resumes * chore: leave release notes to release workflow
steipete
added a commit
that referenced
this pull request
Jul 11, 2026
* fix(discord): recover from failed gateway resumes * chore: leave release notes to release workflow (cherry picked from commit abbd5ae)
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.
Closes #99681
AI-assisted: Codex implemented, tested, live-validated, and reviewed this repair.
What Problem This Solves
Fixes an issue where Discord channels could remain disconnected indefinitely after an abnormal Gateway close when Discord repeatedly rejected the cached RESUME session. Operators also lacked truthful reconnect logs showing whether the next attempt would RESUME or perform a fresh IDENTIFY.
Why This Change Was Made
The Discord-owned Gateway now treats RESUME eligibility as complete session state, tracks consecutive unsuccessful RESUME connection attempts, and discards the poisoned session after three failures so the next reconnect performs a fresh IDENTIFY. READY, RESUMED, explicit disconnect, and session invalidation reset the streak; reconnect logs report the strategy actually scheduled.
This restores the recovery invariant that was lost when the previous Carbon Gateway dependency was internalized, without adding another lifecycle-controller restart path.
User Impact
Discord delivery can recover from repeated RESUME rejection without restarting the OpenClaw Gateway process. Operators now see the reconnect reason, delay, and actual
resume=true|falsestrategy in normal Gateway logs.Evidence
gateway.test.ts,gateway-logging.test.ts, andprovider.lifecycle.test.ts(tbx_01kx5jgs88rfd2apfmaq46b0hs).oxfmt --check: all three changed files correctly formatted.run_be3c67948d38.run_536b7a74e5d4. The lane completed a real roundtrip, destroyed the active transport, rejected three RESUME reconnects, observed forced fresh IDENTIFY, recovered on the same live Gateway PID with no restart marker, and completed a second real roundtrip.pidStable=true,resumeSchedules=3,forcedIdentify=true,reconnected=true,baselineRoundtrip=true,postRecoveryRoundtrip=true.