hydrate workflow run response with workflow title by wintonzheng · Pull Request #4363 · Skyvern-AI/skyvern · GitHub
Skip to content

hydrate workflow run response with workflow title - #4363

Merged
wintonzheng merged 1 commit into
mainfrom
shu/hydrate_workflow_title_in_run_workflow_response
Dec 23, 2025
Merged

wintonzheng merged 1 commit into
mainfrom
shu/hydrate_workflow_title_in_run_workflow_response

Conversation

@wintonzheng

@wintonzheng wintonzheng commented Dec 23, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Workflow run requests now include the actual workflow title, ensuring complete and accurate data in workflow execution records.

✏️ Tip: You can customize this high-level summary in your review settings.


Important

Enhance run_workflow() in agent_protocol.py to include workflow title in the response for better identification.

  • Behavior:
    • In run_workflow() in agent_protocol.py, the workflow run response now includes the workflow title.
    • Fetches workflow title using app.WORKFLOW_SERVICE.get_workflow() with workflow_run.workflow_id.
    • Updates workflow_run_request with the workflow title if available.

This description was created by Ellipsis for fd919d4. You can customize this summary. It will automatically update as commits are pushed.



🔄 This PR enhances the workflow run response by hydrating it with the workflow title, improving the user experience by providing clearer identification of executed workflows without requiring additional API calls.

🔍 Detailed Analysis

Key Changes

  • Response Enhancement: Modified run_workflow() function in agent_protocol.py to fetch and include workflow title in the response
  • Data Hydration: Added logic to retrieve workflow details using workflow_id and update the request object with the title
  • Graceful Handling: Implemented safe fallback to original request if workflow lookup fails

Technical Implementation

sequenceDiagram
    participant Client
    participant API as run_workflow()
    participant WS as WORKFLOW_SERVICE
    participant DB as Database
    
    Client->>API: POST /workflow/run
    API->>API: Create workflow_run
    API->>WS: get_workflow(workflow_id, org_id)
    WS->>DB: Query workflow by ID
    DB-->>WS: Return workflow data
    WS-->>API: Return workflow object
    API->>API: Hydrate request with workflow.title
    API-->>Client: Return WorkflowRunResponse with title
Loading

Impact

  • User Experience: Users can now see workflow titles directly in run responses, eliminating the need for separate API calls to identify workflows
  • API Consistency: Provides richer response data that aligns with user expectations for workflow identification
  • Backward Compatibility: Changes are additive and don't break existing functionality - if workflow lookup fails, the original request is used unchanged

Created with Palmier

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **New Features**
  * Workflow run responses now include the associated workflow title, providing improved clarity and easier identification of executed workflows.

<sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!-- ELLIPSIS_HIDDEN -->

----

