fix: watch source mode config files for multi-mode hot reload#2143
Open
dolepee wants to merge 1 commit intoOpenMind:mainfrom
Open
fix: watch source mode config files for multi-mode hot reload#2143dolepee wants to merge 1 commit intoOpenMind:mainfrom
dolepee wants to merge 1 commit intoOpenMind:mainfrom
Conversation
68993c2 to
3f82275
Compare
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.
Overview
Extends the multi-mode hot-reload system to watch source configuration files (and their referenced sub-configs), not just the generated runtime config snapshot.
Previously,
ModeCortexRuntimeonly monitored the runtime config file for changes. If a user edited the original source config or any mode file it references, changes were silently ignored until a full restart. This patch closes that gap.Relates to #984
Type of change
Changes
_get_source_config_path): resolves the original mode config file frommode_config_name, handling absolute paths, relative paths, and the defaultconfig/directory._extract_config_references): parses a JSON5 config and recursively discovers any.json/.json5file paths referenced as string values (skipping URLs)._get_watched_config_paths): builds the complete set of files to monitor — runtime config + source config + all referenced configs._refresh_watched_config_mtimes): replaces the singlelast_modifiedcheck with a dict of per-file mtimes so any watched file change triggers a reload._reload_config(reload_from_runtime=...)): when only the runtime snapshot changed, reloads from the snapshot; when source files changed, reloads from the original source and regenerates the runtime snapshot to keep them in sync.Checklist
Impact
This is scoped entirely to
multi_mode/cortex.pyand its tests. It does not touch single-mode, does not add new dependencies (uses the existingjson5import), and is fully backward-compatible — the default behaviour when only the runtime config changes is identical to before.Additional Information
This is complementary to the single-mode selective field reload work discussed in #984. That bounty focuses on partial field-level reloading in
single_mode/cortex.py; this PR addresses a different gap — ensuring multi-mode source config files and their references are properly watched alongside the runtime snapshot.