-
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
shu/maksimi/record logs new #1399
Conversation
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.
❌ Changes requested. Reviewed everything up to d18b852 in 6 minutes and 15 seconds
More details
- Looked at
933
lines of code in16
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. skyvern/forge/sdk/db/client.py:812
- Draft comment:
Ensure that at least one filter is applied inget_artifacts_by_entity_id
to avoid full table scans and potential performance issues. - Reason this comment was not posted:
Comment did not seem useful.
Workflow ID: wflow_5m0vLQP0KJqVXjLJ
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
from skyvern.forge.sdk.db.id import generate_artifact_id | ||
from skyvern.forge.sdk.models import Step | ||
from skyvern.forge.sdk.schemas.observers import ObserverCruise, ObserverThought | ||
|
||
LOG = structlog.get_logger(__name__) | ||
|
||
PRIMARY_KEY = Literal[ |
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.
Consider using an Enum
instead of Literal
for PRIMARY_KEY
to define a set of constant values. Literal
is not intended for use as a type for function parameters.
@@ -70,3 +74,13 @@ def serialize_datetime_to_isoformat(self, value: datetime) -> str: | |||
observer_thought_id: str | None = None | |||
signed_url: str | None = None | |||
organization_id: str | None = None | |||
|
|||
def __getitem__(self, key: str) -> Any: |
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 __getitem__
method should handle cases where the attribute does not exist to avoid runtime errors. Consider using getattr(self, key, default)
to provide a default value if the attribute is not found.
@@ -13,6 +13,7 @@ class SkyvernContext: | |||
max_steps_override: int | None = None | |||
tz_info: ZoneInfo | None = None | |||
totp_codes: dict[str, str | None] = field(default_factory=dict) | |||
log: list[dict] = field(default_factory=list) |
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.
Consider using a structured log entry class for the log
attribute in SkyvernContext
to ensure consistency in log entry formatting.
@@ -54,6 +54,21 @@ def add_kv_pairs_to_msg(logger: logging.Logger, method_name: str, event_dict: Ev | |||
return event_dict | |||
|
|||
|
|||
def skyvern_logs_processor(logger: logging.Logger, method_name: str, event_dict: EventDict) -> EventDict: |
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.
Consider implementing a mechanism to limit the size of the log list in skyvern_logs_processor
to prevent excessive memory usage.
fcadd70
to
63829fa
Compare
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 63829fa in 58 seconds
More details
- Looked at
472
lines of code in7
files - Skipped
0
files when reviewing. - Skipped posting
4
drafted comments based on config settings.
1. skyvern/forge/agent.py:53
- Draft comment:
Duplicate import ofsave_step_logs
andsave_task_logs
. Remove the redundant import statement. - Reason this comment was not posted:
Comment looked like it was already resolved.
2. skyvern/forge/sdk/artifact/manager.py:205
- Draft comment:
PRIMARY_KEY
type alias is removed but still used inupdate_artifact_data
. Ensure the type is correctly defined or updated. - Reason this comment was not posted:
Comment looked like it was already resolved.
3. skyvern/forge/sdk/log_artifacts.py:27
- Draft comment:
Ensure context is always available when callingsave_step_logs
,save_task_logs
,save_workflow_run_logs
, andsave_workflow_run_block_logs
sincewith_skyvern_context
decorator is removed. - Reason this comment was not posted:
Comment did not seem useful.
4. skyvern/forge/sdk/routes/agent_protocol.py:530
- Draft comment:
Review the# type: ignore
comment onget_artifacts_by_entity_id
to ensure type safety and correctness. - Reason this comment was not posted:
Comment did not seem useful.
Workflow ID: wflow_2IwAvw71rovhxq9W
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Important
Introduces a new logging system for Skyvern, including log artifact types, context management, and frontend integration for efficient log handling and display.
SkyvernLog
andSkyvernLogRaw
artifact types.SkyvernLogEncoder
andSkyvernJSONLogEncoder
for log serialization.save_step_logs
,save_task_logs
, andsave_workflow_run_logs
inlog_artifacts.py
to store logs.forge_log.py
to includeskyvern_logs_processor
for context-based logging.agent.py
to callsave_step_logs
andsave_task_logs
during task and step updates.create_log_artifact
method inmanager.py
for log artifact creation.client.py
to handle log artifacts retrieval by entity ID.StepArtifacts.tsx
to display logs.ScrollableActionList.tsx
to fetch artifacts using new endpoint structure./entity_type/entity_id/artifacts
endpoint inagent_protocol.py
for fetching artifacts by entity type and ID.This description was created by for 63829fa. It will automatically update as commits are pushed.