Skip to content

fix(gateway): route watch notifications to correct Discord thread (#10411)#12918

Open
Tranquil-Flow wants to merge 1 commit into
NousResearch:mainfrom
Tranquil-Flow:fix/watch-match-thread-routing
Open

fix(gateway): route watch notifications to correct Discord thread (#10411)#12918
Tranquil-Flow wants to merge 1 commit into
NousResearch:mainfrom
Tranquil-Flow:fix/watch-match-thread-routing

Conversation

@Tranquil-Flow

@Tranquil-Flow Tranquil-Flow commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Background process watch notifications can lose the Discord thread context when the stored session origin does not carry the current event thread. This PR uses the event thread information as a fallback so watch notifications return to the thread where the process was started.

Related Issue

Fixes #10411

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

  • Preserve Discord thread routing for watch/process notifications in gateway/run.py.
  • Add focused regression coverage for event-thread fallback routing.

How to Test

  1. Check out this PR branch.
  2. Run: .venv/bin/python -m pytest -o 'addopts=' tests/gateway/test_watch_notification_thread_routing.py -q
  3. Expected result: 6 passed

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 — focused pytest passed; full suite was not run in this salvage pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Linux container / Python 3.11

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

Focused verification:

`.venv/bin/python -m pytest -o 'addopts=' tests/gateway/test_watch_notification_thread_routing.py -q` — 6 passed

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/discord Discord bot adapter labels Apr 22, 2026
@Tranquil-Flow Tranquil-Flow force-pushed the fix/watch-match-thread-routing branch 3 times, most recently from c70b900 to 708a62c Compare May 25, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/discord Discord bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Background watch_match notifications can be injected into the wrong Discord thread

2 participants