Skip to content

fix(qqbot): support Windows local media sends - #26098

Open
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:hermes/fix-26041-qqbot-media-windows-paths
Open

fix(qqbot): support Windows local media sends#26098
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:hermes/fix-26041-qqbot-media-windows-paths

Conversation

@LeonSGP43

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes the QQBot local-media delivery path for Windows-origin screenshot workflows. send_message can now hand QQBot media files to the live gateway adapter, and the gateway path extraction helpers now normalize Windows file://... image URLs plus bare absolute Windows media paths so those files are treated as attachments instead of leaked text.

This is adjacent to, but not the same as, the older QQBot live-send PR for #23825: this change specifically covers media-only sends and Windows local path extraction for #26041.

Related Issue

Fixes #26041

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

  • export and track the active QQBot adapter instance across connect/reconnect/disconnect
  • route QQBot send_message media files through the live adapter's native upload methods
  • parse and clean HTML <img src=...> file:// URLs, including Windows drive-letter forms
  • detect absolute Windows media paths in extract_local_files()
  • add regression coverage for QQBot live-adapter routing and Windows local media extraction

How to Test

  1. uv run --frozen --extra dev --extra messaging python -m pytest -o addopts='' tests/gateway/test_platform_base.py tests/gateway/test_extract_local_files.py tests/gateway/test_qqbot.py tests/tools/test_send_message_tool.py
  2. uv run --frozen --extra dev ruff check gateway/platforms/base.py gateway/platforms/qqbot/adapter.py gateway/platforms/qqbot/__init__.py tools/send_message_tool.py tests/gateway/test_platform_base.py tests/gateway/test_extract_local_files.py tests/gateway/test_qqbot.py tests/tools/test_send_message_tool.py
  3. In a live QQBot session, send a tool result containing MEDIA:C:\Users\...\shot.png or <img src="file:///C:/Users/.../shot.png" /> and confirm the screenshot is uploaded as media instead of left in the text body.

Notes

  • Targeted local proof on commit 83ecdeb65e1515876a0078ccba415a219b0a41c3 is green.
  • Recent company Hermes PRs share unrelated GitHub baseline-red lanes; no candidate-specific failure was found locally.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling QQBot media delivery. The Windows raw-path part has since landed on main, but QQBot standalone media delivery remains needed.

Problems

  • The new live-adapter-only route would not cover documented standalone callers. hermes send wraps this shared send engine outside the gateway process (hermes_cli/send_cmd.py:4-20), and cron invokes _send_to_platform() in a fresh event loop (cron/scheduler.py:1902-1904). A process-local adapter singleton cannot be present in those callers.
  • The Windows bare-path extraction changes are superseded by 51d165a8e: current gateway/platforms/base.py:3728-3731 already handles C:\\... and C:/..., with regression tests at tests/gateway/test_extract_local_files.py:342-361.

Suggested changes

  • Re-scope the salvage to a QQBot standalone/direct sender for media, with tests for CLI/cron delivery; retain a live adapter only as an optional fast path.

Automated hermes-sweeper review.

last_result = result
return last_result

# --- QQBot: native media attachment support via running gateway adapter ---

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This branch only works when the caller shares a process with a live QQBot adapter. hermes send and cron invoke the same send engine standalone, so get_active_adapter() will be empty there; please provide a standalone/direct QQBot media sender or an explicit fallback.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows sweeper:blast-broad Sweeper blast radius: broad — a core path most sessions hit labels Jul 13, 2026
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/qqbot QQ Bot adapter sweeper:blast-broad Sweeper blast radius: broad — a core path most sessions hit sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QQBot send_message cannot deliver local screenshot media from Windows paths

3 participants