fix(browserbase): retry session api failures#3211
Open
tofikwest wants to merge 1 commit into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
1 issue found across 2 files
Confidence score: 3/5
- In
apps/api/src/browserbase/browserbase-session.service.ts, non-retryable Browserbase errors are being remapped to 503, which can misclassify client/upstream failures as transient server outages and change API behavior for callers relying on status codes; restrict the 503 remap to exhausted retryable paths and preserve original error types for non-retryable failures before merging.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/api/src/browserbase/browserbase-session.service.ts">
<violation number="1" location="apps/api/src/browserbase/browserbase-session.service.ts:133">
P2: Non-retryable Browserbase errors are incorrectly remapped to 503. This masks real client/upstream error types and changes behavior beyond exhausted retryable failures.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
Comment on lines
+133
to
+139
| if (!retryable || attempt === BROWSERBASE_API_MAX_ATTEMPTS) { | ||
| this.logger.error(`Browserbase ${operationName} failed`, { | ||
| attempt, | ||
| error: getBrowserbaseErrorText(error), | ||
| }); | ||
| throw browserbaseUnavailableException(); | ||
| } |
Contributor
There was a problem hiding this comment.
P2: Non-retryable Browserbase errors are incorrectly remapped to 503. This masks real client/upstream error types and changes behavior beyond exhausted retryable failures.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/api/src/browserbase/browserbase-session.service.ts, line 133:
<comment>Non-retryable Browserbase errors are incorrectly remapped to 503. This masks real client/upstream error types and changes behavior beyond exhausted retryable failures.</comment>
<file context>
@@ -35,82 +35,120 @@ export class BrowserbaseSessionService {
+ return await operation();
+ } catch (error) {
+ const retryable = isRetryableBrowserbaseUpstreamError(error);
+ if (!retryable || attempt === BROWSERBASE_API_MAX_ATTEMPTS) {
+ this.logger.error(`Browserbase ${operationName} failed`, {
+ attempt,
</file context>
Suggested change
| if (!retryable || attempt === BROWSERBASE_API_MAX_ATTEMPTS) { | |
| this.logger.error(`Browserbase ${operationName} failed`, { | |
| attempt, | |
| error: getBrowserbaseErrorText(error), | |
| }); | |
| throw browserbaseUnavailableException(); | |
| } | |
| if (!retryable) { | |
| this.logger.error(`Browserbase ${operationName} failed`, { | |
| attempt, | |
| error: getBrowserbaseErrorText(error), | |
| }); | |
| throw error; | |
| } | |
| if (attempt === BROWSERBASE_API_MAX_ATTEMPTS) { | |
| this.logger.error(`Browserbase ${operationName} failed`, { | |
| attempt, | |
| error: getBrowserbaseErrorText(error), | |
| }); | |
| throw browserbaseUnavailableException(); | |
| } |
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.
Summary
Tests
Summary by cubic
Add unified retry logic for Browserbase session APIs (create, debug, retrieve, update) to handle transient failures. Fixes premature close errors, returns 503 when retries are exhausted, and cleans up sessions if live-view lookup fails.
Written for commit b3ac466. Summary will update on new commits.