Summary
The WebSocketChannel._dispatch_envelope() ignores the media field from inbound WebSocket message envelopes. When a client sends a message with file/image attachments via the media JSON field, the paths are silently dropped — the agent never receives them.
Steps to Reproduce
- Start a nanobot container with WebSocket channel enabled
- Connect a client via WebSocket at
ws://host:8765
- Subscribe by sending:
{"event": "attach", "chat_id": "test"}
- Send a message WITH a media attachment:
{
"type": "message",
"chat_id": "test",
"content": "analyze this image",
"media": ["/path/to/image.jpg"]
}
- The agent responds as if no image was attached — the
media field is completely ignored
Root Cause
In nanobot/channels/websocket.py, the _dispatch_envelope method extracts content from the envelope but never extracts media. The _handle_message() call is missing media=media:
# Current (broken):
if t == "message":
cid = envelope.get("chat_id")
content = envelope.get("content")
...
await self._handle_message(
sender_id=client_id,
chat_id=cid,
content=content,
metadata={...},
)
Fix
PR #3673 adds:
media = envelope.get("media") extraction from the envelope
- Allow media-only messages (content can be empty if media is present)
- Pass
media to _handle_message()
- Safe content default with
or ""
Impact
Any nanobot running with WebSocket channel cannot receive media attachments from clients. The HTTP streaming channel (OpenAI API on port 18791) works because it receives media via the standard OpenAI message format, but the WebSocket channel is broken for media.
Workaround
Route media messages through the OpenAI-compatible API (nanobot serve on port 18791) instead of the WebSocket channel, or apply the patch from PR #3673.
Summary
The
WebSocketChannel._dispatch_envelope()ignores themediafield from inbound WebSocket message envelopes. When a client sends a message with file/image attachments via themediaJSON field, the paths are silently dropped — the agent never receives them.Steps to Reproduce
ws://host:8765{"event": "attach", "chat_id": "test"}{ "type": "message", "chat_id": "test", "content": "analyze this image", "media": ["/path/to/image.jpg"] }mediafield is completely ignoredRoot Cause
In
nanobot/channels/websocket.py, the_dispatch_envelopemethod extractscontentfrom the envelope but never extractsmedia. The_handle_message()call is missingmedia=media:Fix
PR #3673 adds:
media = envelope.get("media")extraction from the envelopemediato_handle_message()or ""Impact
Any nanobot running with WebSocket channel cannot receive media attachments from clients. The HTTP streaming channel (OpenAI API on port 18791) works because it receives media via the standard OpenAI message format, but the WebSocket channel is broken for media.
Workaround
Route media messages through the OpenAI-compatible API (
nanobot serveon port 18791) instead of the WebSocket channel, or apply the patch from PR #3673.