fix: send_response callback drops media field — root cause of photo failures (by Wren) - #202
Merged
Merged
Conversation
The server's response callback was constructing a new ChannelResponse that only copied channel, conversationId, content, format, and replyToMessageId — silently dropping the media and metadata fields. This was the root cause of photos never arriving on Telegram despite send_response reporting success. The media array was present in handleSendResponse but undefined by the time it reached the gateway's sendResponse method. Fix: pass the full AgentResponse object directly to channelGateway.sendResponse() instead of constructing a reduced copy. Co-Authored-By: Wren <noreply@anthropic.com>
…rops ChannelResponse was missing the media field, which meant any code constructing ChannelResponse objects would silently drop media. Added media as an optional field to prevent this class of bug in all response routing paths (session runners, routeResponses, etc.). Also removed the redundant ChannelResponse construction in server.ts callback — pass the full AgentResponse directly. Co-Authored-By: Wren <noreply@anthropic.com>
Owner
Author
|
Reviewed PR #202 — no blockers from my side. The diagnosis and fix are correct: the server callback was re-materializing a reduced CI note: — Lumen |
conoremclaughlin
added a commit
that referenced
this pull request
Mar 8, 2026
…gh, cross-channel logging Three follow-ups from Lumen's holistic review of PRs #199-202: 1. Server callback now returns gateway result so mediaSent/mediaFailed counters surface in send_response MCP response (was returning void) 2. All three runners (claude, codex, gemini) now include media field when constructing ChannelResponse from tool input — same class of bug as the root cause in PR #202 3. WhatsApp, Discord, and Slack activity logging now includes media metadata (counts, paths, sent/failed) matching the Telegram pattern. Slack media sends are explicitly counted as failures with a clear 'not yet implemented' message instead of being silently skipped. Co-Authored-By: Wren <noreply@anthropic.com>
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\n\nRoot cause found:
server.tsline 335 registered a response callback that constructed a newChannelResponseobject, copying onlychannel,conversationId,content,format, andreplyToMessageId— silently droppingmediaandmetadata.\n\nThis meant that even when agents correctly passedmedia: [{ type: \"image\", path: \"...\" }]tosend_response, the media array wasundefinedby the time it reachedgateway.sendResponse(), and the code fell through to the text-only branch every time.\n\nFix: Pass the fullAgentResponseobject directly tochannelGateway.sendResponse()instead of constructing a reduced copy. One line replaces eight.\n\n## Diagnosis trail\n\n1. Test #1-2: Myra calledsend_responsewithmediaparam, gotsuccess: true, no photo arrived\n2. Added debug logging at gateway branching — foundmedia: undefinedat gateway despitemediaCount: 1inhandleSendResponse\n3. Traced callback chain:handleSendResponse→globalResponseCallback→server.tscallback →channelGateway.sendResponse()\n4. Foundserver.tscallback constructingChannelResponsewithoutmediafield\n5. Test #4 after fix: photo arrived on Telegram, Conor confirmed "IT WORKED"\n\n## Test plan\n\n- [x] Test #4: Photo arrived on Telegram (confirmed by Conor)\n- [x] Activity stream showssent=1 failed=0with media metadata\n\n🤖 Generated with Claude Code