Files
hermes-agent/hermes_cli/models_process_fingerprint.py
Siddharth Balyan 8054696ad4 fix(models): fingerprint the executable a process provider actually launches
The catalog fingerprint resolved the profile's default process_command even
when a process_command_env_vars override picked another executable. An
upgrade that repointed an override symlink changed neither the override text
nor the default binary, so the picker kept the old executable's model list.
The launch path and the fingerprint now share external_process_command, so
both select the same command. Answers Greptile r4511687631 on #151817.
2026-11-09 18:06:44 +05:30

26 lines
1.1 KiB
Python

"""Catalog-cache identity of an external-process provider (``hermes_cli.models._credential_fingerprint``)."""
from __future__ import annotations
import os
from typing import Any
def process_catalog_identity(provider: str) -> tuple[Any | None, list[str]]:
"""``(profile, parts)`` for an external-process provider, else ``(None, [])``.
Such a provider discovers models through the launched program, so the command / argv env
overrides and the resolved binary identify the catalog the way an API key identifies an HTTP one.
"""
from providers import get_provider_profile
profile = get_provider_profile(provider)
if profile is None or profile.auth_type != "external_process":
return None, []
parts = [f"{ev}={os.environ.get(ev, '')}"
for ev in (*profile.process_command_env_vars, profile.process_args_env_var) if ev]
from hermes_cli.auth_external_process import external_process_command, resolve_external_process_command
binary = resolve_external_process_command(external_process_command(profile))
parts.append(f"binary={os.path.realpath(binary) if binary else ''}")
return profile, parts