-
Notifications
You must be signed in to change notification settings - Fork 940
Abandon single mode #2204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Abandon single mode #2204
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 22 out of 24 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
src/cli.py:1
- The CLI validates schema before normalization and then proceeds using the normalized config for component validation and summary output. This leaves the normalized structure unvalidated (and can surface different behavior vs
load_mode_config). Consider normalizing first and validating the normalized config against the multi-mode schema so the user sees schema errors for the final effective configuration.
import ast
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| validate_config_schema(raw_config) | ||
| raw_config = normalize_to_multi_mode(raw_config) |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This validates the pre-normalized config and never validates the normalized config. That contradicts the PR’s goal (“validated … after normalization”) and can allow invalid normalized multi-mode structures to slip through (e.g., missing required mode fields) without schema enforcement. Normalize first, then validate the normalized output against the multi-mode schema (or run a second validation step after normalization so the final shape is always validated).
| validate_config_schema(raw_config) | |
| raw_config = normalize_to_multi_mode(raw_config) | |
| raw_config = normalize_to_multi_mode(raw_config) | |
| validate_config_schema(raw_config) |
| original_llm_ask = cortex.config.cortex_llm.ask | ||
| original_llm_ask = cortex.current_config.cortex_llm.ask | ||
|
|
||
| async def mock_llm_ask(prompt: str, messages: List[Dict[str, str]] = []): |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid mutable default arguments. Using [] as a default can leak state between calls/tests. Use messages: Optional[List[Dict[str, str]]] = None and initialize to an empty list inside the function.
| async def mock_llm_ask(prompt: str, messages: List[Dict[str, str]] = []): | |
| async def mock_llm_ask( | |
| prompt: str, messages: Optional[List[Dict[str, str]]] = None | |
| ): | |
| if messages is None: | |
| messages = [] |
|
|
||
|
|
||
| def _load_schema(schema_file: str) -> dict: | ||
| """Load and cache schema files.""" |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring claims schema files are cached, but _load_schema loads from disk every time. Either add caching (e.g., functools.lru_cache) or adjust the docstring to match the implementation.
| """Load and cache schema files.""" | |
| """Load a schema file from disk.""" |
| config_version = raw_config.get("version") | ||
| verify_runtime_version(config_version, config_name) | ||
| validate_config_schema(raw_config) | ||
| raw_config = normalize_to_multi_mode(raw_config) |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given normalization is now part of the runtime config load path, add a test that load_mode_config() validates the normalized config (e.g., provide a single-mode config that normalizes into an invalid multi-mode shape and assert a ValidationError after normalization). This will prevent regressions where schema validation accidentally happens only on the pre-normalized input.
This pull request refactors the runtime configuration system by fully transitioning from the old single-mode configuration to a unified multi-mode format. It introduces a normalization layer so that legacy single-mode configs are automatically converted to multi-mode, simplifying the codebase and user experience. The changes remove all direct dependencies on
runtime.single_mode.config, consolidate schema validation logic, and streamline CLI output and validation.Configuration system refactoring:
runtime.single_mode.configandruntime.single_mode.cortexthroughout the codebase, replacing them withruntime.multi_mode.configandModeCortexRuntime. This ensures only the multi-mode configuration system is used. [1] [2] [3] [4] [5] [6]normalize_to_multi_mode) insrc/runtime/normalization.pythat automatically converts legacy single-mode configs to the multi-mode format, including validation for required fields.src/runtime/config.pyfile and moved schema loading and validation intosrc/runtime/multi_mode/config.py. Now, all configs are validated against the appropriate schema after normalization. [1] [2] [3] [4]CLI and validation improvements:
Code cleanup:
add_metaandRuntimeConfig) into the multi-mode config module.These changes make configuration handling more robust and future-proof by ensuring all runtime logic operates on a single, unified format.