Repository navigation
[fix]: add Windows support fixes and cross-platform CI for browse - #3408
Conversation
🦋 Changeset detectedLatest commit: e1b14c3 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 |
There was a problem hiding this comment.
All reported issues were addressed across 15 files
Architecture diagram
sequenceDiagram
participant GH as GitHub Actions
participant WF as Workflow (ci/baseline)
participant NPM as pnpm/turbo
participant CLI as Browse CLI
participant DAEMON as Browse Daemon
participant CHROME as Headless Chrome
participant FS as Filesystem
participant VITEST as Vitest Runner
Note over GH,WF: CI dispatch (Linux + NEW Windows baseline)
GH->>WF: Trigger workflow (PR paths / dispatch)
WF->>WF: Checkout & setup-node-pnpm
WF->>NPM: turbo build --filter=browse
NPM-->>WF: Build artifacts
alt Linux smoke job (ci.yml)
WF->>NPM: pnpm --filter browse test:smoke
NPM->>VITEST: Run vitest.smoke.config.ts
VITEST->>CLI: Spawn CLI process (runCli)
else Windows baseline (browse-windows-baseline.yml)
WF->>NPM: pnpm --filter browse test:cli
NPM->>VITEST: Run CLI contract tests
VITEST->>CLI: Spawn CLI with Node-based stubs
end
rect rgb(240, 248, 255)
Note over CLI,CHROME: Smoke Test Flow (NEW)
VITEST->>FS: Create temp dir + fixture server
VITEST->>CLI: browse open <url> --local --headless
CLI->>DAEMON: Start daemon (managed-local mode)
DAEMON->>CHROME: Launch headless Chrome
CHROME-->>DAEMON: Page loaded (title/URL)
DAEMON-->>CLI: OpenResult JSON
CLI-->>VITEST: stdout JSON
VITEST->>CLI: browse snapshot
CLI->>DAEMON: Get accessibility tree
DAEMON-->>CLI: Snapshot refs
CLI-->>VITEST: Tree JSON
VITEST->>CLI: browse fill #name "Browse user"
CLI->>DAEMON: Fill input
DAEMON->>CHROME: Set value
DAEMON-->>CLI: filled: true
VITEST->>CLI: browse click @ref (snapshot ref)
CLI->>DAEMON: Click element
DAEMON->>CHROME: Dispatch click
CHROME-->>DAEMON: DOM updated
DAEMON-->>CLI: clicked: true
VITEST->>CLI: browse get text #result
CLI->>DAEMON: Query DOM
DAEMON-->>CLI: "Hello, Browse user"
VITEST->>CLI: browse stop
CLI->>DAEMON: Stop daemon + browser
alt Restart same session
VITEST->>CLI: browse open (same session id)
CLI->>DAEMON: New daemon PIDs
DAEMON->>CHROME: Relaunch
VITEST->>CLI: browse get value #name -> empty
end
end
rect rgb(255, 248, 240)
Note over VITEST,FS: Test Fixture Portability (NEW writeNodeExecutable)
VITEST->>FS: Write .cjs + launcher (.cmd on win32 / shell on POSIX)
VITEST->>CLI: Spawn CLI with PATH=stubDir
CLI->>FS: External command (npx/npm/pnpm stub)
FS-->>CLI: Command output/exit code
alt Windows npm pack test
VITEST->>NPM: cmd.exe /c npm pack --dry-run
NPM-->>VITEST: Pack manifest JSON
end
end
WF->>WF: Summarize outcomes + upload artifacts
WF-->>GH: Job summary (new step output)
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
browse
There was a problem hiding this comment.
All reported issues were addressed across 26 files
Architecture diagram
sequenceDiagram
participant CI as CI Workflow
participant Setup as setup-chrome-verified Action
participant Chrome as Chrome Browser
participant CLI as Browse CLI
participant PM as Package Manager (npm/pnpm/npx)
participant Child as Child Process Tree
participant Test as Contract/Smoke Tests
Note over CI,Chrome: Cross-Platform CI Pipeline (NEW: Windows coverage for browse)
CI->>CI: Filter paths for browse changes
CI->>CI: Matrix: Ubuntu Linux / Windows 2025
CI->>Setup: Setup Chrome verified action
Setup->>Setup: Install Chrome (Linux only - install-deps)
Setup->>Chrome: Verify headless launch via Node execFileSync
Chrome-->>Setup: Chrome path exported
Setup-->>CI: CHROME_PATH env
CI->>CLI: Build browse package
CI->>CLI: Run test:cli (contract suite)
CI->>CLI: Run test:smoke (real Chrome browser)
CI->>CLI: Run test:smoke:package (installed package)
Note over CLI,PM: Service Command Launching (CHANGED: cross-spawn for Windows shims)
CLI->>PM: Spawn command (npm/pnpm/npx/git)
PM-->>CLI: Output/exit code
alt Windows platform (.cmd/.bat shims)
PM->>Child: Launch via cmd.exe shim
Note over PM,Child: cross-spawn handles path quoting and non-PATH executables
else POSIX platform
PM->>Child: Direct exec
end
Note over CLI,Child: Process Termination (NEW: terminateChild helper)
CLI->>CLI: Detect timeout or shutdown signal
CLI->>Child: terminateChild(SIGTERM/SIGKILL)
alt Windows platform
Child->>Child: taskkill /PID <pid> /T /F
Note over CLI,Child: Kills entire process tree (shims + Node children)
else POSIX platform
CLI->>Child: child.kill(signal)
end
Child-->>CLI: Exit event / killed
Note over CLI,Test: Installed Package Smoke Test (NEW: run-cli with executable)
Test->>Test: Create temp dir, pack tarball, npm install standalone
Test->>CLI: Invoke installed browse executable (cross-spawn)
CLI->>CLI: Spawn daemon process (detached, windowsHide)
CLI->>Chrome: Launch/connect browser
Chrome-->>CLI: Browser session established
Test->>CLI: Run CLI commands (status, open, fill, click, get, snapshot, stop)
CLI-->>Test: JSON output validated
Test->>Test: Verify daemon shutdown and session cleanup
CLI->>Child: Stop/terminate daemon process tree
Note over CLI,Test: Contract Tests (CHANGED: platform-neutral fixtures)
Test->>Test: Write executable stub via writeNodeExecutable
Test->>CLI: Run CLI with restricted PATH (prependPath)
CLI->>PM: Spawn stub (npx/pnpm/npm)
PM-->>CLI: Capture output/logs
Test-->>CLI: Assert behavior
Note over CLI,Child: Error Path: Timeout (NEW: process tree cleanup)
CLI->>Child: timeoutMs exceeded
CLI->>Child: terminateChild(child, "SIGTERM")
alt SIGTERM does not kill
CLI->>Child: terminateChild(child, "SIGKILL") after 5s delay
Note over CLI,Child: Also kills grandchildren launched via shims
end
Child-->>CLI: Exit, telemetry records timeout reason
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Confidence score: 4/5
- In
.github/workflows/ci.yml, one failedbrowse-buildmatrix leg can skip all contract and smoke jobs, even for platforms with a valid artifact. Keep the dependency platform-local or let consumers run for successful platforms.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".github/workflows/ci.yml">
<violation number="1" location=".github/workflows/ci.yml:367">
P2: A failure in either `browse-build` matrix leg skips every contract and smoke job, including jobs whose matching OS artifact is available. Keep the dependency platform-local or allow successful-platform consumers to run despite the other build leg failing, so one OS failure does not hide independent test results.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| name: Browse contracts (${{ matrix.platform }}) | ||
| runs-on: ${{ matrix.os }} | ||
| timeout-minutes: 20 | ||
| needs: [determine-changes, browse-build] |
There was a problem hiding this comment.
P2: A failure in either browse-build matrix leg skips every contract and smoke job, including jobs whose matching OS artifact is available. Keep the dependency platform-local or allow successful-platform consumers to run despite the other build leg failing, so one OS failure does not hide independent test results.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/workflows/ci.yml, line 367:
<comment>A failure in either `browse-build` matrix leg skips every contract and smoke job, including jobs whose matching OS artifact is available. Keep the dependency platform-local or allow successful-platform consumers to run despite the other build leg failing, so one OS failure does not hide independent test results.</comment>
<file context>
@@ -323,16 +323,78 @@ jobs:
+ name: Browse contracts (${{ matrix.platform }})
+ runs-on: ${{ matrix.os }}
+ timeout-minutes: 20
+ needs: [determine-changes, browse-build]
+ if: needs.determine-changes.outputs.browse == 'true'
+ strategy:
</file context>
e69f551 to
e1b14c3
Compare
Release Browse independently of the Stagehand SDKs. Merging this PR publishes the CLI from the merged commit. ## 0.11.4 ### Patch Changes - [#3426](#3426) [`f93e6d1`](f93e6d1) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - Report an error when an active browser session disconnects during command startup instead of automatically starting a replacement. - [#3379](#3379) [`73fdba0`](73fdba0) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - remove unused deepmerge dependency - [#3330](#3330) [`dc8eb40`](dc8eb40) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - bump zod to 4.6.6 - [#3289](#3289) [`aa67fee`](aa67fee) Thanks [@shrey150](https://github.com/shrey150)! - Add `--stagehand` flag to `browse cloud extensions upload`. - [#3439](#3439) [`2fe947c`](2fe947c) Thanks [@github-actions](https://github.com/apps/github-actions)! - Make `browse doctor` fail and show the cause when the session's last browser start failed - [#3400](#3400) [`ce298c6`](ce298c6) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - Add token validation to internal local Functions runtime requests - [#3408](#3408) [`6a56cbb`](6a56cbb) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - Fix Windows package-manager command launching for Functions and templates, and terminate child processes when skill installation times out. - [#3391](#3391) [`3fbda6b`](3fbda6b) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - Validate daemon directory locations before connecting to a session. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
why
what changed