> [!IMPORTANT]
> Enhance `run_workflow()` in `agent_protocol.py` to hydrate the workflow title from the workflow ID.
>
>   - **Behavior**:
>     - In `run_workflow()` in `agent_protocol.py`, hydrate `workflow_run_request` with the workflow title fetched using `workflow_id`.
>     - If the workflow is found, update `workflow_run_request` with the title; otherwise, use the original request.
>   - **Misc**:
>     - No changes to error handling or other logic in `run_workflow()`.
>
> <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 ea8c780e7fc3517c55244f23fae1f220f0cff5aa. You can [customize](https://app.ellipsis.dev/Skyvern-AI/settings/summaries) this summary. It will automatically update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->
@coderabbitai

coderabbitai Bot commented Dec 23, 2025 •

Copy link
Copy Markdown
Contributor

@ellipsis-dev ellipsis-dev Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed fd919d4 in 48 seconds. Click for details.
  • Reviewed 29 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. skyvern/forge/sdk/routes/agent_protocol.py:386
  • Draft comment:
    Good addition hydrating the workflow title; consider adding a warning log if no workflow is found, to aid troubleshooting unexpected missing titles.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
2. skyvern/forge/sdk/routes/agent_protocol.py:391
  • Draft comment:
    Using model_copy to update the request is appropriate; ensure this behavior is intended even if a title might already be provided in the request.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
3. skyvern/forge/sdk/routes/agent_protocol.py:387
  • Draft comment:
    The extra DB call to fetch the workflow could impact performance under heavy load; consider caching the result if this endpoint is heavily used.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_6fKsO1yfVtPU7mQe

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@ellipsis-dev ellipsis-dev Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to fd919d4 in 51 seconds. Click for details.
  • Reviewed 29 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. skyvern/forge/sdk/routes/agent_protocol.py:386
  • Draft comment:
    Good hydration of the workflow title. Consider simplifying the assignment to a one-liner: use a conditional expression to set workflow_run_request_hydrated (e.g. workflow_run_request_hydrated = workflow ? workflow_run_request.model_copy(update={"title": workflow.title}) : workflow_run_request).
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
2. skyvern/forge/sdk/routes/agent_protocol.py:392
  • Draft comment:
    Verify that updating the title field via model_copy does not inadvertently override a user-specified title. Ensure the 'title' field exists and is intended to be hydrated.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_IbpMWeu7ysIHCjeF

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@wintonzheng
wintonzheng merged commit ef8cbdd into main Dec 23, 2025
8 of 9 checks passed
@wintonzheng
wintonzheng deleted the shu/hydrate_workflow_title_in_run_workflow_response branch December 23, 2025 20:41

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
skyvern/forge/sdk/routes/agent_protocol.py (1)

386-390: Consider fetching only the workflow title for better performance.

The current implementation fetches the entire Workflow object (which may include large definitions, parameters, blocks, etc.) just to extract the title field. If Workflow objects are sizable, consider adding a dedicated method to fetch just the title, such as get_workflow_title(workflow_id, organization_id) -> str | None.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a3e5399 and fd919d4.

📒 Files selected for processing (1)
  • skyvern/forge/sdk/routes/agent_protocol.py
🧰 Additional context used
📓 Path-based instructions (3)
**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.py: Use ruff check and ruff format for linting and formatting Python code
Use mypy for type checking Python code
Use type hints in Python code
Maintain line length of 120 characters for Python code

**/*.py: Use Python 3.11+ features and type hints in Python code
Follow PEP 8 with a line length of 100 characters in Python code
Use absolute imports for all modules in Python code
Document all public functions and classes with Google-style docstrings in Python code
Use snake_case for variables and functions, PascalCase for classes in Python code
Prefer async/await over callbacks for asynchronous programming in Python
Use asyncio for concurrency in Python asynchronous code
Always handle exceptions in async code in Python
Use context managers for resource cleanup in Python
Use specific exception classes rather than generic exceptions in error handling
Include meaningful error messages in exceptions
Log errors with appropriate severity levels in Python
Never expose sensitive information in error messages
Optimize database queries in Python for performance
Use appropriate data structures in Python for performance optimization
Implement caching where beneficial in Python code
Validate all inputs in Python code
Use environment variables for configuration instead of hardcoding values

Files:

  • skyvern/forge/sdk/routes/agent_protocol.py
skyvern/forge/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

FastAPI-based REST API and WebSocket support should be located in skyvern/forge/ directory

Files:

  • skyvern/forge/sdk/routes/agent_protocol.py
**/*.{py,ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use async/await patterns for asynchronous operations

Files:

  • skyvern/forge/sdk/routes/agent_protocol.py
🧬 Code graph analysis (1)
skyvern/forge/sdk/routes/agent_protocol.py (2)
skyvern/core/script_generations/workflow_wrappers.py (1)
  • workflow (8-19)
skyvern/forge/sdk/workflow/service.py (1)
  • get_workflow (1558-1562)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Optimize new Python code in this PR
  • GitHub Check: Run tests and pre-commit hooks
🔇 Additional comments (1)
skyvern/forge/sdk/routes/agent_protocol.py (1)

386-393: Critical: Incorrect error handling—get_workflow raises exceptions, never returns None.

Line 392's if workflow: check is incorrect. According to the implementation in skyvern/forge/sdk/workflow/service.py, get_workflow raises WorkflowNotFound when a workflow isn't found—it never returns None. This means:

  1. The conditional at line 392 is effectively dead code (workflow is always truthy if we reach it)
  2. If the workflow is missing or deleted after the run is created (lines 371-382), WorkflowNotFound will be raised and not caught, causing an unhandled exception
  3. The user receives an error response despite the workflow run already being successfully created, leaving an inconsistent state
  4. WorkflowNotFound is not imported in this file, so it cannot be caught as-is

Wrap the get_workflow call in a try-except to gracefully handle workflow fetch failures after a successful run creation. Log the failure and continue with the un-hydrated request rather than failing the entire response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant