Conversation
Drop typing casts and unused streaming/cleanup blocks to mirror the node SDK's browser-routing example. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Make it explicit that browsers.request returns a familiar httpx.Response so users can rely on the standard interface. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add the buffered client.browsers.curl call alongside the raw streaming client.browsers.request call, with comments noting when to use each. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Firetiger deploy monitoring skipped This PR didn't match the auto-monitor filter configured on your GitHub connection:
Reason: Changes are limited to example code in examples/browser_routing.py, not to kernel API endpoints (packages/api/cmd/api/) or Temporal workflows (packages/api/lib/temporal). To monitor this PR anyway, reply with |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue. You can view the agent here.
Reviewed by Cursor Bugbot for commit 84cb2e3. Configure here.
| buffered = client.browsers.curl(browser.session_id, url="https://example.com", method="GET") | ||
| print("body", buffered.body) | ||
|
|
||
| client.browsers.delete_by_id(browser.session_id) |
There was a problem hiding this comment.
Browser session leaks if request or curl fails
Low Severity
The previous code wrapped the browser usage in try/finally to ensure delete_by_id was called even on failure. The new code calls client.browsers.request() and client.browsers.curl() without any error handling, so if either raises an exception, delete_by_id is never reached and the remote browser session is leaked on the server. Since this is example code that users will copy, the missing cleanup pattern could lead to orphaned browser sessions in real applications.
Reviewed by Cursor Bugbot for commit 84cb2e3. Configure here.


Summary
Test plan
Note
Low Risk
Low risk: changes are limited to an example script and only adjust how it demonstrates browser request APIs and cleanup behavior.
Overview
Simplifies
examples/browser_routing.pyto be a minimal browser-routing demo: removestypingcasts, intermediate variables, and thewith/try/finallystreaming pattern.The example now shows two request styles—
browsers.request(rawhttpx.Response) andbrowsers.curl(buffered JSON envelope)—and performs explicit session cleanup viadelete_by_id.Reviewed by Cursor Bugbot for commit 84cb2e3. Bugbot is set up for automated code reviews on this repo. Configure here.