-
Notifications
You must be signed in to change notification settings - Fork 79
π Fix: Null/None Reference Errors in AgentV2 #54
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -43,17 +43,34 @@ class AgentV2: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Enhanced orchestrator with intelligent research/action flow.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def __init__(self, db=None, organization=None, organization_settings=None, report=None, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| model=None, small_model=None, mode=None, messages=[], head_completion=None, system_completion=None, widget=None, step=None, event_queue=None, clients=None, build_id=None): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| model=None, small_model=None, mode=None, messages=None, head_completion=None, system_completion=None, widget=None, step=None, event_queue=None, clients=None, build_id=None): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.db = db | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.build_id = build_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.organization = organization | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.organization_settings = organization_settings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.top_k_schema = organization_settings.get_config("top_k_schema").value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.top_k_metadata_resources = organization_settings.get_config("top_k_metadata_resources").value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.mode = mode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Safe retrieval of configuration values with null checks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Prevent AttributeError if get_config() returns None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if organization_settings: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| top_k_schema_config = organization_settings.get_config("top_k_schema") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.top_k_schema = top_k_schema_config.value if top_k_schema_config else 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| top_k_metadata_config = organization_settings.get_config("top_k_metadata_resources") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.top_k_metadata_resources = top_k_metadata_config.value if top_k_metadata_config else 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+56
to
+59
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.top_k_schema = top_k_schema_config.value if top_k_schema_config else 10 | |
| top_k_metadata_config = organization_settings.get_config("top_k_metadata_resources") | |
| self.top_k_metadata_resources = top_k_metadata_config.value if top_k_metadata_config else 5 | |
| self.top_k_schema = ( | |
| top_k_schema_config.value | |
| if (top_k_schema_config is not None and top_k_schema_config.value is not None) | |
| else 10 | |
| ) | |
| top_k_metadata_config = organization_settings.get_config("top_k_metadata_resources") | |
| self.top_k_metadata_resources = ( | |
| top_k_metadata_config.value | |
| if (top_k_metadata_config is not None and top_k_metadata_config.value is not None) | |
| else 5 | |
| ) |
Copilot
AI
Jan 8, 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.
Similar to the issue on line 56, if top_k_metadata_config exists but top_k_metadata_config.value is None, then self.top_k_metadata_resources will be set to None. This could cause downstream errors when the value is used in operations that expect an integer. Consider adding an additional check: self.top_k_metadata_resources = top_k_metadata_config.value if (top_k_metadata_config and top_k_metadata_config.value is not None) else 5
| self.top_k_schema = top_k_schema_config.value if top_k_schema_config else 10 | |
| top_k_metadata_config = organization_settings.get_config("top_k_metadata_resources") | |
| self.top_k_metadata_resources = top_k_metadata_config.value if top_k_metadata_config else 5 | |
| self.top_k_schema = ( | |
| top_k_schema_config.value | |
| if (top_k_schema_config and top_k_schema_config.value is not None) | |
| else 10 | |
| ) | |
| top_k_metadata_config = organization_settings.get_config("top_k_metadata_resources") | |
| self.top_k_metadata_resources = ( | |
| top_k_metadata_config.value | |
| if (top_k_metadata_config and top_k_metadata_config.value is not None) | |
| else 5 | |
| ) |
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
messagesparameter is changed from a mutable default[]toNone, which is good practice. However, this parameter is never used in the constructor or anywhere else in the class. Consider removing it entirely from the function signature to avoid confusion and reduce the API surface. There are call sites (e.g., test_run_service.py:971, completion_service.py:267) that explicitly passmessages=[], which would need to be updated if this parameter is removed.