omi icon indicating copy to clipboard operation
omi copied to clipboard

[Bounty proposal] fix(chart-tools): ensure configurable dictionary mutation and prevent NoneType assignment in create_chart_tool ($50 proposed)

Open Dimank92 opened this issue 1 month ago • 1 comments

Summary

In backend/utils/retrieval/tools/chart_tools.py, create_chart_tool() attaches structured chart data to agent_config_context so that downstream streaming and message post-processing (agentic.py and chat_turn.py) can attach chart_data to the response.

Runtime Bugs & Loss of Data

  1. Silent chart data loss when 'configurable' key is absent:

    config = _agent_config()
    if config:
        configurable = config.get('configurable', {})
        configurable['chart_data'] = chart_data
    

    When config is a dict without an existing 'configurable' key (e.g. {'user_id': '...'}), .get('configurable', {}) returns a temporary new dictionary. Setting configurable['chart_data'] mutates that detached dictionary without updating config, causing chart_data to be silently discarded.

  2. Fatal TypeError: 'NoneType' object does not support item assignment: When config contains 'configurable': None (common in LangChain runnable configurations when configurable is uninitialized), config.get('configurable', {}) returns None. The subsequent configurable['chart_data'] = chart_data raises:

    TypeError: 'NoneType' object does not support item assignment
    

    aborting the tool execution.

  3. Malformed / null numeric data points in datasets: LLM tool calls with None or string-encoded numbers in values can result in uncoerced data types in the frontend wire schema.

Fix

  • Safely initialize and bind config['configurable'] as a dictionary when absent or None.
  • Coerce values and labels to safe float and string representations for hermetic JSON serialization.
  • Add comprehensive unit test suite in backend/tests/unit/test_chart_tools.py.

Bounty Proposal

  • Proposed tier: $50 (Targeted bug fix + unit test coverage)
  • Settlement: Base Mainnet USDC / Stripe / Singapore Card

Dimank92 avatar Oct 21 '26 19: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