Agent Zero AI framework
Cover top-level parallel arg mutation in regression test
sparkb87fc7842da6
diff --git a/tests/test_parallel_tool_args.py b/tests/test_parallel_tool_args.pyindex bed8b6e12..ab76a31cf 100644--- a/tests/test_parallel_tool_args.py+++ b/tests/test_parallel_tool_args.py@@ -12,7 +12,9 @@ class _Response:@pytest.mark.asyncio-async def test_parallel_execute_applies_hook_mutations_to_tool_args(monkeypatch) -> None:+async def test_parallel_execute_applies_hook_mutations_to_tool_args(+ monkeypatch,+) -> None:observed = {}class FakeTool:@@ -43,35 +45,28 @@ async def test_parallel_execute_applies_hook_mutations_to_tool_args(monkeypatch)async def handle_intervention(self):pass- async def unmask_nested_secret(*_args, **kwargs):+ async def unmask_secret(*_args, **kwargs):if not _args or _args[0] != "tool_execute_before":returntool_args = kwargs["tool_args"]- tool_args["tool_calls"][0]["tool_args"]["code"] = tool_args["tool_calls"][0][- "tool_args"- ]["code"].replace("§§secret(TOKEN)", "resolved-secret")+ tool_args["code"] = tool_args["code"].replace(+ "§§secret(TOKEN)", "resolved-secret"+ )- monkeypatch.setattr(- parallel_tools, "call_extensions_async", unmask_nested_secret- )+ monkeypatch.setattr(parallel_tools, "call_extensions_async", unmask_secret)+ worker_args = {"code": "curl -H 'Authorization: Bearer §§secret(TOKEN)'"}result = await parallel_tools.execute_tool_call(FakeAgent(), # type: ignore[arg-type]"code_execution_tool",- {- "tool_calls": [- {- "tool_name": "code_execution_tool",- "tool_args": {- "code": "curl -H 'Authorization: Bearer §§secret(TOKEN)'"- },- }- ]- },+ worker_args,)assert result == "done"- assert observed["tool_args"]["tool_calls"][0]["tool_args"]["code"] == (+ assert observed["tool_args"] is worker_args+ assert observed["tool_args"]["code"] == (+ "curl -H 'Authorization: Bearer resolved-secret'"+ )+ assert observed["kwargs"]["code"] == ("curl -H 'Authorization: Bearer resolved-secret'")- assert observed["kwargs"] == observed["tool_args"]