Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion libs/agno/agno/os/interfaces/whatsapp/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,11 @@ def _extract_media_bytes(media_obj) -> Optional[bytes]:
except (UnicodeDecodeError, Exception):
return content
elif isinstance(content, str):
return base64.b64decode(content)
try:
return base64.b64decode(content)
except Exception:
log_warning("Failed to decode base64 content: not valid base64 data")
return None
Comment on lines +372 to +376
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

The base64 decode error handling fix in _extract_media_bytes() for the str branch is not covered by any test. The PR description identifies this as a crash fix for a previously unhandled case. A unit test should be added that passes a mock media_obj whose .content is a non-base64 string (e.g., a file path like "/tmp/audio.mp3") and verifies that the function returns None without raising.

Copilot uses AI. Check for mistakes.
return None

def _send_whatsapp_message(tools: WhatsAppTools, recipient: str, message: str, italics: bool = False):
Expand Down
2 changes: 1 addition & 1 deletion libs/agno/agno/tools/whatsapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ReplyButton(BaseModel):
"""A quick-reply button."""

id: str = Field(..., description="Unique button identifier (e.g. 'yes', 'no').")
title: str = Field(..., description="Button display text, max 20 characters.")
title: str = Field(..., max_length=20, description="Button display text, max 20 characters.")
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

The new max_length=20 constraint on ReplyButton.title is not covered by any test. The existing test suite is comprehensive (other boundary conditions like test_send_reply_buttons_max_3 are tested), and this validation fix is the primary code change in whatsapp.py. A test should be added that constructs a ReplyButton with a title longer than 20 characters and asserts that Pydantic raises a ValidationError.

Copilot uses AI. Check for mistakes.


class ListRow(BaseModel):
Expand Down