fix: watchdog config drift check uses YAML parse, not grep (#377) #398
Reference in New Issue
Block a user
Delete Branch "burn/377-1776117775"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #377
Bug
check_config_drift()inmodel-watchdog.pygrepped for the firstprovider:line in each config file to check for drift. This is fragile becauseconfig.yamlhasprovider:on lines 3, 55, 73, 83, 86, etc. — only works because the first one happens to bemodel.provider.If anyone adds a
provider:field abovemodel:(e.g.fallback_model.provider), the watchdog would false-positive on every run.Fix
Also includes a fallback for environments without
yaml: an indentation-aware scan that only matchesprovider:under themodel:block (indent > 0, preceded bymodel:at indent 0).This file was previously only in
~/.hermes/bin/(local). Adding it to the repo so fixes are version-controlled.PR #398: fix: watchdog config drift check uses YAML parse, not grep (#377)
Good fix. The new
check_config_drift()properly parses YAML to readmodel.providerinstead of grepping for the firstprovider:line. The fallback for missing PyYAML (indentation-aware line scan) is a nice touch.Minor notes:
shell=Trueinsubprocess.runcalls throughout the script is a minor security concern for a watchdog, though acceptable since this runs locally with trusted inputs.except:incheck_session_metashould beexcept Exception:to avoid catchingKeyboardInterrupt/SystemExit.get_hermes_pid_for_ttyusesgrep [h]ermesshell trick -- works but brittle if process names change.LGTM.