Fix configs validation #66

Merged
Berack96 merged 4 commits from fix-configs-validation into main 2025-10-30 15:47:07 +01:00
Berack96 commented 2025-10-29 23:08:03 +01:00 (Migrated from github.com)

Questa PR introduce miglioramenti alla validazione della configurazione e alla gestione degli errori nell'avvio dell'applicazione.
Le modifiche più significative includono una validazione più rigorosa dei valori predefiniti degli agenti, miglioramenti alla logica di validazione dei modelli e una migliore segnalazione degli errori durante l'inizializzazione dell'applicazione.

Questa PR introduce miglioramenti alla validazione della configurazione e alla gestione degli errori nell'avvio dell'applicazione. Le modifiche più significative includono una validazione più rigorosa dei valori predefiniti degli agenti, miglioramenti alla logica di validazione dei modelli e una migliore segnalazione degli errori durante l'inizializzazione dell'applicazione.
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2025-10-29 23:09:33 +01:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull Request Overview

This PR adds validation for default agent configurations and improves error handling during application startup. The changes ensure that default models and strategies referenced in the agent configuration actually exist before the application runs.

Key changes:

  • Added validate_defaults() method to AgentsConfigs to validate that default models and strategies exist in the configuration
  • Changed default model lists from having predefined values to empty lists, requiring explicit configuration
  • Wrapped the entire __main__.py execution in a try-except block to catch and log startup failures

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/app/configs.py Added validation logic for default agent models and strategies; updated model list defaults to empty; improved documentation and logging messages
src/app/main.py Added top-level exception handling to catch and log application startup failures

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

## Pull Request Overview This PR adds validation for default agent configurations and improves error handling during application startup. The changes ensure that default models and strategies referenced in the agent configuration actually exist before the application runs. **Key changes:** - Added `validate_defaults()` method to `AgentsConfigs` to validate that default models and strategies exist in the configuration - Changed default model lists from having predefined values to empty lists, requiring explicit configuration - Wrapped the entire `__main__.py` execution in a try-except block to catch and log startup failures ### Reviewed Changes Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments. | File | Description | | ---- | ----------- | | src/app/configs.py | Added validation logic for default agent models and strategies; updated model list defaults to empty; improved documentation and logging messages | | src/app/__main__.py | Added top-level exception handling to catch and log application startup failures | --- 💡 <a href="/Berack96/upo-appAI/new/main/.github?filename=*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-29 23:09:33 +01:00

The exception is caught and logged but the application continues silently without exiting. Consider adding sys.exit(1) or raise after the logging statement to ensure the application terminates with a non-zero exit code when startup fails.

The exception is caught and logged but the application continues silently without exiting. Consider adding `sys.exit(1)` or `raise` after the logging statement to ensure the application terminates with a non-zero exit code when startup fails.
@@ -147,6 +149,28 @@ class AgentsConfigs(BaseModel):
query_analyzer_model: str = "gemini-2.0-flash"
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-29 23:09:33 +01:00

The docstring parameters don't match the actual method signature. The method accepts a single configs: AppConfig parameter, not separate models and strategies parameters. Update the Args section to reflect the actual parameter.

            configs: AppConfig instance containing all available models and strategies.
The docstring parameters don't match the actual method signature. The method accepts a single `configs: AppConfig` parameter, not separate `models` and `strategies` parameters. Update the Args section to reflect the actual parameter. ```suggestion configs: AppConfig instance containing all available models and strategies. ```
Simo93-rgb (Migrated from github.com) approved these changes 2025-10-30 15:47:06 +01:00
Sign in to join this conversation.