fix: handle explicit None for look_back_days/limit in alpha_vantage get_global_news - #1336
Open
prithvirajrh wants to merge 1 commit into
Open
Conversation
…et_global_news The LLM-facing get_global_news tool documents that passing None for look_back_days/limit inherits the configured default, but the Alpha Vantage vendor implementation only handled omitted arguments via literal defaults (=7, =50). An explicit None (as agents actually send) bypassed those defaults and crashed inside timedelta(days=None). Bring it in line with the yfinance vendor's existing convention: resolve None from DEFAULT_CONFIG's global_news_lookback_days / global_news_article_limit. Fixes TauricResearch#1326. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W8ioPGbswhsFA6EhBaZNbT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_global_newsLLM tool documents that passingNoneforlook_back_days/limitinherits the configured default (seetradingagents/agents/utils/news_data_tools.py), but the Alpha Vantage vendor implementation only handled omitted arguments via literal defaults (=7,=50). When the LLM tool call explicitly passeslook_back_days=None/limit=None(as reported in [Bug]: unexpected NoneType of timedelta #1326), those literal defaults are bypassed and the call crashes insidetimedelta(days=None).alpha_vantage_news.get_global_newsin line with the existing convention already used by the yfinance vendor (yfinance_news.get_global_news_yfinance): resolveNoneviaget_config()'sglobal_news_lookback_days/global_news_article_limit.Fixes #1326.
Test plan
test_global_news_none_args_use_config_defaultstotests/test_alpha_vantage_hardening.py, verifyingNoneargs resolve to config defaults and the vendor call succeeds instead of raising.main(pre-fix) and passes with the fix.677 passed, 2 skipped(skips are pre-existing, due to an optional dependency and a missing live API key, unrelated to this change).🤖 Generated with Claude Code
https://claude.ai/code/session_01W8ioPGbswhsFA6EhBaZNbT