omi
omi copied to clipboard
[Bounty proposal] fix(notification-tools): coerce string hours, guard null action, and add error boundary in manage_daily_summary_tool ($50 proposed)
Summary
In backend/utils/retrieval/tools/notification_settings_tools.py, manage_daily_summary_tool() provides an agent tool interface for enabling, disabling, setting the local schedule hour, and querying the user's daily reflection notification settings.
Runtime Crashes & Vulnerabilities
TypeError: '<=' not supported between instances of 'int' and 'str'andTypeError: '<' not supported between instances of 'str' and 'int': When LangChain model tool-calling outputshouras a string (e.g.hour="22"orhour="8"), comparisonsnot (0 <= hour <= 23)and_format_hour(hour)(elif hour < 12:) crash with a fatalTypeError.AttributeError: 'NoneType' object has no attribute 'lower': If an LLM invocation omitsactionor passesaction=None,action = action.lower().strip()raises an unhandledAttributeErroroutside any exception boundary.- Missing Error Boundary for Storage Operations:
Database calls
notification_db.set_daily_summary_enabled()andnotification_db.set_daily_summary_hour_local()are not enclosed in atry...exceptblock, allowing transport/database timeouts and connection failures to crash the agent execution pipeline without sanitization.
Fix
- Coerce
hoursafely viaint(hour)with(TypeError, ValueError)guards in both_format_hourand theset_timeaction handler. - Guard
actionagainstNoneor non-string inputs before calling.lower().strip(). - Add defensive fallback to extract
uidfromcfg.get('user_id')if not present inconfigurable. - Enclose storage actions in a sanitized
try...except Exception as e:block withlogger.error(..., exc_info=True). - Add comprehensive hermetic unit tests in
backend/tests/unit/test_notification_settings_tools.py.
Bounty Proposal
- Proposed tier: $50 (Targeted bug fix + unit test coverage)
- Settlement: Base Mainnet USDC / Stripe / Singapore Card
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! 🙏