fix(tools): prefer load_config() over stale CLI_CONFIG in delegate _load_config()#18978
Closed
shellybotmoyer wants to merge 1 commit into
Closed
fix(tools): prefer load_config() over stale CLI_CONFIG in delegate _load_config()#18978shellybotmoyer wants to merge 1 commit into
shellybotmoyer wants to merge 1 commit into
Conversation
…oad_config() Fixes NousResearch#18946: hermes config set delegation.* silently has no effect on running process because _load_config() checks CLI_CONFIG first (stale in-memory dict) before load_config() (mtime-cached disk reads). Reverse priority so disk config with mtime invalidation wins.
Collaborator
|
Likely duplicate of #18967 — same root cause (stale CLI_CONFIG priority in delegate_tool._load_config()), same fix (invert to disk-first). |
1 similar comment
Collaborator
|
Likely duplicate of #18967 — same root cause (stale CLI_CONFIG priority in delegate_tool._load_config()), same fix (invert to disk-first). |
Contributor
Author
|
Closing in favor of clean rebase. See #19007 (supercedes this). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix
Reverses the priority in
_load_config()so thatload_config()(which has mtime-based cache invalidation) is checked before the in-memoryCLI_CONFIGdict.Problem
hermes config set delegation.model Xwrites to disk and reports success, but_load_config()indelegate_tool.pychecks the in-memoryCLI_CONFIGdict first. SinceCLI_CONFIGwas loaded once at process startup and never invalidated, the stale cached value wins — the new disk config is never read until the process restarts.This affects CLI, gateway, and cron — any long-running process that calls
delegate_task()after a config change viahermes config set.Root Cause
_load_config()prioritizedCLI_CONFIG(stale in-memory dict) overload_config()(mtime-cached disk reads with automatic invalidation). Theload_config()function inhermes_cli/config.pyalready handles cache invalidation correctly by checking(mtime_ns, size)on every call — it just was never reached becauseCLI_CONFIGwas checked first.Fix Details
hermes_cli.config.load_config()first (mtime-aware, always fresh)cli.CLI_CONFIGonly ifload_config()failsif cfg:guard to theCLI_CONFIGpath for consistencyTesting
delegation.model: google/gemini-2.5-flashhermes config set delegation.model google/gemini-3-flash-previewdelegate_task(...)from the original sessiongemini-2.5-flash(stale cache)gemini-3-flash-preview(fresh from disk)Fixes #18946