{"repo":"NousResearch/hermes-agent","public_id":"35070","display_label":"Version sync between pyproject.toml and __init__.py","summary":"These issues and PRs address a problem where the CLI version in __init__.py can fall out of sync with pyproject.toml, particularly during upgrade conflicts. The work involves adding version consistency checks to the hermes doctor command and reading the version from pyproject.toml as the source of truth.","subsystem":"hermes_cli","counts":{"members":5,"open_issues":0,"open_issues_distinct":0,"open_prs":0,"closed_issues":1,"merged_prs":1,"attempt_prs":3},"landed_fix":{"status":"merged_to_main","basis":"structural","pr":35142},"resolution":{"state":"resolved","by":"pr-35142"},"freshness":{"state":"verified","last_verified_at":"2026-05-30T07:32:05+00:00","is_stale":false},"grouping":{"backbone":"STRUCTURAL_SPANNING","link_density":0.4},"fix_edges":[{"issue_number":35070,"pr_number":35142,"tier":"verified","basis":"closing_ref","confidence":0.95,"recoverable_from_timeline":true}],"members":[{"kind":"issue","number":35070,"title":"Version mismatch: hermes_cli/__init__.py gets reverted during upgrade conflict resolution","url":null,"state":"closed"},{"kind":"pr","number":35142,"title":"fix: detect version drift between pyproject.toml and __init__.py in hermes doctor","url":null,"state":"merged","close_reason":{"category":"merged","implication":"superseded"},"merged":true,"is_fix_pr":true,"fix_tier":"verified","files_changed":["hermes_cli/doctor.py"],"fix_hunks":[{"file":"hermes_cli/doctor.py","hunks":["@@ -204,6 +204,60 @@ def _fail_and_issue(text: str, detail: str, fix: str, issues: list[str]) -> None\n     issues.append(fix)\n \n \n+def _read_pyproject_version() -> str | None:\n+    \"\"\"Read the ``version = \"...\"`` from ``pyproject.toml`` at the project root.\n+\n+    Returns None when running from an installed wheel (no pyproject.toml ships\n+    with the package) or when the file can't be parsed. Reads only the\n+    ``[project]`` version, ignoring any version strings that appear in other\n+    tables.\n+    \"\"\"\n+    pyproject = PROJECT_ROOT / \"pyproject.toml\"\n+    try:\n+        text = pyproject.read_text(encoding=\"utf-8\")\n+    except OSError:\n+        return None\n+    in_project = False\n+    for raw in text.splitlines():\n+        line = raw.strip()\n+        if line.startswith(\"[\") and line.endswith(\"]\"):\n+            in_project = line == \"[project]\"\n+            continue\n+        if in_project and line.startswith(\"version\") and \"=\" in line:\n+            value = line.split(\"=\", 1)[1]\n+            value = value.split(\"#\", 1)[0].strip().strip(\"\\\"'\")\n+            return value or None\n+    return None\n+\n+\n+def _check_version_consistency(issues: list[str]) -> None:\n+    \"\"\"Verify pyproject.toml version matches hermes_cli.__version__.\n+\n+    A git conflict resolution (reset/merge) can revert one file without the\n+    other, leaving ``hermes --version`` reporting a stale version while\n+    ``pyproject.toml`` is current. Detect that drift so users can re-sync.\n+    Silent no-op for installed wheels where pyproject.toml isn't present.\n+    \"\"\"\n+    try:\n+        from hermes_cli import __version__ as init_version\n+    except Exception:\n+        return\n+    pyproject_version = _read_pyproject_version()\n+    if pyproject_version is None:\n+        # Installed wheel or unreadable pyproject — nothing to cross-check.\n+        return\n+    if pyproject_version == init_version:\n+        check_ok(\"Version files consistent\", f\"({init_version})\")\n+    else:\n+        _fail_and_issue(\n+            \"Version mismatch between source files\",\n+            f\"(pyproject.toml {pyproject_version} != hermes_cli/__init__.py {init_version})\",\n+            \"Re-sync version files (e.g. run 'hermes update', or set \"\n+            \"hermes_cli/__init__.py __version__ to match pyproject.toml)\",\n+            issues,\n+        )\n+\n+\n def _check_s6_supervision(issues: list[str]) -> None:\n     \"\"\"Inside a container under our s6 /init, surface what s6 sees.\n ","@@ -509,6 +563,10 @@ def run_doctor(args):\n         check_ok(\"Virtual environment active\")\n     else:\n         check_warn(\"Not in virtual environment\", \"(recommended)\")\n+\n+    # Detect drift between pyproject.toml and hermes_cli/__init__.py versions\n+    # (a git conflict resolution can silently revert one but not the other).\n+    _check_version_consistency(issues)\n     \n     _section(\"Required Packages\")\n     required_packages = [\n"]}]},{"kind":"pr","number":35160,"title":"fix(cli): read version from pyproject.toml to prevent stale version (#35070)","url":null,"state":"closed","close_reason":{"refs":[{"kind":"commit","value":"bb79bcde6103c564dacb2d796fe8fe8b775f1b18","number":0},{"kind":"pr","value":"#35142","number":35142}],"category":"implemented_elsewhere","implication":"superseded"},"merged":false},{"kind":"pr","number":35169,"title":"fix(doctor): add version consistency check between pyproject.toml and __init__.py","url":null,"state":"closed","close_reason":{"refs":[{"kind":"pr","value":"#35172","number":35172}],"category":"superseded_by_pr","implication":"superseded"},"merged":false},{"kind":"pr","number":35172,"title":"fix(cli): add version consistency check to hermes doctor","url":null,"state":"closed","close_reason":{"category":"stale_abandoned","implication":"active"},"merged":false}],"trust":{"default_tier":"verified","includes_suggested":false}}