omi
omi copied to clipboard
[Bounty proposal] fix(calendar-render): guard none start and end dictionaries and sanitize attendee labels ($50 proposed)
Summary
In ackend/utils/retrieval/tools/calendar_render.py:
- ender_calendar_event extracts start = event.get('start', {}) and end = event.get('end', {}). When an event dictionary contains 'start': None or 'end': None (e.g. from Google Calendar API or third-party webhooks), .get('start', {}) returns None. Subsequent membership checks (if 'dateTime' in start: and 'date' in end) raise an unhandled TypeError: argument of type 'NoneType' is not a container or iterable, crashing the entire get_calendar_events_tool and get_upcoming_calendar_events_tool.
- When parsing attendee objects, if an attendee entry in the ttendees list is None, it is converted to string literal "None", polluting the rendered LLM context (Attendees (1): None).
- ll_day_date does not guard alue=None or unhandled whitespace.
- There are no unit tests for calendar_render.py in ackend/tests/unit.
Proposed Changes
- Safe Dictionary Fallbacks: Ensure start and end are strictly validated as dictionaries (start_dict = start if isinstance(start, dict) else {}) before inspecting keys.
- Fallback for Missing/Unknown Timestamps: Safely append When: unknown time (event timestamp could not be parsed) if neither valid dateTime nor date is present.
- Attendee Sanitization: Filter out None entries and properly format DisplayName
without stringifying None. - All-Day Date Guard: Return None cleanly if alue is None or invalid string.
- Hermetic Unit Tests: Add ackend/tests/unit/test_calendar_render.py verifying None start/end handling, dateTime span rendering, all-day multi-day ranges, attendee sanitization, and description truncation notes.
Bounty: $50 proposed.
PR created with hermetic unit tests: https://github.com/BasedHardware/omi/pull/23131
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! 🙏