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: 804560641
This commit is contained in:
George Weale
2025-09-08 13:21:05 -07:00
committed by Copybara-Service
parent ca5f7f1ff0
commit 5b465fd71b
3 changed files with 21 additions and 9 deletions
+3 -1
View File
@@ -21,6 +21,7 @@ import sys
import tempfile
import time
from typing import Any
from typing import Optional
from unittest.mock import MagicMock
from unittest.mock import patch
@@ -120,8 +121,9 @@ async def dummy_run_async(
session_id,
new_message,
state_delta=None,
run_config: RunConfig = RunConfig(),
run_config: Optional[RunConfig] = None,
):
run_config = run_config or RunConfig()
yield _event_1()
await asyncio.sleep(0)