Add regression tests for tool_calls assignment in assistant message#1
Open
devin-ai-integration[bot] wants to merge 2 commits into
Open
Add regression tests for tool_calls assignment in assistant message#1devin-ai-integration[bot] wants to merge 2 commits into
devin-ai-integration[bot] wants to merge 2 commits into
Conversation
Tests verify that: - tool_calls is present and correctly assigned when LLM returns tool calls - tool_calls key is absent when LLM returns no tool calls - Multiple tool calls are all correctly assigned - Content field is preserved regardless of tool_calls presence Guards against regression of the bug fixed in 99c1873 where tool_calls was always included in the assistant message dict even when empty. Co-Authored-By: Nataly Andries <patrinat@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: Nataly Andries <patrinat@gmail.com>
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
Adds a test suite (
01-tools/tests/test_agent.py) that guards against the bug fixed in commit 99c1873, wheretool_callswas unconditionally included in the assistant message dict — even as an empty list — which could cause issues with LLM providers that reject emptytool_calls.The four tests cover:
tool_callsis present and correctly structured when the LLM returns tool callstool_callskey is absent when the LLM returns no tool calls (the core regression check)contentfield is preserved correctly in both cases within a single multi-turn conversationTests mock
LLMProvider.chat()andToolRegistry.execute_toolso no real API keys or tool execution is needed.Review & Testing Checklist for Human
01-tools. The same fix was applied to all 17 step directories, and theiragent.pyfiles diverge (e.g., event-driven steps 07+ have different structure). Decide whether regression tests should also cover at least one of the later steps (e.g.,07-event-drivenor15-agent-dispatch).cd 01-tools && pip install -e . && pip install pytest pytest-asyncio && python -m pytest tests/test_agent.py -v— verify all 4 tests pass.Notes
FakeAgentDefdataclass avoids pulling in the full config/loader stack by providing just theagent_mdfield needed bySessionState.build_messages().Link to Devin session: https://app.devin.ai/sessions/ff9168be75af4dec91fa687c596c2359
Requested by: @tashik