Repository navigation
hydrate workflow run response with workflow title - #4363
Conversation
<!-- 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 -->
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed fd919d4 in 48 seconds. Click for details.
- Reviewed
29lines of code in1files - Skipped
0files when reviewing. - Skipped posting
3draft 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%<= threshold50%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%<= threshold50%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%<= threshold50%None
Workflow ID: wflow_6fKsO1yfVtPU7mQe
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to fd919d4 in 51 seconds. Click for details.
- Reviewed
29lines of code in1files - Skipped
0files when reviewing. - Skipped posting
2draft 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%<= threshold50%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%<= threshold50%None
Workflow ID: wflow_IbpMWeu7ysIHCjeF
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
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
Workflowobject (which may include large definitions, parameters, blocks, etc.) just to extract thetitlefield. IfWorkflowobjects are sizable, consider adding a dedicated method to fetch just the title, such asget_workflow_title(workflow_id, organization_id) -> str | None.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 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: Useruff checkandruff formatfor linting and formatting Python code
Usemypyfor 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
Usesnake_casefor variables and functions,PascalCasefor classes in Python code
Prefer async/await over callbacks for asynchronous programming in Python
Useasynciofor 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_workflowraises exceptions, never returnsNone.Line 392's
if workflow:check is incorrect. According to the implementation inskyvern/forge/sdk/workflow/service.py,get_workflowraisesWorkflowNotFoundwhen a workflow isn't found—it never returnsNone. This means:
- The conditional at line 392 is effectively dead code (workflow is always truthy if we reach it)
- If the workflow is missing or deleted after the run is created (lines 371-382),
WorkflowNotFoundwill be raised and not caught, causing an unhandled exception- The user receives an error response despite the workflow run already being successfully created, leaving an inconsistent state
WorkflowNotFoundis not imported in this file, so it cannot be caught as-isWrap the
get_workflowcall 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.

Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.
Important
Enhance
run_workflow()inagent_protocol.pyto include workflow title in the response for better identification.run_workflow()inagent_protocol.py, the workflow run response now includes the workflow title.app.WORKFLOW_SERVICE.get_workflow()withworkflow_run.workflow_id.workflow_run_requestwith the workflow title if available.This description was created by
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
run_workflow()function inagent_protocol.pyto fetch and include workflow title in the responseworkflow_idand update the request object with the titleTechnical 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 titleImpact
Created with Palmier