[Bounty proposal] fix(action-item-tools): resolve top-level user_id, coerce limit/offset, and guard None configurable ($50 proposed)
Summary
In backend/utils/retrieval/tools/action_item_tools.py, get_action_items_tool, create_action_item_tool, and update_action_item_tool manage user tasks and to-do items.
Runtime Crashes & Vulnerabilities
-
Broken
user_idresolution for top-level configurations and None configurable:- In
get_action_items_tool:
Whenif 'configurable' not in cfg: return "Error: Configuration format invalid" configurable: Any = cfg.get('configurable') uid = configurable.get('user_id')configis a dictionary with top-leveluser_id(e.g.{"user_id": "test_uid"}),'configurable' not in cfgreturns an error. Whenconfigurableis present butNone({'configurable': None}), calling.get('user_id')crashes withAttributeError: 'NoneType' object has no attribute 'get'. - In
create_action_item_toolandupdate_action_item_tool:
Whenconfigurable: Any = cfg.get('configurable') uid = configurable.get('user_id')configurableisNone,.get('user_id')crashes withAttributeError, aborting execution.
- In
-
Fatal
TypeError: '>' not supported between instances of 'str' and 'int'on stringlimit: Inget_action_items_tool(limit: int = 50, offset: int = 0, ...): When an LLM agent provides arguments with string numbers (e.g.limit="50"oroffset="0"):if limit > 500:In Python 3, evaluating
str > intimmediately raisesTypeError: '>' not supported between instances of 'str' and 'int', crashing the tool invocation. -
Missing input sanitization on
descriptionandaction_item_id:- In
create_action_item_tool,description.strip()crashes withAttributeErrorifdescriptionisNone. - In
update_action_item_tool, passing emptyaction_item_idcauses downstream query failure without immediate validation.
- In
Fix
- Introduced
_extract_user_context(cfg)helper extractinguser_idfrom either nestedconfigurableor top-levelcfg, safely defaultingconfigurableto{}. - Defensively coerced and clamped
limitto[1, 500]andoffsetto>= 0, preventingTypeError. - Normalized and validated non-empty
descriptionandaction_item_id. - Added comprehensive hermetic unit tests in
backend/tests/unit/test_action_item_tools.py.
Bounty Proposal
- Proposed tier: $50 (Targeted bug fix + unit test coverage)
- Settlement: Base Mainnet USDC / Stripe / Singapore Card
Resolved in PR #23110. Added _extract_user_context helper for robust user_id resolution, limit/offset integer coercion, input validation, and full unit test suite in backend/tests/unit/test_action_item_tools.py.
Fix submitted via #23118 with comprehensive unit tests (9/9 passing).
- Safely resolves top-level and nested user_id with
Noneconfigurable guards. - Coerces and clamps limit [1, 500] and offset >= 0, preventing
TypeError. - Validates required description and action_item_id.
Payout address (Base USDC): 0xb95e2AD8E9D9e9BF902c7531577Cd0E1ceB203D4
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! 🙏