Skip to content

The agent that grows with you

ci: ASYNC220 ignore follows Popen to run_shutdown.py; windows-only tests patch the defining module; whatsapp taskkill kwargs explicit

Teknium5dcd3b2620cc
diff --git a/plugins/platforms/whatsapp/adapter.py b/plugins/platforms/whatsapp/adapter.py
index e6181966877..1fb24d33156 100644
--- a/plugins/platforms/whatsapp/adapter.py
+++ b/plugins/platforms/whatsapp/adapter.py
@@ -140,7 +140,10 @@ def _terminate_bridge_process(proc, *, force: bool = False) -> None:
action = "kill" if force else "terminate"
if _IS_WINDOWS:
try:
- result = subprocess.run(["taskkill", "/PID", str(proc.pid), "/T"] + (["/F"] if force else []), timeout=10, **_RUN_TEXT)
+ result = subprocess.run(
+ ["taskkill", "/PID", str(proc.pid), "/T"] + (["/F"] if force else []),
+ capture_output=True, text=True, encoding='utf-8', errors='replace', timeout=10,
+ )
except FileNotFoundError:
return getattr(proc, action)()
if result.returncode != 0:
diff --git a/pyproject.toml b/pyproject.toml
index 9f29c87976b..2f630e5576d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -668,6 +668,7 @@ select = ["PLW1514", "ASYNC210", "ASYNC220", "ASYNC221", "ASYNC251"]
# process (no wait), an accepted momentary spawn cost pending a dedicated
# async-subprocess sweep.
"gateway/run.py" = ["ASYNC220"]
+"gateway/run_shutdown.py" = ["ASYNC220"]
"gateway/slash_commands.py" = ["ASYNC220"]
# Off-loop sweep for these routers is in flight (PR #84376).
"hermes_cli/web_routers/profiles.py" = ["ASYNC220", "ASYNC221"]
diff --git a/tests/tools/test_file_tools.py b/tests/tools/test_file_tools.py
index 94020b292de..6f033990c55 100644
--- a/tests/tools/test_file_tools.py
+++ b/tests/tools/test_file_tools.py
@@ -317,7 +317,7 @@ class TestWindowsMsysPathResolution:
"""Windows-only: ``_resolve_path_for_task`` hands the translated path
to ``ntpath``/``Path``, and only a real Windows ``Path`` renders
``C:\\Users\\...`` — faking ``sys.platform`` left PosixPath in place."""
- import tools.file_tools as file_tools
+ import tools.file_tools_paths as file_tools
monkeypatch.setattr(file_tools, "_uses_container_paths", lambda task_id="default": False)
@@ -332,7 +332,7 @@ class TestWindowsMsysPathResolution:
Windows-only: the translation this guards against only happens when
the host really is Windows, so the negative is only meaningful there.
"""
- import tools.file_tools as file_tools
+ import tools.file_tools_paths as file_tools
monkeypatch.setattr(file_tools, "_uses_container_paths", lambda task_id="default": True)
monkeypatch.setattr(