fix(gateway): preserve home-channel thread targets across restart notifications (salvage #18440)#19271
Merged
Conversation
2 tasks
1 task
4 tasks
8 tasks
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.
Summary
Salvage of #18440 —
/restartnow reliably signals "gateway is back" in the configured home channel, and home-channel targeting preserves thread/topic IDs.Changes
HomeChannelgainsthread_id(threaded platforms only populate it)_apply_env_overrides: every platform reads*_HOME_CHANNEL_THREAD_ID(and*_HOME_ROOM_THREAD_IDfor Matrix)/sethomeupdates the runningGatewayConfigin-place so the pre-restart notification path sees the new home before the process reloads_send_home_channel_startup_notifications()— broadcasts once per home channel after restart, only when.restart_notify.jsonis present (no cold-start noise)(platform, chat_id)to(platform, chat_id, thread_id)so forum topics don't collide with parent chatsSendResult(success=False)is treated as a delivery failure instead of logged as successcron/scheduler.py: bare-platform delivery (deliver: "discord") picks upDISCORD_HOME_CHANNEL_THREAD_IDso cron jobs land in the same topic/sethomepickedSalvage notes
main._send_restart_notification— kept the PR's new return value (used for cross-function dedup) and reused main's existing "was not delivered" / "Sent restart notification" log wording so both the PR's new tests and main's existing regression tests assert correctly.scripts/release.py(required by CI).Validation
116 targeted tests pass:
Closes #18440.
Co-authored-by: leprincep35700 61830395+leprincep35700@users.noreply.github.com