The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(registries): reads resolve None to the active home scope; calm windows CI
ethernet9a81c291b9f4
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.ymlindex f245708486f..465ad809076 100644--- a/.github/workflows/docker.yml+++ b/.github/workflows/docker.yml@@ -172,9 +172,9 @@ jobs:NOUS_API_KEY: ""run: |# Each of these tests drives a container, so the docker daemon sets- # the limit and not the processor. This caps the workers. The- # default from run_tests.sh is cpu_count*2, which starts 64- # containers together on the 32-core amd64 runner.+ # the limit and not the processor. This pins the workers explicitly+ # (nproc) so the comment and behavior stay coupled if the runner's+ # core count or the default ever changes.HERMES_TEST_WORKERS=$(nproc) scripts/run_tests.sh tests/docker/ --file-timeout 600# ---------------------------------------------------------------------------diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex d2e5b44859e..d806e7ab1c7 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -31,14 +31,17 @@ jobs:runner: ubuntu-latest-96-coremarker: ""workers: "96"+ file_timeout: ""- os: windowsrunner: windows-latest-32-coremarker: ""workers: ""+ file_timeout: "900"- os: macosrunner: macos-latestmarker: macos_onlyworkers: ""+ file_timeout: ""steps:- name: Checkout codeuses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2@@ -164,12 +167,19 @@ jobs:# bin/ and the Windows Scripts/ layout), so no per-OS activation.scripts/run_tests.shenv:- # The maximum number of test FILES that run together (Linux, from- # the measured whole-suite sweep — one worker per core is fastest on- # the 96-core runner, and the curve is shallow). Windows and macOS- # leave this unset so run_tests_parallel.py falls back to- # cpu_count*2.+ # The maximum number of test FILES that run together. Linux pins+ # 96 (the measured whole-suite sweep — one worker per core is+ # fastest on the 96-core runner, and the curve is shallow).+ # Windows and macOS leave this unset so run_tests_parallel.py's+ # default (cpu_count) applies.HERMES_TEST_WORKERS: ${{ matrix.workers }}+ # Windows CI-only: the full-suite lane showed ~160 files at or+ # past the 300s default under runner contention (they pass in+ # seconds on an idle box); each kill also burns a retry, so the+ # churn — not test time — dominated the lane's wall clock. Give+ # the per-file cap real headroom there. Empty on other lanes+ # (run_tests.sh drops empty vars before the runner sees them).+ HERMES_TEST_FILE_TIMEOUT: ${{ matrix.file_timeout }}# Ensure tests don't accidentally call real APIsOPENROUTER_API_KEY: ""OPENAI_API_KEY: ""diff --git a/agent/browser_registry.py b/agent/browser_registry.pyindex 435ea179da0..405e8c762fa 100644--- a/agent/browser_registry.py+++ b/agent/browser_registry.py@@ -95,7 +95,7 @@ def list_providers(*, scope: Optional[str] = None) -> List[BrowserProvider]:"""Return all registered providers, sorted by name."""with _lock:merged = dict(_providers)- merged.update(_scoped_providers.get(normalize_scope(scope), {}))+ merged.update(_scoped_providers.get(hermes_home_key(scope), {}))items = list(merged.values())return sorted(items, key=lambda p: p.name)@@ -106,7 +106,7 @@ def get_provider(name: str, *, scope: Optional[str] = None) -> Optional[BrowserPreturn Nonewith _lock:key = name.strip()- return _scoped_providers.get(normalize_scope(scope), {}).get(key) or _providers.get(key)+ return _scoped_providers.get(hermes_home_key(scope), {}).get(key) or _providers.get(key)def snapshot_registration(@@ -120,7 +120,7 @@ def snapshot_registration(def registry_generation(*, scope: Optional[str] = None) -> tuple[int, int]:"""Return a cache fingerprint for the global base and one profile."""- active_scope = normalize_scope(scope)+ active_scope = hermes_home_key(scope)with _lock:return _generation, _scoped_generations.get(active_scope, 0)diff --git a/agent/image_gen_registry.py b/agent/image_gen_registry.pyindex b517ce8ad6f..8ea14d35567 100644--- a/agent/image_gen_registry.py+++ b/agent/image_gen_registry.py@@ -66,7 +66,7 @@ def list_providers(*, scope: Optional[str] = None) -> List[ImageGenProvider]:"""Return all registered providers, sorted by name."""with _lock:merged = dict(_providers)- merged.update(_scoped_providers.get(normalize_scope(scope), {}))+ merged.update(_scoped_providers.get(hermes_home_key(scope), {}))items = list(merged.values())return sorted(items, key=lambda p: p.name)@@ -77,7 +77,7 @@ def get_provider(name: str, *, scope: Optional[str] = None) -> Optional[ImageGenreturn Nonewith _lock:key = name.strip()- return _scoped_providers.get(normalize_scope(scope), {}).get(key) or _providers.get(key)+ return _scoped_providers.get(hermes_home_key(scope), {}).get(key) or _providers.get(key)def snapshot_registration(diff --git a/agent/secret_sources/registry.py b/agent/secret_sources/registry.pyindex 6f243a76d97..ac6809379f1 100644--- a/agent/secret_sources/registry.py+++ b/agent/secret_sources/registry.py@@ -170,7 +170,7 @@ def register_source(def get_source(name: str, *, scope: Optional[str] = None) -> Optional[SecretSource]:_ensure_builtin_sources()with _REGISTRY_LOCK:- return _SCOPED_SOURCES.get(normalize_scope(scope), {}).get(+ return _SCOPED_SOURCES.get(hermes_home_key(scope), {}).get(name) or _SOURCES.get(name)@@ -213,7 +213,7 @@ def list_sources(*, scope: Optional[str] = None) -> List[SecretSource]:_ensure_builtin_sources()with _REGISTRY_LOCK:merged = dict(_SOURCES)- merged.update(_SCOPED_SOURCES.get(normalize_scope(scope), {}))+ merged.update(_SCOPED_SOURCES.get(hermes_home_key(scope), {}))return list(merged.values())diff --git a/agent/terminal_env_registry.py b/agent/terminal_env_registry.pyindex 41fdeb4f5a2..4478bdfc6fd 100644--- a/agent/terminal_env_registry.py+++ b/agent/terminal_env_registry.py@@ -102,7 +102,7 @@ def list_providers(*, scope: Optional[str] = None) -> List[TerminalEnvironmentPr"""Return all registered providers, sorted by name."""with _lock:merged = dict(_providers)- merged.update(_scoped_providers.get(normalize_scope(scope), {}))+ merged.update(_scoped_providers.get(hermes_home_key(scope), {}))items = list(merged.values())return sorted(items, key=lambda p: p.name)@@ -116,7 +116,7 @@ def get_provider(key = name.strip().lower()with _lock:return (- _scoped_providers.get(normalize_scope(scope), {}).get(key)+ _scoped_providers.get(hermes_home_key(scope), {}).get(key)or _providers.get(key))@@ -181,7 +181,7 @@ def snapshot_registration(def registry_generation(*, scope: Optional[str] = None) -> tuple:"""Return a cache fingerprint for the global base and one profile."""- active_scope = normalize_scope(scope)+ active_scope = hermes_home_key(scope)with _lock:return _generation, _scoped_generations.get(active_scope, 0)diff --git a/agent/transcription_registry.py b/agent/transcription_registry.pyindex f0e2d63fa8d..feb52f29332 100644--- a/agent/transcription_registry.py+++ b/agent/transcription_registry.py@@ -107,7 +107,7 @@ def list_providers(*, scope: Optional[str] = None) -> List[TranscriptionProvider"""Return all registered providers, sorted by name."""with _lock:merged = dict(_providers)- merged.update(_scoped_providers.get(normalize_scope(scope), {}))+ merged.update(_scoped_providers.get(hermes_home_key(scope), {}))items = list(merged.values())return sorted(items, key=lambda p: p.name)@@ -123,7 +123,7 @@ def get_provider(name: str, *, scope: Optional[str] = None) -> Optional[Transcrireturn Nonekey = name.strip().lower()with _lock:- return _scoped_providers.get(normalize_scope(scope), {}).get(key) or _providers.get(key)+ return _scoped_providers.get(hermes_home_key(scope), {}).get(key) or _providers.get(key)def snapshot_registration(diff --git a/agent/tts_registry.py b/agent/tts_registry.pyindex 74785afebfa..5c4c45d8c0d 100644--- a/agent/tts_registry.py+++ b/agent/tts_registry.py@@ -117,7 +117,7 @@ def list_providers(*, scope: Optional[str] = None) -> List[TTSProvider]:"""Return all registered providers, sorted by name."""with _lock:merged = dict(_providers)- merged.update(_scoped_providers.get(normalize_scope(scope), {}))+ merged.update(_scoped_providers.get(hermes_home_key(scope), {}))items = list(merged.values())return sorted(items, key=lambda p: p.name)@@ -133,7 +133,7 @@ def get_provider(name: str, *, scope: Optional[str] = None) -> Optional[TTSProvireturn Nonekey = name.strip().lower()with _lock:- return _scoped_providers.get(normalize_scope(scope), {}).get(key) or _providers.get(key)+ return _scoped_providers.get(hermes_home_key(scope), {}).get(key) or _providers.get(key)def snapshot_registration(diff --git a/agent/video_gen_registry.py b/agent/video_gen_registry.pyindex 01d42c2d388..975fcd03e64 100644--- a/agent/video_gen_registry.py+++ b/agent/video_gen_registry.py@@ -70,7 +70,7 @@ def list_providers(*, scope: Optional[str] = None) -> List[VideoGenProvider]:"""Return all registered providers, sorted by name."""with _lock:merged = dict(_providers)- merged.update(_scoped_providers.get(normalize_scope(scope), {}))+ merged.update(_scoped_providers.get(hermes_home_key(scope), {}))items = list(merged.values())return sorted(items, key=lambda p: p.name)@@ -81,7 +81,7 @@ def get_provider(name: str, *, scope: Optional[str] = None) -> Optional[VideoGenreturn Nonewith _lock:key = name.strip()- return _scoped_providers.get(normalize_scope(scope), {}).get(key) or _providers.get(key)+ return _scoped_providers.get(hermes_home_key(scope), {}).get(key) or _providers.get(key)def snapshot_registration(diff --git a/agent/web_search_registry.py b/agent/web_search_registry.pyindex e4642292e68..c2b59d1a8e1 100644--- a/agent/web_search_registry.py+++ b/agent/web_search_registry.py@@ -84,7 +84,7 @@ def list_providers(*, scope: Optional[str] = None) -> List[WebSearchProvider]:"""Return all registered providers, sorted by name."""with _lock:merged = dict(_providers)- merged.update(_scoped_providers.get(normalize_scope(scope), {}))+ merged.update(_scoped_providers.get(hermes_home_key(scope), {}))items = list(merged.values())return sorted(items, key=lambda p: p.name)@@ -95,7 +95,7 @@ def get_provider(name: str, *, scope: Optional[str] = None) -> Optional[WebSearcreturn Nonewith _lock:key = name.strip()- return _scoped_providers.get(normalize_scope(scope), {}).get(key) or _providers.get(key)+ return _scoped_providers.get(hermes_home_key(scope), {}).get(key) or _providers.get(key)def snapshot_registration(diff --git a/hermes_cli/dashboard_auth/registry.py b/hermes_cli/dashboard_auth/registry.pyindex 02fe8ed72cf..867e043d099 100644--- a/hermes_cli/dashboard_auth/registry.py+++ b/hermes_cli/dashboard_auth/registry.py@@ -24,7 +24,7 @@ _scoped_providers: dict[str, dict[str, DashboardAuthProvider]] = {}def _merged(scope: Optional[str] = None) -> dict[str, DashboardAuthProvider]:providers = dict(_providers)- providers.update(_scoped_providers.get(normalize_scope(scope), {}))+ providers.update(_scoped_providers.get(hermes_home_key(scope), {}))return providersdiff --git a/hermes_constants.py b/hermes_constants.pyindex 2bfbecee79d..d5c7cb1255a 100644--- a/hermes_constants.py+++ b/hermes_constants.py@@ -153,11 +153,21 @@ def hermes_home_key(path: str | Path | None = None) -> str:def normalize_scope(scope: str | Path | None) -> str | None:- """Normalize a registry scope key, preserving ``None``.+ """Normalize a WRITE-side registry scope key, preserving ``None``.- ``None`` means the process-global layer and must stay ``None``; any other- value is normalized through :func:`hermes_home_key` so writes and reads- agree on the key (normcase on Windows, resolved absolute path).+ Two different contracts live on the same registries — do not unify them:++ * **Write / slot paths** (``register_*``, ``snapshot_registration``,+ ``restore_registration``, tool-registry slot lookup): ``None`` means+ the process-global layer and must stay ``None``. Use this function.+ * **Read paths** (``list_providers``, ``get_provider``): ``None`` means+ "the active home's scope" and must go through :func:`hermes_home_key`+ (falsy input resolves to the active default home). Using this+ function there hides every scoped registration — the exact bug+ fixed after e66a627aa5.++ Both normalize non-None values identically (resolved absolute path,+ normcase on Windows) so writes and reads agree on the key."""return hermes_home_key(scope) if scope is not None else Nonediff --git a/scripts/run_tests_parallel.py b/scripts/run_tests_parallel.pyindex 2fe1dcbba3a..ea989635d91 100755--- a/scripts/run_tests_parallel.py+++ b/scripts/run_tests_parallel.py@@ -781,8 +781,8 @@ def main() -> int:"-j","--jobs",type=int,- default=int(os.environ.get("HERMES_TEST_WORKERS") or (os.cpu_count() or 4) * 2),- help="Parallel worker count (default: $HERMES_TEST_WORKERS or cpu_count*2)",+ default=int(os.environ.get("HERMES_TEST_WORKERS") or (os.cpu_count() or 4)),+ help="Parallel worker count (default: $HERMES_TEST_WORKERS or cpu_count)",)parser.add_argument("--paths",