Skip to content
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

fix restart workflow run #1481

Merged
merged 1 commit into from
Jan 3, 2025
Merged

fix restart workflow run #1481

merged 1 commit into from
Jan 3, 2025

Conversation

wintonzheng
Copy link
Contributor

@wintonzheng wintonzheng commented Jan 3, 2025

Important

Adds delete_workflow_run_blocks in client.py and updates reset_workflow_run in workflows.py to delete workflow run blocks during reset.

  • Behavior:
    • In reset_workflow_run in workflows.py, added call to delete_workflow_run_blocks to remove workflow run blocks during reset.
  • Database:
    • Added delete_workflow_run_blocks function in client.py to delete WorkflowRunBlockModel entries by workflow_run_id and organization_id.

This description was created by Ellipsis for bc3fe61. It will automatically update as commits are pushed.

<!-- ELLIPSIS_HIDDEN -->

> [!IMPORTANT]
> Adds deletion of workflow run blocks during workflow run reset by introducing `delete_workflow_run_blocks` in `client.py` and updating `reset_workflow_run` in `workflows.py`.
>
>   - **Behavior**:
>     - In `reset_workflow_run` in `workflows.py`, added call to `delete_workflow_run_blocks` to remove workflow run blocks during reset.
>   - **Database**:
>     - Added `delete_workflow_run_blocks` function in `client.py` to delete `WorkflowRunBlockModel` entries by `workflow_run_id` and `organization_id`.
>
> <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 475d8eb41f51d7f9ebffae0290d7a15daa8a9e39. It will automatically update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a 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 bc3fe61 in 43 seconds

More details
  • Looked at 22 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. skyvern/forge/sdk/db/client.py:2135
  • Draft comment:
    Consider handling the case where organization_id is None in delete_workflow_run_blocks to avoid unintended deletions.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
  1. The function accepts organization_id as optional (str | None)
  2. The SQL where clause uses organization_id directly without checking if it's None
  3. Looking at usage patterns in the codebase, organization_id is used similarly in many other functions
  4. SQLAlchemy handles None values in where clauses appropriately - it will match NULL values
  5. There's no evidence this has caused any issues
    I could be wrong about SQLAlchemy's handling of None values in where clauses. Maybe there's a subtle issue I'm missing.
    SQLAlchemy is well-known for handling None values correctly in where clauses, converting them to SQL NULL. The codebase uses this pattern extensively without issues.
    Delete this comment. SQLAlchemy handles None values appropriately in where clauses, and this pattern is used consistently throughout the codebase.

Workflow ID: wflow_trY3Y4I3yoIMT5X2


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a 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 bc3fe61 in 54 seconds

More details
  • Looked at 22 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_A6S50ZAQ0ocqGEkL


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.

stmt = delete(WorkflowRunBlockModel).where(
and_(
WorkflowRunBlockModel.workflow_run_id == workflow_run_id,
WorkflowRunBlockModel.organization_id == organization_id,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider handling the case where organization_id is None to avoid unintended deletions. You can use a conditional filter to only apply the organization_id filter if it is not None.

@wintonzheng wintonzheng merged commit 60e051e into main Jan 3, 2025
2 checks passed
@wintonzheng wintonzheng deleted the shu/fix_restart_workflow_run branch January 3, 2025 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant