feat(browser_toolset): enhance error handling and connection management#57
Open
feat(browser_toolset): enhance error handling and connection management#57
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Improves BrowserToolSet robustness by preventing tool-level Playwright failures from triggering expensive sandbox recreation, and by reusing a cached Playwright connection to reduce transient CDP/connect overhead.
Changes:
- Add Playwright connection caching in
BrowserToolSetand reset it on sandbox rebuild/close. - Refine
_run_in_sandboxto distinguish infrastructure errors vs tool-level errors for browser operations. - Add unit tests for the new error handling and caching behavior; plus minor formatting-only test/schema tweaks.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
agentrun/integration/builtin/sandbox.py |
Implements Playwright connection caching and browser-specific error classification/retry behavior. |
agentrun/utils/exception.py |
Introduces BrowserToolError exception type for tool-level browser failures. |
tests/unittests/integration/test_browser_toolset_error_handling.py |
Adds unit tests for infrastructure vs tool-level error handling and Playwright caching/reset behavior. |
agentrun/integration/utils/tool.py |
Minor formatting adjustment in OpenAPI schema generation. |
tests/unittests/toolset/api/test_openapi.py |
Formatting-only normalization of $ref strings in test fixtures. |
tests/unittests/integration/test_langchain_agui_integration.py |
Formatting-only normalization of request JSON test payload. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/unittests/integration/test_browser_toolset_error_handling.py
Outdated
Show resolved
Hide resolved
- Introduced BrowserToolError for tool-level errors, ensuring they don't trigger sandbox recreation. - Implemented connection caching for Playwright in BrowserToolSet, optimizing resource usage. - Enhanced _run_in_sandbox method to differentiate between infrastructure and tool-level errors, improving error handling. - Added unit tests for error handling and connection management in BrowserToolSet. This update improves the robustness of the browser toolset by refining error handling and optimizing Playwright connection management. Signed-off-by: Sodawyx <sodawyx@126.com>
9c51ebe to
688b57b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix bug #55
This update improves the robustness of the browser toolset by refining error handling and optimizing Playwright connection management.
Fix bugs
Fix bug #55
Pull request tasks
Update docs
Reason for update
Pull request tasks
Add contributor
Contributed content
Content detail
Others
Reason for update