mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-19 13:28:58 +03:00
edbf0b3b2c
Reuse the satellite's expanded profile scope when the multiplex scheduler reads a cron setting before the job's secret scope is installed. An interpolated HERMES_CRON_TIMEOUT no longer falls back to 600 seconds on the tick while the fire reads 1800 seconds. Regression: bare tick and scoped fire resolve the same timeout. Follow-up to teknium1's #153447 and the report by mnoid (#146336) and dotenv discrepancy report #137080.
31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
"""Profile-scoped reads of the ``HERMES_*`` tuning settings cron honours from ``.env``.
|
|
|
|
A standalone ``hermes -p X gateway run`` loads X's ``.env`` into ``os.environ``, so a bare
|
|
``os.getenv("HERMES_CRON_TIMEOUT")`` is X's value. Under ``gateway.multiplex_profiles`` the same
|
|
tick runs inside the default profile's process, where ``os.environ`` holds the DEFAULT profile's
|
|
``.env``. With a secret scope installed (job run + delivery) the scope is authoritative; the tick
|
|
loop itself (due-job scan, pool sizing) runs under the profile's home override only, so the
|
|
setting is read from that home's ``.env``. Outside multiplex the read is the plain environ.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
from agent.secret_scope import (
|
|
build_profile_secret_scope,
|
|
current_secret_scope,
|
|
is_multiplex_active,
|
|
)
|
|
from hermes_constants import get_hermes_home
|
|
|
|
|
|
def cron_env_setting(name: str, default: str = "") -> str:
|
|
if not is_multiplex_active():
|
|
return os.getenv(name) or default
|
|
scope = current_secret_scope()
|
|
if scope is None:
|
|
scope = build_profile_secret_scope(get_hermes_home())
|
|
value = scope.get(name)
|
|
return default if value is None else str(value)
|