omi
omi copied to clipboard
[Bounty proposal] fix(calendar-tools): guard untitled event summary matching, coerce max_results, and validate time ranges ($50 proposed)
Summary
In backend/utils/retrieval/tools/calendar_tools.py:
- AttributeError on untitled events (
summary: None): Indelete_calendar_event_toolandupdate_calendar_event_tool, event matching by title does:
When a calendar event hasmatching_events = [e for e in events if event_title.lower() in e.get('summary', '').lower()]'summary': None(standard in Google Calendar for untitled events, ICS imports, or external integrations),e.get('summary', '')returnsNonerather than''. The subsequent.lower()call raisesAttributeError: 'NoneType' object has no attribute 'lower', terminating tool execution with an unhandled exception. - TypeError on string
max_resultsinget_calendar_events_tool: LLMs callingget_calendar_events_toolvia structured JSON tool calling may providemax_resultsas a numeric string (e.g."10"). Passing a string toensure_capped(max_results, 50, ...)raisesTypeError: '>' not supported between instances of 'str' and 'int'. - Inverted Date Range Handling (
time_max < time_min): If an agent or user requests an inverted range (end_datebeforestart_date), the unvalidated dates are passed downstream to the Google Calendar API, resulting in HTTP 400 Bad Request (Invalid timeMin or timeMax). Furthermore, withsearch_queryset,days_range < 180silently shiftstime_min = time_max - timedelta(days=180). - Missing non-empty validation in
create_calendar_event_tool: Callingcreate_calendar_event_toolwithtitle=Noneor empty/whitespace strings proceeds to passNoneor whitespace as the event summary, andstart_time=None/end_time=Noneraises an unhandledAttributeError: 'NoneType' object has no attribute 'replace'.
Proposed Changes
- Safe Summary Attribute Access: Use
(e.get('summary') or '').lower()indelete_calendar_event_toolandupdate_calendar_event_toolto preventAttributeErroron untitled events. - Coerce and Bound
max_results: Safely castmax_resultstointand bound to1..50inget_calendar_events_tool. - Validate Date Range Inversions: Return clear user-friendly error messages if
time_max < time_minacross all tools without firing failing API requests. - Early String Validation: Validate
title,start_time, andend_timeincreate_calendar_event_toolbefore ISO manipulation. - Unit Test Coverage: Add comprehensive unit tests in
backend/tests/unit/test_calendar_tools.pyverifying each fix hermetically.
Bounty Proposal
- Proposed Tier: $50
- Payout Channel:
- USDC (Polygon / Base / Arbitrum):
0xC345C07229307d4f1c7935aD2cAe48e390215808
- USDC (Polygon / Base / Arbitrum):
Fix implemented and covered by hermetic unit tests in PR #23185.
Bounty Proposal & Claim
- Target Issue: #23184 ($50 proposed)
- PR: https://github.com/BasedHardware/omi/pull/23185
- USDC (Polygon / Base / Arbitrum):
0xC345C07229307d4f1c7935aD2cAe48e390215808
Thanks for putting this together. We aren't doing bounties at the moment, so we're closing the bounty proposal issues for now — thanks for the fix! 🙏