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

add get page video timeout #1710

Merged
merged 1 commit into from
Feb 4, 2025
Merged

Conversation

wintonzheng
Copy link
Contributor

@wintonzheng wintonzheng commented Feb 4, 2025

Important

Add timeout for retrieving page video path in set_working_page() in browser_factory.py, logging on timeout and skipping exception.

  • Behavior:
    • Add timeout for page.video.path() in set_working_page() in browser_factory.py.
    • Logs info message on asyncio.TimeoutError and skips exception.
  • Settings:
    • Uses settings.BROWSER_ACTION_TIMEOUT_MS for timeout duration.

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

<!-- ELLIPSIS_HIDDEN -->

> [!IMPORTANT]
> Add timeout for retrieving video paths in `set_working_page()` of `BrowserState` class, logging on timeout.
>
>   - **Behavior**:
>     - Adds timeout for `page.video.path()` in `set_working_page()` in `BrowserState` class.
>     - Logs a message and skips exception on timeout.
>   - **Configuration**:
>     - Uses `settings.BROWSER_ACTION_TIMEOUT_MS` for timeout duration.
>
> <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 affdf31410fa5014257bcd936917613d3d3d5276. 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 c803c8c in 24 seconds

More details
  • Looked at 29 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 drafted comments based on config settings.
1. skyvern/webeye/browser_factory.py:483
  • Draft comment:
    Consider if an info-level log is enough here. Also, handle other possible exceptions from page.video.path() to avoid silent failures.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    None
2. skyvern/webeye/browser_factory.py:494
  • Draft comment:
    Repeating similar try/except block. Consider refactoring to eliminate duplication and review log level; also check if skipping timeout is desired behavior.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    None
3. skyvern/webeye/browser_factory.py:483
  • Draft comment:
    Consider logging additional context (e.g., the video artifact index) when a timeout occurs to facilitate debugging.
  • Reason this comment was not posted:
    Confidence changes required: 33%
    None
4. skyvern/webeye/browser_factory.py:494
  • Draft comment:
    Duplicate timeout-handling logic. Consider refactoring this into a helper function to reduce repetition.
  • Reason this comment was not posted:
    Confidence changes required: 33%
    None
5. skyvern/webeye/browser_factory.py:484
  • Draft comment:
    Note: asyncio.timeout is available in Python 3.11+. Ensure this requirement is acceptable for the project or consider using asyncio.wait_for for earlier versions.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_OFMdHibhQmeMhKkJ


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 c803c8c in 56 seconds

More details
  • Looked at 29 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. skyvern/webeye/browser_factory.py:483
  • Draft comment:
    Ensure asyncio.timeout is supported (Python 3.11+). Consider using asyncio.wait_for for broader compatibility.
  • Reason this comment was not posted:
    Marked as duplicate.
2. skyvern/webeye/browser_factory.py:494
  • Draft comment:
    The try/except block for page.video.path() is duplicated. Consider refactoring into a helper to reduce code duplication.
  • Reason this comment was not posted:
    Marked as duplicate.
3. skyvern/webeye/browser_factory.py:494
  • Draft comment:
    Duplicate timeout wrapper for page.video.path() detected. Refactor this pattern into a reusable helper to simplify maintenance.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_rDfOA5FysSLEJ8TN


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.

@@ -480,14 +480,22 @@ async def set_working_page(self, page: Page | None, index: int = 0) -> None:
return
if len(self.browser_artifacts.video_artifacts) > index:
if self.browser_artifacts.video_artifacts[index].video_path is None:
self.browser_artifacts.video_artifacts[index].video_path = await page.video.path()
try:
async with asyncio.timeout(settings.BROWSER_ACTION_TIMEOUT_MS / 1000):
Copy link
Contributor

Choose a reason for hiding this comment

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

Good use of asyncio.timeout to guard video retrieval. Consider extracting this timeout logic into a helper function to reduce duplication and review if INFO logging is the appropriate level for a timeout event.

@LawyZheng LawyZheng merged commit f0b274d into main Feb 4, 2025
7 checks passed
@LawyZheng LawyZheng deleted the lawy/add-get-path-video-timeout branch February 4, 2025 06:56
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.

2 participants