chore: Avoid mutable default arguments in local_eval_service and runners

Changed default values for `session_service`, `artifact_service`, and `run_config` from instances of mutable classes to `None`. Instances are now created within the function body if the argument is not provided, preventing unexpected shared state across function calls.

PiperOrigin-RevId: 804624564
This commit is contained in:
Google Team Member
2025-09-08 16:11:24 -07:00
committed by Copybara-Service
parent d56dd08072
commit 64f11a6a67
3 changed files with 9 additions and 21 deletions
+1 -3
View File
@@ -21,7 +21,6 @@ import sys
import tempfile
import time
from typing import Any
from typing import Optional
from unittest.mock import MagicMock
from unittest.mock import patch
@@ -121,9 +120,8 @@ async def dummy_run_async(
session_id,
new_message,
state_delta=None,
run_config: Optional[RunConfig] = None,
run_config: RunConfig = RunConfig(),
):
run_config = run_config or RunConfig()
yield _event_1()
await asyncio.sleep(0)