fix(gateway): avoid false failure reactions on restart cancellation - #6322
Closed
bobashopcashier wants to merge 1 commit into
Closed
Conversation
bobashopcashier
force-pushed
the
aquaright1/fix/6315-restart-cancel-reactions
branch
from
April 9, 2026 22:05
5050813 to
238f1c5
Compare
Contributor
Author
|
Closing to reopen as a refreshed PR that follows the current contributing guide and PR template. |
Contributor
Author
|
Superseded by #6942, reopened on a fresh branch with the current contributing-guide/template format. |
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
ProcessingOutcomelifecycle enum so expected shutdown/restart cancellation is not treated as an ordinary processing failureWhat this addresses
Fixes #6315.
Related historical issue: #1414.
Follow-up to PR #1427.
Issue #1414 and PR #1427 fixed an important shutdown bug: old gateway instances could keep unwinding in-flight work after shutdown/replacement because adapter background tasks were not canceled and running agents were not interrupted.
Current
mainstill had a narrower remaining UX bug for reaction-capable adapters:gateway/platforms/base.pymapped anyasyncio.CancelledErrorto processing failure❌This PR distinguishes expected shutdown/restart cancellation from real processing failure so the bot no longer reports a false red
❌for that case.Why this is a follow-up to #1427
PR #1427 made gateway shutdown actually cancel adapter background tasks and interrupt running agents.
That exposed the remaining lifecycle classification problem more clearly: once cancellation became deliberate and reliable during shutdown, the shared processing hook still treated that expected cancellation as a generic failure. This PR fixes that semantic gap without regressing genuine failure signaling.
Behavior By Platform
👀on expected cancellation and do not add a terminal❌❌❌on expected cancellationTest plan
.venv/bin/python -m pytest tests/gateway/test_discord_reactions.py tests/gateway/test_telegram_reactions.py tests/gateway/test_base_topic_sessions.py tests/gateway/test_gateway_shutdown.py tests/gateway/test_matrix.py -n0 -q