-
Notifications
You must be signed in to change notification settings - Fork 938
dev->main #1284
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
Conversation
…──────────────────────�[0m �[38;5;238m│ �[0m�[1mSTDIN�[0m �[38;5;238m───────┼────────────────────────────────────────────────────────────────────────�[0m �[38;5;238m 1�[0m �[38;5;238m│�[0m �[38;2;131;148;150mfix: Properly handle Jinja2 template errors�[0m �[38;5;238m 2�[0m �[38;5;238m│�[0m �[38;5;238m 3�[0m �[38;5;238m│�[0m �[38;2;131;148;150m- Catch TemplateSyntaxError and UndefinedError from Jinja2 and convert them to user-friendly HTTP 400 errors�[0m �[38;5;238m 4�[0m �[38;5;238m│�[0m �[38;2;131;148;150m- This prevents 500 Internal Server Errors when users have syntax errors in their templates, such as using undefined functions�[0m �[38;5;238m 5�[0m �[38;5;238m│�[0m �[38;2;131;148;150m- Fixes issue #1216�[0m �[38;5;238m 6�[0m �[38;5;238m│�[0m �[38;5;238m 7�[0m �[38;5;238m│�[0m �[38;2;131;148;150m🤖 Generated with [Claude Code](https://claude.ai/code)�[0m �[38;5;238m 8�[0m �[38;5;238m│�[0m �[38;5;238m 9�[0m �[38;5;238m│�[0m �[38;2;131;148;150mCo-Authored-By: Claude <noreply@anthropic.com>�[0m �[38;5;238m───────┴────────────────────────────────────────────────────────────────────────�[0m
Co-authored-by: qodo-merge-pro-for-open-source[bot] <189517486+qodo-merge-pro-for-open-source[bot]@users.noreply.github.com>
…errors fix: Properly handle Jinja2 template errors
Fix: Enable compression for transitions and entries tables
…h_window to optimize Signed-off-by: Diwank Singh Tomer <diwank.singh@gmail.com>
Signed-off-by: Diwank Singh Tomer <diwank.singh@gmail.com>
feat(agents-api): Restrict entries and transitions queries to a search_window to optimize
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
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.
👍 Looks good to me! Reviewed everything up to 8eb0612 in 1 minute and 34 seconds
More details
- Looked at
648
lines of code in12
files - Skipped
0
files when reviewing. - Skipped posting
16
drafted comments based on config settings.
1. agents-api/agents_api/clients/pg.py:9
- Draft comment:
Looping over ['json', 'jsonb'] is clear. Consider adding a comment why both types are configured, in case future types need support. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%
<= threshold50%
The comment is asking for an explanation to be added, which is not allowed by the rules. It doesn't provide a specific code suggestion or point out a potential issue with the code itself. Therefore, it should be removed.
2. agents-api/agents_api/common/utils/template.py:39
- Draft comment:
Good try/except handling for template rendering. Ensure error messages do not leak sensitive info. - Reason this comment was not posted:
Comment looked like it was already resolved.
3. agents-api/agents_api/queries/entries/get_history.py:12
- Draft comment:
The query now selects 'session_created_at' to return as created_at. Verify that aggregation with potential multiple rows returns a consistent single value. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%
<= threshold50%
The comment is asking the author to verify the behavior of the query, which is against the rules. It doesn't provide a specific suggestion or point out a clear issue with the code. It is more of a request for the author to double-check their work, which is not allowed.
4. agents-api/agents_api/queries/entries/list_entries.py:44
- Draft comment:
Additional created_at constraints look good; ensure that comparing entry created_at with session created_at works as intended and is well-indexed. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%
<= threshold50%
The comment is asking the PR author to ensure that a comparison works as intended, which violates the rule against asking for confirmation or ensuring behavior. It does not provide a specific suggestion or point out a clear issue.
5. agents-api/agents_api/queries/executions/count_executions.py:13
- Draft comment:
The condition on created_at (comparing with developers.created_at) might help filter recent executions; consider performance implications if table grows large. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50%
The comment is purely informative/speculative about potential performance implications. It doesn't identify a specific problem or suggest a concrete change. It uses language like "might help" and "consider" which indicates uncertainty. Performance concerns would need more context/evidence to be actionable.
Maybe there really is a performance issue here that needs to be addressed? The subquery could potentially be inefficient.
Without specific evidence of a performance problem or a concrete suggestion for improvement, this is just speculation. The database will likely optimize this simple subquery well.
Delete this comment as it's purely informative/speculative and doesn't require any specific code changes.
6. agents-api/agents_api/queries/executions/get_paused_execution_token.py:51
- Draft comment:
Execution ID is converted to string. Ensure consistency with other queries expecting UUIDs or strings. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
7. agents-api/agents_api/queries/executions/list_execution_transitions.py:19
- Draft comment:
The placeholder for scope_id changes from $6 to $7. Verify that parameter ordering in the params array remains correct, especially when scope_id is omitted. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =30%
<= threshold50%
The comment is asking the author to verify the parameter ordering, which is against the rules as it asks for confirmation or verification. However, it does point out a specific change in the code that could lead to an issue if not handled correctly. The comment could be rephrased to suggest checking the parameter ordering without asking for verification.
8. agents-api/agents_api/queries/executions/list_executions.py:38
- Draft comment:
Updated sorting conditions now include 'updated_at'. Confirm that interpolation of sort fields is safe and test cases cover both created_at and updated_at sorting. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =30%
<= threshold50%
The comment is asking the PR author to confirm the safety of interpolation and to ensure test cases cover specific scenarios. This violates the rule against asking the author to confirm or ensure things. However, the comment could be useful if it specifically suggested adding test cases forcreated_at
andupdated_at
sorting.
9. memory-store/migrations/000034_switch_to_hypercore.up.sql:3
- Draft comment:
Migration script now uses compression policies instead of hypercore access method. Verify that these changes are idempotent and thoroughly tested in production-like environments. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%
<= threshold50%
The comment is asking the PR author to verify that the changes are idempotent and thoroughly tested, which violates the rule against asking for confirmation or testing. It does not provide a specific code suggestion or point out a specific issue with the code.
10. agents-api/agents_api/clients/pg.py:9
- Draft comment:
Looping over ['json', 'jsonb'] codecs is clear. Confirm that using json.dumps/loads is appropriate for both types in your schema. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
11. agents-api/agents_api/common/utils/template.py:50
- Draft comment:
Exposing raw exception messages in HTTP responses (e.g. TemplateSyntaxError and UndefinedError) may leak internal details; consider sanitizing these in production. - Reason this comment was not posted:
Comment looked like it was already resolved.
12. agents-api/agents_api/queries/entries/get_history.py:67
- Draft comment:
Using utcnow() as a fallback for 'created_at' may mask missing data; please confirm that substituting the current time is the intended behavior. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50%
The comment asks the author to "confirm" the behavior, which violates our rules about not asking for confirmations. The code change appears intentional - they're getting created_at from the session table and using utcnow() as a fallback, which is a common pattern. The SQL query's structure suggests this is well thought out.
Maybe there could be a legitimate data integrity concern here that deserves attention? The fallback could hide bugs.
While data integrity is important, the comment merely asks for confirmation rather than identifying a specific issue. The code appears to handle the edge case intentionally and safely.
Delete this comment as it violates our rule about not asking authors to confirm their intentions, and doesn't identify a clear problem that needs fixing.
13. agents-api/agents_api/queries/entries/list_entries.py:44
- Draft comment:
There are two created_at conditions ('e.created_at >= $7' and 'e.created_at >= (select created_at from sessions where session_id = $1)'). Verify that both filters are intended and do not conflict. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50%
The two conditions appear to be intentionally added together - one ensures we only look at entries within the search window, and the other ensures we don't look at entries created before the session itself. This is logical and there's no apparent conflict. The comment is asking for verification without identifying any actual problem. This violates the rule about not asking authors to verify their intentions.
Perhaps there could be a legitimate performance concern about having two timestamp conditions that could be combined. Maybe I'm missing some edge case where these conditions could conflict.
The conditions serve distinct purposes and are clearly intentional. If there were performance issues, they would be caught in testing. Without strong evidence of a problem, we shouldn't keep speculative comments.
Delete this comment as it merely asks for verification without identifying any actual issue, violating our rules about not asking authors to confirm their intentions.
14. agents-api/agents_api/queries/executions/list_execution_transitions.py:19
- Draft comment:
The parameter index for scope_id has shifted (using $7) with the added search_window filter. Ensure that the parameter ordering is maintained consistently. - Reason this comment was not posted:
Comment looked like it was already resolved.
15. agents-api/agents_api/queries/executions/list_executions.py:39
- Draft comment:
The ORDER BY clause now supports sorting by 'updated_at'. Ensure that there are appropriate indexes on 'updated_at' for optimal performance. - Reason this comment was not posted:
Confidence changes required:33%
<= threshold50%
None
16. memory-store/migrations/000034_switch_to_hypercore.up.sql:6
- Draft comment:
Migration script updates the compression settings for 'entries' and 'transitions'. Verify that these new TimescaleDB compression policies match your performance and data retention requirements. - Reason this comment was not posted:
Confidence changes required:33%
<= threshold50%
None
Workflow ID: wflow_S5M9XoFoHtcirmyN
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
PR Type
Bug fix, Enhancement, Tests
Description
Improved error handling for Jinja2 template rendering:
TemplateSyntaxError
andUndefinedError
to return HTTP 400 errors.Enhanced database query logic:
search_window
for time-based filtering in queries.Updated database schema:
entries
andtransitions
tables.Added test improvements for execution queries.
Changes walkthrough 📝
10 files
Support multiple JSON types for database connections
Refine session history query with stricter filters
Add time-based filtering to list entries query
Add time-based filtering for execution count query
Add time-based filtering for paused execution token query
Add time-based filtering for execution transitions query
Improve sorting logic for execution listing
Simplify query structure for execution input preparation
Revert hypercore changes with improved error handling
Apply hypercore compression policies with error handling
1 files
Add error handling for Jinja2 template rendering
1 files
Add test for execution listing with updated sorting