- Notifications
You must be signed in to change notification settings - Fork27
Add database feedback#337
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:staging
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
overcut-aibot commentedDec 16, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Completed Working on "Code Review"✅ Review submitted: REQUEST_CHANGES. Total comments: 4 across files. Blocker issues present; requested changes with summary and next steps. |
coderabbitaibot commentedDec 16, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for usingCodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
github-actionsbot commentedDec 16, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
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.
Summary
- Blocker: 1
- Major: 3
- Minor: 0
Key themes
- Healing flow currently bypasses the destructive-query/schema safeguards and lacks error handling around healed execution, leaving the DB vulnerable to unsafe mutations and crashes.
- AnalysisAgent prompt mixes conflicting requirements, so the model can’t reliably decide when to translate or how to format SQL, leading to unpredictable answers.
parse_responseenforces a fixed key set and silently drops agent outputs that don’t match, so callers can’t handle malformed JSON or tailor required fields.
Next steps
- After healing a query, re-run the destructive/schema validations and wrap execution in proper error handling so unsafe SQL is never run unchecked.
- Refine the AnalysisAgent prompt to clearly separate translatable vs. non-translatable questions and spell out the SQL generation rules without contradictions.
- Make
parse_responseconfigurable so callers can specify required keys (or defaults) and receive structured errors instead of discarded payloads.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
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 5 out of 5 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (3)
api/agents/healer_agent.py:1
- The dictionary construction spans multiple lines inconsistently. Consider using consistent formatting, either all on one line or each key-value pair on its own line.
"""api/agents/healer_agent.py:289
- Trailing whitespace on empty line. Remove trailing spaces for code cleanliness.
api/agents/healer_agent.py:1 - Modifying
answer_aninside the healing exception handler couples the healing logic to the outer scope. Consider returning the healed SQL and updatinganswer_anin a single location for clarity.
"""Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
galshubeli commentedDec 16, 2025
@coderabbitai review |
✅ Actions performedReview triggered.
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
| @@ -1,4 +1,5 @@ | |||
| """Graph-related routes for the text2sql API.""" | |||
| # pylint: disable=line-too-long,trailing-whitespace | |||
CopilotAIDec 16, 2025
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.
Disabling trailing-whitespace warnings suggests actual trailing whitespace exists in the code. Consider removing the trailing whitespace instead of disabling the linter warning.
| # pylint: disable=line-too-long,trailing-whitespace | |
| # pylint: disable=line-too-long |
| step= {"type":"reasoning_step", | ||
| "final_response":False, | ||
| "message":"Step 2a: SQL execution failed, attempting to heal query..."} |
CopilotAIDec 16, 2025
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.
Dictionary literal spanning multiple lines uses inconsistent formatting. Consider either placing all key-value pairs on separate lines or using a single line for better readability.
| step= {"type":"reasoning_step", | |
| "final_response":False, | |
| "message":"Step 2a: SQL execution failed, attempting to heal query..."} | |
| step= { | |
| "type":"reasoning_step", | |
| "final_response":False, | |
| "message":"Step 2a: SQL execution failed, attempting to heal query..." | |
| } |
| healing_result=HealerAgent().heal_query( | ||
| failed_sql=answer_an["sql_query"], | ||
| error_message=str(exec_error), |
CopilotAIDec 16, 2025
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 truncation of db_description to 500 characters is a magic number without explanation. Add a comment explaining why this specific limit is used for healing context.
| error_message=str(exec_error), | |
| error_message=str(exec_error), | |
| # Truncate db_description to 500 characters to limit context size for the healing agent. | |
| # This helps keep the prompt concise and avoids exceeding model input limits. |
| question=queries_history[-1], | ||
| database_type=db_type | ||
| ) | ||
CopilotAIDec 16, 2025
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.
Blank line 464 contains trailing whitespace based on the pylint disable at line 2. Remove trailing whitespace from empty lines.
| ifhealing_result.get("healing_failed"): | ||
| raiseexec_error | ||
CopilotAIDec 16, 2025
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.
Blank line 467 contains trailing whitespace based on the pylint disable at line 2. Remove trailing whitespace from empty lines.
| ifhealing_result.get("healing_failed"): | |
| raiseexec_error | |
| ifhealing_result.get("healing_failed"): | |
| raiseexec_error |
| Initialize the HealerAgent. | ||
| """ | ||
CopilotAIDec 16, 2025
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.
Blank line 27 contains trailing whitespace. Remove trailing whitespace from empty lines for consistency.
| defvalidate_sql_syntax(sql_query:str)->dict: | ||
| """ | ||
| Validate SQL query for basic syntax errors. | ||
| Similar to CypherValidator in the text-to-cypher PR. |
CopilotAIDec 16, 2025
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.
Comment references "text-to-cypher PR" which is an external context that won't be meaningful to future maintainers. Consider removing this reference or explaining what validation patterns were borrowed from that work.
| SimilartoCypherValidatorinthetext-to-cypherPR. | |
| PerformschecksforpresenceofSQLkeywords,dangerousoperations,andbalancedparentheses,inspiredbycommonvalidationpatternsusedinqueryvalidators. |
| "errors":errors, | ||
| "warnings":warnings | ||
| } | ||
CopilotAIDec 16, 2025
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.
Blank line 89 contains trailing whitespace. Remove trailing whitespace from empty lines for consistency.
| db_description:str="", | ||
| question:str="", | ||
| database_type:str="sqlite" | ||
| )->Dict[str,any]: |
CopilotAIDec 16, 2025
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.
Return type annotation uses lowercase 'any' instead of 'Any'. In Python type hints, the correct type is 'Any' from the typing module (already imported). Change 'any' to 'Any'.
| additional_context+=f"\nSyntax errors:{', '.join(validation_result['errors'])}" | ||
| ifvalidation_result["warnings"]: | ||
| additional_context+=f"\nWarnings:{', '.join(validation_result['warnings'])}" | ||
CopilotAIDec 16, 2025
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.
Blank line 122 contains trailing whitespace. Remove trailing whitespace from empty lines for consistency.
gkorland commentedDec 16, 2025
@copilot can you please fix the pylint issues in the CI? |
No description provided.