Skip to content

fix(gateway): keep QQBot reconnect loop alive - #25361

Closed
magic524 wants to merge 1 commit into
NousResearch:mainfrom
magic524:fix/qqbot-keep-reconnect-loop-alive
Closed

fix(gateway): keep QQBot reconnect loop alive#25361
magic524 wants to merge 1 commit into
NousResearch:mainfrom
magic524:fix/qqbot-keep-reconnect-loop-alive

Conversation

@magic524

Copy link
Copy Markdown
Contributor

What does this PR do?

Keeps the QQBot adapter's reconnect loop alive after transient WebSocket disconnects.

Previously, QQBot used _mark_disconnected() for transport-level drops. That method also sets _running = False, so if a reconnect attempt failed once, for example while fetching the QQ gateway URL, the listener loop could stop permanently. The adapter would then stay disconnected until the whole gateway process was restarted.

This PR separates transient WebSocket transport state from adapter lifecycle state, so QQBot can keep retrying reconnects while still reporting itself as disconnected to runtime status.

Related Issue

No issue yet.

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

  • gateway/platforms/qqbot/adapter.py
    • Added _mark_transport_disconnected() for transient QQ WebSocket drops.
    • Updated QQBot reconnect handling to avoid stopping the listener loop on recoverable disconnects.
    • Made is_connected check the actual WebSocket transport state.
  • tests/gateway/test_qqbot.py
    • Updated reconnect tests to model an active WebSocket transport.

How to Test

  1. Run scripts/run_tests.sh tests/gateway/test_qqbot.py -q.
  2. Run venv/bin/python scripts/check-windows-footguns.py gateway/platforms/qqbot/adapter.py tests/gateway/test_qqbot.py.
  3. Manually run a QQBot gateway and verify it reconnects after transient WebSocket drops without restarting the gateway process.

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: Linux / WSL environment

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

For New Skills

N/A

Screenshots / Logs

Validation:

scripts/run_tests.sh tests/gateway/test_qqbot.py -q
144 passed, 1 warning

venv/bin/python scripts/check-windows-footguns.py gateway/platforms/qqbot/adapter.py tests/gateway/test_qqbot.py
✓ No Windows footguns found (2 file(s) scanned).

[QQBot] Reconnect failed: Failed to get QQ Bot gateway URL
[QQBot] Still not connected after 15s

Loading
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 duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists platform/qqbot QQ Bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants