Skip to content

fix(gateway): avoid false failure reactions on restart cancellation#6942

Closed
bobashopcashier wants to merge 1 commit into
NousResearch:mainfrom
bobashopcashier:fix/6315-restart-cancel-reactions
Closed

fix(gateway): avoid false failure reactions on restart cancellation#6942
bobashopcashier wants to merge 1 commit into
NousResearch:mainfrom
bobashopcashier:fix/6315-restart-cancel-reactions

Conversation

@bobashopcashier

@bobashopcashier bobashopcashier commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Distinguishes expected shutdown/restart cancellation from genuine processing failure so Discord, Telegram, and Matrix adapters do not emit false terminal failure reactions during intentional gateway cancellation.

Related Issue

Fixes #6315
Related historical issue: #1414
Follow-up to PR #1427
Separate env/pairing hardening is tracked in PR #6956

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • updated cancellation classification in gateway/platforms/base.py so expected cancellation is not treated like an ordinary processing failure
  • adjusted gateway/platforms/discord.py, gateway/platforms/telegram.py, and gateway/platforms/matrix.py to avoid false terminal failure reactions on expected cancellation
  • added regression coverage in tests/gateway/test_base_topic_sessions.py, tests/gateway/test_discord_reactions.py, tests/gateway/test_matrix.py, and tests/gateway/test_telegram_reactions.py
  • kept this branch limited to the restart-cancellation fix instead of bundling shared env/pairing hardening

How to Test

  1. Run /Users/kennyxie/Documents/Code/clawspace/hermes-agent/.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
  2. Trigger an expected self-restart or shutdown cancellation and confirm no false is emitted
  3. Trigger a genuine delivery/processing failure and confirm failure reactions still appear

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS 26.4

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

  • /Users/kennyxie/Documents/Code/clawspace/hermes-agent/.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 -q152 passed, 3 skipped

@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #7123. Your commit was cherry-picked onto current main with your authorship preserved. Clean enum-based fix — thanks!

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.

fix(discord): avoid false ❌ on self-restart cancellation

2 participants