mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-21 16:18:55 +00:00
fix(honcho): memoize timeout staleness check + host-aware status cadence
Follow-ups for the consolidated salvage: - Memoize the config.yaml-derived timeout on the file's mtime_ns so the rebuild-on-timeout-change check from PR #57437 costs one stat() per get_honcho_client() call instead of a full YAML load on the hot path. - hermes honcho status now displays the host-block-resolved dialecticCadence (remnant from PR #63776, whose runtime fix landed in #62290). - AUTHOR_MAP entries for the salvaged contributor emails.
This commit is contained in:
parent
e5bebe2cad
commit
04d84df63c
3 changed files with 40 additions and 14 deletions
|
|
@ -1099,7 +1099,7 @@ def cmd_status(args) -> None:
|
|||
print(f" Recall mode: {hcfg.recall_mode}")
|
||||
print(f" Context budget: {hcfg.context_tokens or '(uncapped)'} tokens")
|
||||
raw = getattr(hcfg, "raw", None) or {}
|
||||
dialectic_cadence = raw.get("dialecticCadence") or 1
|
||||
dialectic_cadence = getattr(hcfg, "dialectic_cadence", None) or raw.get("dialecticCadence") or 1
|
||||
print(f" Dialectic cad: every {dialectic_cadence} turn{'s' if dialectic_cadence != 1 else ''}")
|
||||
reasoning_cap = raw.get("reasoningLevelCap") or hcfg.reasoning_level_cap
|
||||
heuristic_on = "on" if hcfg.reasoning_heuristic else "off"
|
||||
|
|
|
|||
|
|
@ -856,6 +856,39 @@ class HonchoClientConfig:
|
|||
|
||||
_honcho_client_slot: SingletonSlot = SingletonSlot()
|
||||
_cached_timeout: float | None = None
|
||||
# Memo for the config.yaml-derived timeout, keyed on the file's mtime_ns so
|
||||
# the staleness check on every get_honcho_client() call costs one stat()
|
||||
# instead of a full YAML load. (None, None) = not yet populated.
|
||||
_config_timeout_memo: tuple[int | None, float | None] = (None, None)
|
||||
|
||||
|
||||
def _config_yaml_timeout() -> float | None:
|
||||
"""Read honcho.timeout / honcho.request_timeout from config.yaml, memoized on mtime."""
|
||||
global _config_timeout_memo
|
||||
try:
|
||||
from hermes_constants import get_hermes_home
|
||||
|
||||
cfg_path = get_hermes_home() / "config.yaml"
|
||||
try:
|
||||
mtime_ns: int | None = cfg_path.stat().st_mtime_ns
|
||||
except OSError:
|
||||
mtime_ns = None
|
||||
if _config_timeout_memo[0] is not None and _config_timeout_memo[0] == mtime_ns:
|
||||
return _config_timeout_memo[1]
|
||||
|
||||
from hermes_cli.config import load_config
|
||||
|
||||
honcho_cfg = load_config().get("honcho", {})
|
||||
timeout = None
|
||||
if isinstance(honcho_cfg, dict):
|
||||
timeout = _resolve_optional_float(
|
||||
honcho_cfg.get("timeout"),
|
||||
honcho_cfg.get("request_timeout"),
|
||||
)
|
||||
_config_timeout_memo = (mtime_ns, timeout)
|
||||
return timeout
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
def _resolve_timeout_from_sources(config: HonchoClientConfig | None) -> float:
|
||||
|
|
@ -864,18 +897,7 @@ def _resolve_timeout_from_sources(config: HonchoClientConfig | None) -> float:
|
|||
if timeout is None:
|
||||
timeout = _resolve_optional_float(os.environ.get("HONCHO_TIMEOUT"))
|
||||
if timeout is None:
|
||||
try:
|
||||
from hermes_cli.config import load_config
|
||||
|
||||
hermes_cfg = load_config()
|
||||
honcho_cfg = hermes_cfg.get("honcho", {})
|
||||
if isinstance(honcho_cfg, dict):
|
||||
timeout = _resolve_optional_float(
|
||||
honcho_cfg.get("timeout"),
|
||||
honcho_cfg.get("request_timeout"),
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
timeout = _config_yaml_timeout()
|
||||
return timeout if timeout is not None else _DEFAULT_HTTP_TIMEOUT
|
||||
|
||||
|
||||
|
|
@ -1055,6 +1077,7 @@ def get_honcho_client(config: HonchoClientConfig | None = None) -> Honcho:
|
|||
|
||||
def reset_honcho_client() -> None:
|
||||
"""Reset the Honcho client singleton (useful for testing)."""
|
||||
global _cached_timeout
|
||||
global _cached_timeout, _config_timeout_memo
|
||||
_honcho_client_slot.reset()
|
||||
_cached_timeout = None
|
||||
_config_timeout_memo = (None, None)
|
||||
|
|
|
|||
|
|
@ -54,6 +54,9 @@ AUTHOR_MAP = {
|
|||
"kimyeon30@naver.com": "rlaehddus302", # PR #61985 salvage (gateway: secondary-adapter auth callback profile)
|
||||
"agungsubastian1963@gmail.com": "aguung", # PR #64461 salvage (gateway: multiplex secret_scope for authz/Slack/webhooks)
|
||||
"jtstothard@gmail.com": "jtstothard", # PR #63256 salvage (gateway: multiplex secondary adapter config validation)
|
||||
"fjlaowan@proton.me": "fjlaowan1983", # PR #11256 salvage (honcho: reject whitespace-only reasoning queries)
|
||||
"RainbowAndSun@users.noreply.github.com": "RainbowAndSun", # PR #62982 salvage (honcho: observer target in prefetch context)
|
||||
"pi@hermes.local": "Elektrofussel", # PR #61675 salvage (honcho: defaultHost + private-range local URL detection)
|
||||
"doogie@spark.local": "SAMBAS123", # PR #64986 salvage (gateway: multiplex primary bot token scope)
|
||||
"emrekoca2003@gmail.com": "kocaemre", # PR #36051 salvage (docs: audit round 3 code/doc reconciliation)
|
||||
"focusedmiqa@gmail.com": "m1qaweb", # PR #29290 salvage (gateway: strip /queue prefix when idle)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue