Add Browserbase account sessions and social comment docs#2
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c0748f8477
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| await this.waitForCapacity(request.accountName); | ||
| this.activeAccounts.add(request.accountName); | ||
| this.activeSessions += 1; |
There was a problem hiding this comment.
Reserve pool capacity atomically in acquire
acquire waits for capacity and only then marks the account/session as active, but that reservation happens after an await. With parallel workers, two acquires can both pass waitForCapacity before either increments activeSessions/activeAccounts, so both create sessions and exceed maxSessions (and per-account exclusivity). This can cause quota spikes and breaks the pool’s core concurrency guarantee.
Useful? React with 👍 / 👎.
| await pool.release(lease.value, { status: 'success' }); | ||
| emitRunEvent({ type: 'succeeded', jobId: job.id, accountName, durationMs: Date.now() - started, result }); | ||
| } catch (error) { | ||
| failures += 1; | ||
| await pool.release(lease.value, { status: 'failed', errorMessage: getErrorMessage(error) }); |
There was a problem hiding this comment.
Treat Browserbase release errors as job failures
pool.release returns a Result, but this path ignores ok/error and always emits a terminal event as if cleanup succeeded. If Browserbase rejects release (API error, quota, stale session), the run still reports success/failure for the job without surfacing the leaked session, which can leave keepalive sessions orphaned and make the summary inaccurate.
Useful? React with 👍 / 👎.
Summary
Validation