[Bounty proposal] fix(chart-tools): ensure configurable dictionary mutation and prevent NoneType assignment in create_chart_tool ($50 proposed)
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
-
Silent chart data loss when
'configurable'key is absent:config = _agent_config() if config: configurable = config.get('configurable', {}) configurable['chart_data'] = chart_dataWhen
configis a dict without an existing'configurable'key (e.g.{'user_id': '...'}),.get('configurable', {})returns a temporary new dictionary. Settingconfigurable['chart_data']mutates that detached dictionary without updatingconfig, causingchart_datato be silently discarded. -
Fatal
TypeError: 'NoneType' object does not support item assignment: Whenconfigcontains'configurable': None(common in LangChain runnable configurations whenconfigurableis uninitialized),config.get('configurable', {})returnsNone. The subsequentconfigurable['chart_data'] = chart_dataraises:TypeError: 'NoneType' object does not support item assignmentaborting the tool execution.
-
Malformed / null numeric data points in datasets: LLM tool calls with
Noneor string-encoded numbers invaluescan result in uncoerced data types in the frontend wire schema.
Fix
- Safely initialize and bind
config['configurable']as a dictionary when absent orNone. - Coerce
valuesandlabelsto 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
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! 🙏