-
Notifications
You must be signed in to change notification settings - Fork 777
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
Observer artifact creation #1345
Conversation
<!-- ELLIPSIS_HIDDEN --> > [!IMPORTANT] > Add support for observer artifact creation in `ArtifactManager` with new schema models and database updates. > > - **Artifact Manager**: > - Adds `create_observer_thought_artifact()` in `manager.py` for creating observer thought artifacts. > - Introduces `_create_artifact()` as a helper method in `manager.py`. > - **Schemas**: > - Adds `ObserverCruise` and `ObserverThought` models in `schemas/observers.py`. > - Defines `ObserverCruiseStatus` enum for cruise status. > - **Database Models**: > - Renames `ObserverCruise` to `ObserverCruiseModel` and `ObserverThought` to `ObserverThoughtModel` in `models.py`. > - **Storage**: > - Adds `build_observer_thought_uri()` and `build_observer_cruise_uri()` in `base.py`, `local.py`, and `s3.py` for URI construction. > - **Misc**: > - Updates `convert_to_artifact()` in `utils.py` to handle new fields. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=Skyvern-AI%2Fskyvern-cloud&utm_source=github&utm_medium=referral)<sup> for 5f69680cb82830e452c7c57c248e9805f9a0c12e. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN -->
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! Incremental review on 3fca676 in 31 seconds
More details
- Looked at
425
lines of code in9
files - Skipped
0
files when reviewing. - Skipped posting
5
drafted comments based on config settings.
1. skyvern/forge/sdk/artifact/manager.py:111
- Draft comment:
The use ofLiteral
for theprimary_key
parameter is unnecessary. Consider using a simple string type instead for better readability and simplicity. - Reason this comment was not posted:
Confidence changes required:50%
The code inmanager.py
has a potential issue with the use ofLiteral
for theprimary_key
parameter inupdate_artifact_data
. The use ofLiteral
is not necessary here and can be replaced with a simple string type, as it doesn't provide any additional type safety or functionality in this context.
2. skyvern/forge/sdk/artifact/manager.py:23
- Draft comment:
Ensure thataio_task_primary_key
is a valid key inupload_aiotasks_map
to prevent potential KeyErrors. - Reason this comment was not posted:
Confidence changes required:50%
Inmanager.py
, the_create_artifact
method has a potential issue with theaio_task_primary_key
parameter. It is used to index theupload_aiotasks_map
, but there is no check to ensure that this key is valid or exists. This could lead to potential KeyErrors if the key is not present in the map.
3. skyvern/forge/sdk/artifact/manager.py:71
- Draft comment:
Consider refactoring the repeated pattern of generatingartifact_id
and building a URI into a helper function to reduce code duplication. - Reason this comment was not posted:
Confidence changes required:50%
Inmanager.py
, thecreate_artifact
andcreate_observer_thought_artifact
methods both generate a newartifact_id
and then immediately use it to build a URI. This pattern is repeated and could be refactored into a helper function to reduce code duplication and improve maintainability.
4. skyvern/forge/sdk/artifact/storage/local.py:39
- Draft comment:
Consider refactoring the file path and directory handling logic into a helper method to reduce code duplication instore_artifact
andstore_artifact_from_path
. - Reason this comment was not posted:
Confidence changes required:50%
Inlocal.py
, thestore_artifact
andstore_artifact_from_path
methods both have similar logic for handling file paths and directories. This logic could be refactored into a helper method to reduce code duplication and improve maintainability.
5. skyvern/forge/sdk/artifact/storage/s3.py:42
- Draft comment:
Consider adding error handling forasync_client
operations to manage potential upload failures. - Reason this comment was not posted:
Confidence changes required:50%
Ins3.py
, thestore_artifact
andstore_artifact_from_path
methods both use theasync_client
to upload files. If theasync_client
fails, there is no error handling to manage this situation, which could lead to unhandled exceptions.
Workflow ID: wflow_xCqiovgSWMfjigKu
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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 3fca676 in 1 minute and 26 seconds
More details
- Looked at
425
lines of code in9
files - Skipped
0
files when reviewing. - Skipped posting
5
drafted comments based on config settings.
1. skyvern/forge/sdk/artifact/manager.py:111
- Draft comment:
Consider using anEnum
instead ofLiteral
for theprimary_key
parameter to ensure type safety and avoid potential runtime errors. - Reason this comment was not posted:
Confidence changes required:50%
The use ofLiteral
for theprimary_key
parameter in theupdate_artifact_data
method is not ideal. It would be better to use anEnum
to ensure type safety and avoid potential runtime errors.
2. skyvern/forge/sdk/artifact/manager.py:64
- Draft comment:
Consider extracting the logic for generatingartifact_id
anduri
into a helper function to reduce code duplication increate_artifact
andcreate_observer_thought_artifact
. - Reason this comment was not posted:
Confidence changes required:50%
Thecreate_artifact
andcreate_observer_thought_artifact
methods have similar logic for generatingartifact_id
anduri
. This logic can be extracted into a helper function to reduce code duplication.
3. skyvern/forge/sdk/artifact/storage/local.py:27
- Draft comment:
Consider extracting the URI construction logic into a shared utility function to reduce code duplication betweenLocalStorage
andS3Storage
. - Reason this comment was not posted:
Confidence changes required:50%
Thebuild_observer_thought_uri
andbuild_observer_cruise_uri
methods inLocalStorage
andS3Storage
have similar logic for constructing URIs. This logic can be extracted into a shared utility function to reduce code duplication.
4. skyvern/forge/sdk/artifact/storage/s3.py:30
- Draft comment:
Consider extracting the URI construction logic into a shared utility function to reduce code duplication betweenLocalStorage
andS3Storage
. - Reason this comment was not posted:
Confidence changes required:50%
Thebuild_observer_thought_uri
andbuild_observer_cruise_uri
methods inLocalStorage
andS3Storage
have similar logic for constructing URIs. This logic can be extracted into a shared utility function to reduce code duplication.
5. skyvern/forge/sdk/db/utils.py:150
- Draft comment:
Ensure thatartifact_model.artifact_type
is a valid key inArtifactType
to avoid potentialKeyError
. Consider usingget
with a default value or handling the exception. - Reason this comment was not posted:
Confidence changes required:50%
Theconvert_to_artifact
function usesArtifactType[artifact_model.artifact_type.upper()]
which assumes that theartifact_type
is always a valid key in theArtifactType
enum. This could lead to aKeyError
if theartifact_type
is not valid. It would be safer to handle this potential error.
Workflow ID: wflow_fxvMvb5VsuQ2VlQF
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Important
Add support for observer artifact creation in
ArtifactManager
with new schema models and database updates.create_observer_thought_artifact()
inmanager.py
for creating observer thought artifacts._create_artifact()
as a helper method inmanager.py
.ObserverCruise
andObserverThought
models inschemas/observers.py
.ObserverCruiseStatus
enum for cruise status.ObserverCruise
toObserverCruiseModel
andObserverThought
toObserverThoughtModel
inmodels.py
.build_observer_thought_uri()
andbuild_observer_cruise_uri()
inbase.py
,local.py
, ands3.py
for URI construction.convert_to_artifact()
inutils.py
to handle new fields.This description was created by for 3fca676. It will automatically update as commits are pushed.