The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(update): pin the /api/health commit field Desktop's attach decision reads
Tekniumb10e12973e29
diff --git a/tests/hermes_cli/test_web_routers_status_health.py b/tests/hermes_cli/test_web_routers_status_health.pynew file mode 100644index 00000000000..0108e1dfbc4--- /dev/null+++ b/tests/hermes_cli/test_web_routers_status_health.py@@ -0,0 +1,36 @@+"""``GET /api/health`` ``commit`` contract (review G4).++Desktop's host-backend-attach.ts (``fetchBackendCodeIdentity``) reads ``commit`` from the public+health probe and refuses to attach to a backend whose BOOT commit differs from its checkout, so a+``serve`` that outlived ``hermes update`` is never re-adopted. The field must always be present+(``null`` off git) and must come from ``get_version_info().commit``.+"""++from __future__ import annotations++import pytest++from hermes_cli.version_info import VersionInfo+++def _info(commit: str | None) -> VersionInfo:+ return VersionInfo(base_version="2026.10.1", derived_version="2026.10.1", distance=0,+ commit=commit, branch="main", source="git")++[email protected]("commit", ["0fbe50a9d88aa7e1c0b5f3d2e4a6b8c9d0e1f2a3", None])+def test_health_reports_the_boot_commit_from_version_info(monkeypatch, commit):+ from starlette.testclient import TestClient++ import hermes_cli.web_routers.status as status+ import hermes_cli.web_server as ws++ monkeypatch.setattr(status, "get_version_info", lambda: _info(commit))++ response = TestClient(ws.app).get("/api/health") # public: no session token++ assert response.status_code == 200+ body = response.json()+ assert body["ok"] is True+ assert "commit" in body, "host-backend-attach.ts keys the attach decision on this field"+ assert body["commit"] == commit