Skip to content

fix(discord): preserve gateway sessions during shutdown - #28

Merged
taariq merged 1 commit into
mainfrom
fix/discord-preserve-session-on-stop
Nov 3, 2026
Merged

taariq merged 1 commit into
mainfrom
fix/discord-preserve-session-on-stop

Conversation

@taariq

@taariq taariq commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When the Discord plugin stops during a rollout, it closes its gateway connection with code 1000. Discord invalidates a session closed with 1000 or 1001, so the replacement plugin can't resume, and a message sent during the rollout gap can't be replayed. This closes with 1012 (CloseCode::Restart) instead, which keeps the session valid.

Ref #27, which stays open until production's connector gateway includes this. serenorg/seren-core#1215's Core change must not ship before that: it lets the plugin stop cleanly, and with the old close code a clean stop ends the session.

Test evidence

  • Written and run by seren-core#1215's core-runner job, on this same base (5bfd0dd): the channel-discord plugin's 185 of 185 tests passed at the production stack.
  • The new test, gateway_shutdown_resumes_a_message_received_while_disconnected, drives a stand-in for Discord: it checks the close code, then that a message sent while disconnected is replayed on resume with the same event identity.
  • No message has been sent through a real rollout yet. That's seren-core#1215's production acceptance.

Taariq Lewis, SerenAI, Paloma, and Volume at https://serendb.com
Email: hello@serendb.com

Stopping closed the gateway connection with code 1000, which makes Discord
invalidate the session. The replacement plugin then couldn't resume, so a
message sent during a rollout couldn't be replayed. Close with 1012 instead,
and test replay of a message received while disconnected.

Ref: #27

Taariq Lewis, SerenAI, Paloma, and Volume at https://serendb.com
Email: hello@serendb.com
@taariq
taariq merged commit 544545e into main Nov 3, 2026
17 checks passed
@taariq
taariq deleted the fix/discord-preserve-session-on-stop branch November 3, 2026 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant