fix(gateway): unpack extract_media tuples in background task delivery#12091
Closed
truenorth-lj wants to merge 2 commits into
Closed
fix(gateway): unpack extract_media tuples in background task delivery#12091truenorth-lj wants to merge 2 commits into
truenorth-lj wants to merge 2 commits into
Conversation
After the first compression, reduce head protection from protect_first_n to 1 (system message only). Previously, the first N messages were preserved verbatim across every compression cycle, causing "fossilized" messages that survived indefinitely even after being summarized. The system message (index 0) is always preserved. User/assistant messages in positions 1..protect_first_n are only protected during the first compression — subsequent compressions include them in the summarization window since their content is already captured in the summary. Closes NousResearch#11996 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
_run_background_task and the /btw handler were passing extract_media tuples directly to send_document/send_file instead of routing by file type. Now both consumers unpack (path, is_voice) and dispatch to the correct send method (send_voice, send_video, send_image_file, or send_document) based on file extension, matching the behavior in base.py and _deliver_streaming_media. Closes NousResearch#12064 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5 tasks
This was referenced Apr 23, 2026
Collaborator
Contributor
|
Merged via #37613 (commit 082025a on main). Since this branch was filed, the tuple-unpacking bug and the |
19 tasks
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.
Summary
_run_background_taskand/btwhandler to properly unpack(path, is_voice)tuples fromextract_media()and route media files by extension (audio →send_voice, video →send_video, image →send_image_file, other →send_document)send_document/send_file, ignoring file type entirelybase.py._process_message_backgroundand_deliver_streaming_mediaChanges
gateway/run.py—_run_background_task: replace flatsend_documentloop with extension-based routing matchingbase.py:1855-1888gateway/run.py—/btwhandler: replacesend_file(non-existent method) call with same extension-based routingtests/gateway/test_background_command.py— add regression test verifying all four media types are routed to the correct send methodTest plan
test_media_files_routed_by_typepasses — verifies.ogg→send_voice,.mp4→send_video,.png→send_image_file,.pdf→send_documenttest_background_command.pytests pass/backgroundwith a TTS prompt → voice message should arrive as voice bubble, not documentCloses #12064
🤖 Generated with Claude Code