Skip to content

The agent that grows with you

ci: address code review comments

Maciej Lisiewskic0fc6876855f
diff --git a/agent/secret_sources/onepassword.py b/agent/secret_sources/onepassword.py
index 2e260b8b417..5ccb13d20bc 100644
--- a/agent/secret_sources/onepassword.py
+++ b/agent/secret_sources/onepassword.py
@@ -14,7 +14,7 @@ from __future__ import annotations
import logging
import os
import shutil
-import subprocess
+import subprocess # tests monkeypatch ``op.subprocess.run``; production goes through run_cli
import time
from pathlib import Path
from typing import Dict, List, Optional, Tuple
diff --git a/cli.py b/cli.py
index 1d4a8867eab..ce818e560e8 100644
--- a/cli.py
+++ b/cli.py
@@ -11,6 +11,8 @@ except ModuleNotFoundError as exc:
import logging
import os
import functools
+# Tests patch shutil/time/datetime through the cli facade; siblings also resolve datetime
+# lazily through it — these imports are load-bearing despite being unused in this file.
import shutil
import sys
import re
diff --git a/hermes_cli/model_data_policy_guard.py b/hermes_cli/model_data_policy_guard.py
index bad61021661..db0289f35b0 100644
--- a/hermes_cli/model_data_policy_guard.py
+++ b/hermes_cli/model_data_policy_guard.py
@@ -58,6 +58,7 @@ def data_training_warning(
model_name: str,
*,
provider: Optional[str] = None,
+ # Reserved for host-scoped rules (e.g. third-party relays) — unused for now, on purpose.
base_url: Optional[str] = None,
) -> Optional[DataTrainingWarning]:
"""Warning payload when *model_name* selects a data-training tier, else ``None``. Call after model
diff --git a/tests/hermes_cli/test_real_home_tripwire.py b/tests/hermes_cli/test_real_home_tripwire.py
index 9db9e1e87a4..6c3898a77e5 100644
--- a/tests/hermes_cli/test_real_home_tripwire.py
+++ b/tests/hermes_cli/test_real_home_tripwire.py
@@ -35,7 +35,9 @@ def _open_close(path):
def _io_open_close(path):
- with open(path, encoding="utf-8"):
+ # io.open is a separate guarded entry point from builtins.open (HomeIOGuard wraps both);
+ # bare `open` would only re-exercise the builtin-open case above.
+ with io.open(path, encoding="utf-8"): # noqa: UP020 — exercise io.open separately
pass
diff --git a/tools/bot_desktop/lease.py b/tools/bot_desktop/lease.py
index bfefdc4e274..1d540cf1da1 100644
--- a/tools/bot_desktop/lease.py
+++ b/tools/bot_desktop/lease.py
@@ -161,7 +161,12 @@ def on_change(listener: Callable[[str, Lease], None]) -> Callable[[], None]:
def _notify(key: str, lease: Lease) -> None:
- for cb in _listeners:
+ # Snapshot under the lock: a viewer disconnecting on another thread runs unsubscribe()
+ # concurrently with this loop; removing an entry from the live list mid-iteration skips
+ # the next listener, and a still-connected viewer misses the lease transition.
+ with _lock:
+ listeners = list(_listeners)
+ for cb in listeners:
try:
cb(key, lease)
except Exception: # a broken subscriber must not wedge the handoff