-
Notifications
You must be signed in to change notification settings - Fork 1
Handle tuple arguments in pytest full suite handler #635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -143,6 +143,24 @@ async def test_handler_detects_list_based_command() -> None: | |
| assert result.should_swallow is True | ||
|
|
||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_handler_detects_tuple_arguments_root_level() -> None: | ||
| handler = PytestFullSuiteHandler(enabled=True) | ||
| context = ToolCallContext( | ||
| session_id="session-tuple", | ||
| backend_name="backend", | ||
| model_name="model", | ||
| full_response={}, | ||
| tool_name="bash", | ||
| tool_arguments=("pytest", "-q"), | ||
| ) | ||
|
|
||
| assert await handler.can_handle(context) is True | ||
| result = await handler.handle(context) | ||
|
|
||
| assert result.should_swallow is True | ||
|
|
||
|
Comment on lines
+146
to
+162
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Type contract violation: tool_arguments should be dict[str, Any]. The test passes a tuple Consider one of these solutions:
To verify the intended behavior, please clarify: 🤖 Prompt for AI Agents |
||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_handler_enabled_flag_controls_behavior() -> None: | ||
| handler = PytestFullSuiteHandler(enabled=False) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
Implementation correctly handles generic sequences.
The change from checking only
listto checking anySequence(excludingstrandbytes) is well-implemented. The exclusion ofstrandbytesis necessary because they're also sequences in Python but shouldn't be split into command components.However, verify the type contract:
ToolCallContext.tool_argumentsis typed asdict[str, Any]in the interface (seesrc/core/interfaces/tool_call_reactor_interface.pylines 17-42), but this code path handles sequences at the root level. This suggests either:ToolCallContextmay need updating todict[str, Any] | Sequence[Any]Run this script to check if
tool_argumentsis passed as a non-dict elsewhere in the codebase:🏁 Script executed:
Length of output: 249
🏁 Script executed:
Length of output: 5079
🏁 Script executed:
Length of output: 6419
🏁 Script executed:
Length of output: 426
Update ToolCallContext.tool_arguments annotation to accept both mappings and sequences
Change its type in src/core/interfaces/tool_call_reactor_interface.py from
to
so it matches the handler’s support for root-level sequences.
🤖 Prompt for AI Agents