Skip to content

fix: skip empty tool entries in agent_chat config validation#37775

Open
he-yufeng wants to merge 1 commit into
langgenius:mainfrom
he-yufeng:fix/agent-chat-empty-tool
Open

fix: skip empty tool entries in agent_chat config validation#37775
he-yufeng wants to merge 1 commit into
langgenius:mainfrom
he-yufeng:fix/agent-chat-empty-tool

Conversation

@he-yufeng

Copy link
Copy Markdown
Contributor

validate_agent_mode_and_set_defaults iterates agent_mode["tools"] and immediately does key = list(tool.keys())[0], which raises IndexError when a tool entry is an empty dict {} (e.g. from a malformed or legacy/migrated config), crashing config validation.

This adds the same if not tool: continue guard that was already merged for the sibling dataset/manager.py (#37669) and is present in variables/manager.py (#37671), so an empty tool entry is skipped instead of crashing. Added a unit test in test_agent_chat_app_config_manager.py covering the empty-entry case (it raised IndexError before, passes after).

From Claude Code.

Signed-off-by: Yufeng He <40085740+he-yufeng@users.noreply.github.com>
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 50.86% 50.86% -0.00%
Strict coverage 50.37% 50.37% -0.00%
Typed symbols 30,061 30,061 0
Untyped symbols 29,328 29,329 +1
Modules 2920 2920 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant