omi
omi copied to clipboard
[Bounty proposal] fix(demand-processing-tools): add config resilience, clamp hours/limit, and guard UID ($50 proposed)
Summary
In backend/utils/retrieval/tools/demand_processing_tools.py, several input coercions and edge cases in process_recent_conversations can cause unhandled runtime exceptions (AttributeError, TypeError, or crashes during LangChain invocations):
config.get('configurable', {}).get('user_id')crash whenconfigurableisNoneor config missing:- If
configis{'configurable': None}orNone, calling.get('configurable', {}).get('user_id')raisesAttributeError: 'NoneType' object has no attribute 'get'. configwas also required as a positional argument without default= None, raisingTypeError: missing 1 required positional argumenton direct calls.
- If
- Unbounded and uncoerced
hoursandlimit:- The tool docstring states:
Bounded to the last six hours and twenty obligations. - However,
hoursandlimitwere passed directly without clamping or coercing numeric string inputs, allowing unbounded or invalid negative/oversized values.
- The tool docstring states:
- Top-level UID fallback:
- Top-level
user_idoruidkeys inconfigare now supported for integration tests and custom runners.
- Top-level
- Error handling:
- Exceptions during processing are caught, logged with sanitization, and return a clean failure JSON (
{"ready": False, "error": ...}) instead of crashing the turn.
- Exceptions during processing are caught, logged with sanitization, and return a clean failure JSON (
Proposed Changes
- Resilient
_resolve_uid(config): Extract user ID safely from nested configurable or top-level config. - Make
config: RunnableConfig = NoneOptional: Prevent positional argument errors when invoked without config. - Clamping & Coercion:
Clamp
hoursto 1..6 andlimitto 1..20 as documented, safely coercing string numbers. - Hermetic Unit Tests:
Add
backend/tests/unit/test_demand_processing_tools_guards.pyverifying UID resolution, clamping, error handling, and permission checks (5 tests, 100% pass).
Bounty Proposal
Proposed bounty: $50 USDC
Payout address: 0xC345C07229307d4f1c7935aD2cAe48e390215808 (USDC Polygon/Base/Arbitrum)
I have implemented the complete fix and hermetic unit tests in PR #23246.
- Pull Request: https://github.com/BasedHardware/omi/pull/23246
- Unit Tests: 5/5 passing hermetically
- Payout Address:
0xC345C07229307d4f1c7935aD2cAe48e390215808(USDC Polygon/Base/Arbitrum)
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! 🙏