omi icon indicating copy to clipboard operation
omi copied to clipboard

[Bounty proposal] fix(action-item-tools): guard string numeric coercion, fallback top-level config, and validate inputs ($50 proposed)

Open Dimank92 opened this issue 1 month ago • 2 comments

Summary

In backend/utils/retrieval/tools/action_item_tools.py, several input coercions and edge cases in get_action_items_tool, create_action_item_tool, and update_action_item_tool lead to runtime exceptions or failed tool executions:

  1. String numeric coercion failure (TypeError: '>' not supported between instances of 'str' and 'int'):
    • In get_action_items_tool: If limit or offset are passed as numeric strings by an LLM agent (e.g. limit="50" or offset="0"), the bounds check if limit > 500: raises TypeError: '>' not supported between instances of 'str' and 'int'.
  2. Missing top-level config and UID resolution:
    • In get_action_items_tool, create_action_item_tool, and update_action_item_tool: The code assumed configurable = cfg.get('configurable') is always a non-None dictionary. If callers pass top-level {"user_id": "..."} or {"uid": "..."}, or if configurable is None, this crashes with AttributeError: 'NoneType' object has no attribute 'get' or rejects valid configurations with "Error: Configuration format invalid".
  3. Non-string date values crash on .replace():
    • In get_action_items_tool, create_action_item_tool, and update_action_item_tool: If an agent passes non-string types for start_date, end_date, due_start_date, due_end_date, or due_at (e.g. integer timestamps or booleans), .replace('Z', '+00:00') raises AttributeError.
  4. Description and ID validation:
    • In create_action_item_tool: Calling .strip() on non-string or None description raises AttributeError.
    • In update_action_item_tool: Updating an item with empty/whitespace description (description="") was unvalidated, and missing/empty action_item_id lacked clean early validation.

Proposed Changes

  1. Safe Integer Coercion Helper (_safe_int): Safely parse integers and numeric strings while rejecting booleans, None, and invalid text.
  2. Resilient Config & UID Extraction (_get_config_and_uid): Safely handle non-dict or absent configurable dictionaries and resolve uid from configurable['user_id'], top-level user_id, or uid across config and agent_config_context.
  3. Safe Date Formatting: Validate that date arguments are strings before calling .replace('Z', '+00:00').
  4. Input Guards: Validate description string presence in create_action_item_tool, validate non-empty action_item_id and non-empty description in update_action_item_tool.
  5. Hermetic Unit Tests: Add backend/tests/unit/test_action_item_tools_guards.py verifying integer coercion, top-level UID resolution, date guards, and description/ID validations (8 tests, 100% pass).

Bounty Proposal

Proposed bounty: $50 USDC Payout address: 0xC345C07229307d4f1c7935aD2cAe48e390215808 (USDC Polygon/Base/Arbitrum)

Dimank92 avatar Oct 22 '26 05:10 Dimank92

Fix and hermetic test suite opened in PR #23227: https://github.com/BasedHardware/omi/pull/23227

Payout address (USDC Polygon / Base / Arbitrum): 0xC345C07229307d4f1c7935aD2cAe48e390215808

Dimank92 avatar Oct 22 '26 05: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