-
Notifications
You must be signed in to change notification settings - Fork 904
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
Executions queries #988
Executions queries #988
Conversation
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
CI Failure Feedback 🧐(Checks updated until commit ce47442)
✨ CI feedback usage guide:The CI feedback tool (
In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:
where Configuration options
See more information about the |
bfdd1d5
to
b2994bd
Compare
@@ -45,8 +45,8 @@ | |||
async def get_execution( | |||
*, | |||
execution_id: UUID, | |||
) -> tuple[str, dict]: | |||
) -> tuple[str, list]: | |||
return ( |
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.
you can add a third return value "fetchrow" and add rewrap_exception with asyncpg.exceptions.NoDataFoundError, this will return 404 in case the execution doesn't exist.
Make sure to refactor the return type of the function, and you can look at get_agent to see an example.
] | ||
|
||
return (queries, {"task_token": task_token, "transition_id": transition_id}) | ||
return ( |
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.
same comment, you can add "fetchrow"
# :assert some | ||
# """ | ||
|
||
return ( |
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.
same comment, you can add "fetchrow"
|
||
:limit 1 | ||
""" | ||
execution_id = str(execution_id) | ||
|
||
return ( |
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.
same comment, you can add "fetchrow"
return ( | ||
sql_query, |
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.
before returning you could catch 2 exceptions where limit and offset values are out of bounds (negative number for limit for example)
3232ae9
to
7ed5fda
Compare
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 ce47442 in 1 minute and 47 seconds
More details
- Looked at
2318
lines of code in17
files - Skipped
0
files when reviewing. - Skipped posting
5
drafted comments based on config settings.
1. agents-api/agents_api/queries/executions/create_execution.py:94
- Draft comment:
Ensureexecution_data
contains theinput
key to avoid potential KeyError.
execution_data.get("input", {})
- Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The key insight is that data is annotated with dict_like(CreateExecutionRequest), which means it must match the CreateExecutionRequest schema. If 'input' was optional, it would be marked as such in the schema. Since it's being used directly without any optional handling, it's likely a required field in CreateExecutionRequest. The type system would catch missing required fields.
I don't have direct access to the CreateExecutionRequest schema definition, so I'm making assumptions about the required fields. The type checking could be disabled at runtime.
The @beartype decorator enforces runtime type checking, and dict_like validation would fail if required fields were missing. The code is already properly validated.
The comment should be deleted because 'input' is a required field that's validated by both static typing and runtime checks. Using .get() would hide real errors.
2. agents-api/agents_api/queries/executions/create_execution_transition.py:148
- Draft comment:
Ensurestep_definition
andstep_label
are correctly set if needed.
transition_data.get("step_definition", {}),
transition_data.get("step_label", None),
- Reason this comment was not posted:
Comment did not seem useful.
3. agents-api/agents_api/queries/executions/get_execution_transition.py:54
- Draft comment:
Remove unuseddeveloper_id
parameter if not needed. - Reason this comment was not posted:
Confidence changes required:50%
Inget_execution_transition.py
, thedeveloper_id
parameter is not used. This could be a potential oversight or a placeholder for future use. It should be removed if not needed.
4. agents-api/agents_api/queries/executions/get_paused_execution_token.py:38
- Draft comment:
Remove unuseddeveloper_id
parameter if not needed. - Reason this comment was not posted:
Confidence changes required:50%
Inget_paused_execution_token.py
, thedeveloper_id
parameter is not used. This could be a potential oversight or a placeholder for future use. It should be removed if not needed.
5. agents-api/agents_api/queries/executions/lookup_temporal_data.py:31
- Draft comment:
Remove unuseddeveloper_id
parameter if not needed. - Reason this comment was not posted:
Confidence changes required:50%
Inlookup_temporal_data.py
, thedeveloper_id
parameter is not used. This could be a potential oversight or a placeholder for future use. It should be removed if not needed.
Workflow ID: wflow_YaA2hQk6Dvyv1eqf
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
PR Type
Enhancement, Bug fix
Description
Major refactoring of execution queries to migrate from Cozo to PostgreSQL:
Changes walkthrough 📝
13 files
__init__.py
Simplify execution transitions module imports
agents-api/agents_api/queries/executions/init.py
count_executions.py
Refactor count executions query for PostgreSQL
agents-api/agents_api/queries/executions/count_executions.py
create_execution.py
Migrate execution creation to PostgreSQL
agents-api/agents_api/queries/executions/create_execution.py
create_execution_transition.py
Convert execution transition creation to PostgreSQL
agents-api/agents_api/queries/executions/create_execution_transition.py
create_temporal_lookup.py
Migrate temporal lookup creation to PostgreSQL
agents-api/agents_api/queries/executions/create_temporal_lookup.py
get_execution.py
Enhance execution retrieval with PostgreSQL
agents-api/agents_api/queries/executions/get_execution.py
get_execution_transition.py
Convert execution transition retrieval to PostgreSQL
agents-api/agents_api/queries/executions/get_execution_transition.py
get_paused_execution_token.py
Migrate paused execution token retrieval to PostgreSQL
agents-api/agents_api/queries/executions/get_paused_execution_token.py
list_executions.py
Add PostgreSQL-based execution listing functionality
agents-api/agents_api/queries/executions/list_executions.py
lookup_temporal_data.py
Add PostgreSQL-based temporal data lookup
agents-api/agents_api/queries/executions/lookup_temporal_data.py
prepare_execution_input.py
Optimize execution input preparation with PostgreSQL
agents-api/agents_api/queries/executions/prepare_execution_input.py
update_execution.py
Remove separate execution update functionality
agents-api/agents_api/queries/executions/update_execution.py
create_task_execution.py
Update task execution creation with new database approach
agents-api/agents_api/routers/tasks/create_task_execution.py
2 files
fixtures.py
Update test fixtures for PostgreSQL migration
agents-api/tests/fixtures.py
test_execution_queries.py
Convert execution query tests to PostgreSQL
agents-api/tests/test_execution_queries.py