omi icon indicating copy to clipboard operation
omi copied to clipboard

[Bounty proposal] fix(calendar-render): guard none start and end dictionaries and sanitize attendee labels ($50 proposed)

Open Dimank92 opened this issue 1 month ago • 2 comments

Summary

In ackend/utils/retrieval/tools/calendar_render.py:

  1. 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.
  2. 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).
  3. ll_day_date does not guard alue=None or unhandled whitespace.
  4. There are no unit tests for calendar_render.py in ackend/tests/unit.

Proposed Changes

  1. Safe Dictionary Fallbacks: Ensure start and end are strictly validated as dictionaries (start_dict = start if isinstance(start, dict) else {}) before inspecting keys.
  2. Fallback for Missing/Unknown Timestamps: Safely append When: unknown time (event timestamp could not be parsed) if neither valid dateTime nor date is present.
  3. Attendee Sanitization: Filter out None entries and properly format DisplayName without stringifying None.
  4. All-Day Date Guard: Return None cleanly if alue is None or invalid string.
  5. 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.

Dimank92 avatar Oct 21 '26 20:10 Dimank92

PR created with hermetic unit tests: https://github.com/BasedHardware/omi/pull/23131

Dimank92 avatar Oct 21 '26 20:10 Dimank92

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! 🙏

undivisible avatar Oct 22 '26 12:10 undivisible