The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
Merge branch 'main' into feat/hermes-relay-shared-metrics
Jeffrey Quesnelle921619860118
diff --cc agent/tool_executor.pyindex 1db855573f0,c6751ac6c94..4815f80db44--- a/agent/tool_executor.py+++ b/agent/tool_executor.py@@@ -1465,9 -1360,10 +1465,10 @@@ def execute_tool_calls_sequential(agentreturn _clarify_tool(question=next_args.get("question", ""),choices=next_args.get("choices"),+ multi_select=next_args.get("multi_select", False),callback=agent.clarify_callback,)- function_result, function_args = _run_agent_tool_execution_middleware(+ function_result, function_args, middleware_trace, _execution_blocked = _managed_values(_run_agent_tool_execution_middleware(agent,function_name=function_name,function_args=function_args,diff --cc pyproject.tomlindex ea5d84f6b36,02c00a09675..d623df04b9b--- a/pyproject.toml+++ b/pyproject.toml@@@ -206,10 -201,8 +206,10 @@@ pty = [# `request.url` can be bypassed. We pin a patched Starlette directly in every# extra that exposes a Starlette-backed server surface so pip/uv can't resolve# a vulnerable pre-1.0.1 transitive. Bump in lockstep with uv.lock.- mcp = ["mcp==1.26.0", "starlette==1.0.1"] # starlette: CVE-2026-48710+ mcp = ["mcp==1.26.0", "starlette==1.3.1"] # starlette: CVE-2026-48710-nemo-relay = ["nemo-relay>=0.5,<1.0"]+# Backwards-compatible no-op alias. Relay is a core dependency on supported+# wheel targets and intentionally unavailable on other platforms.+nemo-relay = []homeassistant = ["aiohttp==3.14.1"]sms = ["aiohttp==3.14.1"]teams = ["microsoft-teams-apps==2.0.13.4", "aiohttp==3.14.1"] # aiohttp 3.14.1: CVE-2026-34993(RCE)/47265 + 34513/34518/34519/34520/34525diff --cc tests/test_project_metadata.pyindex 1456c742174,0b225742629..4d685011ccf--- a/tests/test_project_metadata.py+++ b/tests/test_project_metadata.py@@@ -221,7 -215,132 +221,128 @@@ def test_feishu_extra_includes_qrcode_fassert any(dep.startswith("qrcode") for dep in feishu_extra)-def test_nemo_relay_extra_uses_supported_official_distribution_range():- optional_dependencies = _load_optional_dependencies()+def test_shared_metrics_schema_is_packaged():+ package_data = _load_package_data()- assert optional_dependencies["nemo-relay"] == ["nemo-relay>=0.5,<1.0"]- assert not any(- spec == "hermes-agent[nemo-relay]"- for spec in optional_dependencies["all"]- )+ assert "observability/schemas/*.json" in package_data["hermes_cli"]+++ def _uv_lock_version(package: str) -> str:+ """Resolved version of ``package`` in uv.lock, or fail loudly."""+ versions = _uv_lock_versions(package)+ assert versions, f"{package} not found in uv.lock"+ assert len(versions) == 1, f"{package} resolves to multiple versions in uv.lock: {versions}"+ return next(iter(versions))+++ def _uv_lock_versions(package: str) -> set[str]:+ """All resolved versions of ``package`` in uv.lock (normally 0 or 1)."""+ import re++ lock_path = Path(__file__).resolve().parents[1] / "uv.lock"+ lock = lock_path.read_text(encoding="utf-8")+ return {+ m.group(1)+ for m in re.finditer(+ rf'\[\[package\]\]\nname = "{re.escape(package)}"\nversion = "([^"]+)"',+ lock,+ )+ }+++ def test_every_lazy_deps_exact_pin_matches_uv_lock():+ """Class invariant for #60783/#60685: one version per package, everywhere.++ Any package that is BOTH exact-pinned in ``tools/lazy_deps.py`` AND+ resolved in the committed uv.lock is a *shared* package: the core+ install ships the locked version, and the ``hermes update`` lazy-refresh+ pass re-asserts the LAZY_DEPS pin whenever the package is present+ (``active_features()``). If the two disagree, every update churns the+ package — and when the lazy pin is older, it force-DOWNGRADES a version+ another consumer needs (huggingface-hub==1.2.3 vs transformers'+ >=1.5.0 broke Hindsight local embeddings; stale aiohttp pins reopened+ patched CVEs in #31817). Contract: for every such package, pin ==+ locked version. When bumping a pin, regenerate the lock in the same+ commit (`uv lock --upgrade-package <name>`), and vice versa.+ """+ from tools.lazy_deps import LAZY_DEPS++ drift = {}+ seen = set()+ for feature, specs in LAZY_DEPS.items():+ for package, pin in _exact_pins(specs).items():+ if (package, pin) in seen:+ continue+ seen.add((package, pin))+ locked = _uv_lock_versions(package)+ if not locked:+ # Lazy-only package never resolved by the core lock — no+ # shared-version hazard.+ continue+ if pin not in locked:+ drift.setdefault(package, {})[feature] = {+ "lazy_pin": pin,+ "uv_lock": sorted(locked),+ }++ assert not drift, (+ "LAZY_DEPS exact pins must match the uv.lock resolved version for "+ "every package the core lock also ships — otherwise `hermes update` "+ "churns/downgrades the shared package out from under its other "+ "consumers (#60783, #31817). Bump the pin AND run "+ "`uv lock --upgrade-package <name>` in the same commit. Drift: "+ f"{drift}"+ )+++ def test_huggingface_hub_lazy_pin_matches_uv_lock():+ """The whole tree must converge on ONE huggingface-hub version (#60783).++ huggingface-hub is a shared dependency: the core lock resolves it (via+ faster-whisper/tokenizers, and transformers/sentence-transformers when+ local Hindsight embeddings are installed), and LAZY_DEPS+ ['tool.trace_upload'] exact-pins it. Because active_features() activates+ a feature from mere package presence, the `hermes update` lazy-refresh+ pass re-asserts the LAZY_DEPS pin on every install where hub is present.+ If that pin drifts from the lock's resolved version, every update churns+ the shared package — and a pin below transformers' floor (>=1.5.0)+ force-downgrades it and breaks the Hindsight local daemon on startup.+ """+ from tools.lazy_deps import LAZY_DEPS++ lazy_pin = _exact_pins(LAZY_DEPS["tool.trace_upload"]).get("huggingface-hub")+ assert lazy_pin, "tool.trace_upload must exact-pin huggingface-hub"++ locked = _uv_lock_version("huggingface-hub")+ assert lazy_pin == locked, (+ "LAZY_DEPS['tool.trace_upload'] pins huggingface-hub=="+ f"{lazy_pin} but uv.lock resolves {locked}. These must move in "+ "lockstep (bump the pin AND run `uv lock --upgrade-package "+ "huggingface-hub`), or `hermes update` will churn/downgrade the "+ "shared package and break Hindsight local embeddings (#60783)."+ )+++ def test_huggingface_hub_lazy_pin_inside_transformers_window():+ """The hub pin must stay in transformers' accepted range (#60783).++ transformers (pulled by sentence-transformers for Hindsight+ local/local_embedded embeddings) requires huggingface-hub>=1.5.0,<2.+ An exact pin outside that window makes the lazy-refresh downgrade the+ shared package below what the embedding stack imports, and the+ Hindsight daemon fails on startup. Contract, not a snapshot: any+ future exact pin is fine as long as it stays inside the window.+ """+ from packaging.specifiers import SpecifierSet+ from packaging.version import Version++ from tools.lazy_deps import LAZY_DEPS++ pin = _exact_pins(LAZY_DEPS["tool.trace_upload"]).get("huggingface-hub")+ assert pin, "tool.trace_upload must exact-pin huggingface-hub"+ transformers_window = SpecifierSet(">=1.5.0,<2")+ assert Version(pin) in transformers_window, (+ f"huggingface-hub=={pin} falls outside transformers' accepted "+ "range (>=1.5.0,<2). The lazy refresh would downgrade the shared "+ "package and break Hindsight local embeddings (#60783)."+ )