fix(gateway): preserve async side-task attachment delivery#6225
Closed
Kolektori wants to merge 1 commit into
Closed
fix(gateway): preserve async side-task attachment delivery#6225Kolektori wants to merge 1 commit into
Kolektori wants to merge 1 commit into
Conversation
Contributor
|
Merged via #37613 (commit 082025a on main). This fixed the same |
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.
What does this PR do?
Fixes attachment delivery in the async gateway side-task paths used by
/backgroundand/btw.Those paths had drifted away from the main gateway response flow, which already
has a dedicated attachment-delivery path. That left the async variants with two
bugs:
could receive the text reply in the right thread and the attachments in the
parent chat
extract_media()returns(path, is_voice)tuples, but/backgroundand/btwtreated those values as plain file paths;/btwalso calledadapter.send_file(...), which is not part of the platform adapter contractThis keeps the fix narrow. The side-task paths now reuse a shared attachment
sender instead of maintaining their own partial copy.
Related Issue
None
Type of Change
Changes Made
_deliver_extracted_attachments()ingateway/run.py_deliver_media_from_response()so streamed andside-task delivery share the same media/file sending logic where it matters
_run_background_task()to preserve thread metadata for image andMEDIA:attachment sends_run_btw_task()to preserve thread metadata and remove thenon-existent
adapter.send_file(...)pathtests/gateway/test_background_command.pyHow to Test
/backgroundwith a responsethat includes both a markdown image and a
MEDIA:/tmp/fileattachment./btwwith a response that includes aMEDIA:/tmp/fileattachment.reply and that
MEDIA:attachments are delivered using the real file path,not the raw tuple returned by
extract_media().Automated regression checks:
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passNotes:
gh pr list --repo NousResearch/hermes-agent --state alldid not find an obvious open or closed PR for this exact async attachment bug.
uv run pytest -q -n 0 tests/gateway/test_background_command.pyuvx ruff check tests/gateway/test_background_command.pyuv run python -m py_compile gateway/run.py tests/gateway/test_background_command.pypytest tests/ -qwas not run for this draft.Documentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
Targeted regression checks: