Repository navigation
[fix]: report cached browser start failures in browse doctor - #3423
kenneshagarg wants to merge 2 commits into
Conversation
DriverSessionManager keeps the last init failure for retry backoff, but status() did not expose it, so browse doctor reported a daemon whose browser failed to start the same as one that had not started yet. Addresses part of browserbase#3359. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run. |
🦋 Changeset detectedLatest commit: 4c4bcfa The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Thanks @Kennesha, this is a nice addition. Having doctor surface the last failed start is really useful. I have two pieces of feedback. 1. One row per component (for this PR). Right now a failed start shows up as a second Doctor shows one row per component ( And for a remote session: When there's no recorded failure, the output stays the same as today. 2. A Once #1 is in and CI is approved and green, this should be good to go. |
Show the cached start failure in the existing component row for the session's target (browser, browserbase, or cdp) instead of always adding a separate browser row. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks @shrey150! Updated in 4c4bcfa: the failure now replaces the component row for the session's target ( |
shrey150
left a comment
There was a problem hiding this comment.
Thanks for the quick fix! Verified end to end: a failed start now replaces the target's doctor row (browser / browserbase / cdp) instead of adding a duplicate.
… doctor (#3439) Mirrored from external contributor PR #3423 after approval by @shrey150. Original author: @kenneshagarg Original PR: #3423 Approved source head SHA: `4c4bcfa62a31868364139ab8a1e7f1df1c464dfe` @kenneshagarg, please continue any follow-up discussion on this mirrored PR. When the external PR gets new commits, this same internal PR will be marked stale until the latest external commit is approved and refreshed here. ## Original description # why When a session's browser fails to start, every `browse` command errors but `browse doctor` still reports all `[ok]`. `DriverSessionManager` keeps the failure for retry backoff, but `status()` doesn't expose it, so doctor can't tell a failed start from a daemon that hasn't started a browser yet. Root cause identified by @DevChiniwala in #3359. Addresses part of #3359: this fixes the false all-clear from `browse doctor`, not the underlying `ECONNREFUSED`, which I haven't reproduced with a managed local browser. # what changed - `status()` now includes `initError` while a failed start is cached. it's absent otherwise, so existing `status` output doesn't change. - `browse doctor` reports the failure in the existing row for the session's target (`browser`, `browserbase`, or `cdp`), with the first line of the error, and puts the full error in `--json` details. it doesn't launch Chrome or retry the failed start. - no `Fix:` line, since the right fix depends on the cause. I put this in `status()` rather than an explicit launch probe so doctor stays read-only. happy to change that if you'd prefer a probe. # test plan - `driver-foundation.test.ts`: a real `DriverSessionManager` with a rejected launch reports `initError` from `status()` without launching again, and reports none before any attempt. - `doctor.test.ts`: for each target kind, `initError` produces a `fail` verdict and exactly one row for that component, with the first-line message, the full error in details, and the rendered `[fail]` line. a running daemon without a failed start adds no component row. - both new tests fail without the source change. - ran the built CLI: `browse open` against a closed CDP port, then `browse doctor`, which printed `[fail] cdp last start failed: Failed to open CDP WebSocket` and exited 1. - `pnpm check` passes. CLI tests: 557 passed, 1 failed. that failure, `cli-surface.test.ts > prints browse root help`, also fails without this change. `check-changesets` also fails on `main` because of the existing `agent-discoverability-metadata.md`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes `browse doctor` reporting all `[ok]` when a session's browser failed to start, so the failure is no longer hidden. The daemon now exposes the cached start failure through `status().initError`, and `browse doctor` renders a `[fail]` in the session's target row (`browser`, `browserbase`, or `cdp`) with the first line of the error; the full error appears in `--json` details. The check is read-only and doesn't relaunch or retry the failed start. Addresses part of #3359. <sup>Written for commit 4c4bcfa. Summary will update on new commits.</sup> <a href="https://cubic.dev/pr/browserbase/stagehand/pull/3423?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <!-- End of auto-generated description by cubic. --> <!-- external-contributor-pr:owned source-pr=3423 source-sha=4c4bcfa62a31868364139ab8a1e7f1df1c464dfe claimer=shrey150 --> --------- Co-authored-by: kenneshagarg <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
The mirrored PR #3439 has been merged into |
…ch the fix hint to the target's doctor row
why
When a session's browser fails to start, every
browsecommand errors butbrowse doctorstill reports all[ok].DriverSessionManagerkeeps the failure for retry backoff, butstatus()doesn't expose it, so doctor can't tell a failed start from a daemon that hasn't started a browser yet. Root cause identified by @DevChiniwala in #3359.Addresses part of #3359: this fixes the false all-clear from
browse doctor, not the underlyingECONNREFUSED, which I haven't reproduced with a managed local browser.what changed
status()now includesinitErrorwhile a failed start is cached. it's absent otherwise, so existingstatusoutput doesn't change.browse doctorreports the failure in the existing row for the session's target (browser,browserbase, orcdp), with the first line of the error, and puts the full error in--jsondetails. it doesn't launch Chrome or retry the failed start.Fix:line, since the right fix depends on the cause.I put this in
status()rather than an explicit launch probe so doctor stays read-only. happy to change that if you'd prefer a probe.test plan
driver-foundation.test.ts: a realDriverSessionManagerwith a rejected launch reportsinitErrorfromstatus()without launching again, and reports none before any attempt.doctor.test.ts: for each target kind,initErrorproduces afailverdict and exactly one row for that component, with the first-line message, the full error in details, and the rendered[fail]line. a running daemon without a failed start adds no component row.browse openagainst a closed CDP port, thenbrowse doctor, which printed[fail] cdp last start failed: Failed to open CDP WebSocketand exited 1.pnpm checkpasses. CLI tests: 557 passed, 1 failed. that failure,cli-surface.test.ts > prints browse root help, also fails without this change.check-changesetsalso fails onmainbecause of the existingagent-discoverability-metadata.md.🤖 Generated with Claude Code
Summary by cubic
Fixes
browse doctorreporting all[ok]when a session's browser failed to start, so the failure is no longer hidden. The daemon now exposes the cached start failure throughstatus().initError, andbrowse doctorrenders a[fail]in the session's target row (browser,browserbase, orcdp) with the first line of the error; the full error appears in--jsondetails. The check is read-only and doesn't relaunch or retry the failed start. Addresses part of #3359.Written for commit 4c4bcfa. Summary will update on new commits.