Skip to content

Raise Chrome launch timeout for audit browser sessions - #1256

Open
dhruv8sh wants to merge 2 commits into
mainfrom
fix/1255-chrome-launch-timeout
Open

dhruv8sh wants to merge 2 commits into
mainfrom
fix/1255-chrome-launch-timeout

Conversation

@dhruv8sh

@dhruv8sh dhruv8sh commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • collects_gpt_slot_from_local_fixture sometimes fails in the cargo test (axum native) CI job with failed to launch browser: Timeout while resolving websocket URL from browser process. Chrome took longer than chromiumoxide's default 20s launch timeout to start on a loaded runner, which is a slow environment, not a broken test.
  • Set an explicit 60s launch timeout in build_browser_config. Both audit collectors (ts audit page collection and ts audit generate) share this function, so slow operator machines benefit too.
  • Tradeoff: a Chrome that hangs without exiting now takes up to 60s instead of 20s to report a launch failure.

Changes

File Change
crates/trusted-server-cli/src/commands/audit/browser.rs Add documented BROWSER_LAUNCH_TIMEOUT (60s) constant and pass it via launch_timeout in build_browser_config

Closes

Closes #1255

Test plan

  • cargo test-fastly && cargo test-axum
  • cargo clippy-fastly && cargo clippy-axum
  • cargo fmt --all -- --check
  • JS tests: cd crates/trusted-server-js/lib && npx vitest run
  • JS format: cd crates/trusted-server-js/lib && npm run format
  • Docs format: cd docs && npm run format
  • WASM build: cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1
  • Manual testing via fastly compute serve
  • Other: ./scripts/test-cli.sh with local Chromium (runs the ignored browser fixtures, including collects_gpt_slot_from_local_fixture), cargo clippy-cli, cargo test-cloudflare, cargo clippy-cloudflare

Checklist

  • Changes follow AGENTS.md conventions
  • No unwrap() in production code — use expect("should ...")
  • Uses tracing macros (not println!)
  • New code has tests — chromiumoxide keeps launch_timeout pub(crate), so the configured value cannot be asserted from this crate; the existing browser fixtures exercise the launch path
  • No secrets or credentials committed

Chrome startup fell back to chromiumoxide's 20s default, which a cold start on a loaded CI runner can exceed, failing collects_gpt_slot_from_local_fixture with a websocket URL timeout. Set an explicit 60s launch timeout in build_browser_config, shared by both audit collectors.

Closes #1255

Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
@dhruv8sh dhruv8sh self-assigned this Oct 7, 2026
@dhruv8sh
dhruv8sh requested review from ChristianPavilonis, aram356 and prk-Jr and removed request for aram356 October 7, 2026 20:36

@ChristianPavilonis ChristianPavilonis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review summary

Reviewed 5bcc80c8f8056cbbb27f01f92e9ee260a58edf65 against 7a0ecb4cbfa39af3d83f7e1ed2733d7eabdc4cb1. No actionable issues introduced by this PR were found.

Traced the shared browser configuration through both collectors and their page-audit, ad-template verification, generation, and legacy-alias consumers. The change raises debugging-WebSocket discovery timeout from 20 to 60 seconds without changing navigation, certificate validation, or teardown settings.

Safety proof

Runtime probes against the GPT browser fixture confirmed both sides of the startup boundary. Stopping the test-owned Chrome launcher with SIGSTOP and resuming after 22 seconds produced successful collection in 23.39 seconds. Leaving it stopped produced the expected launch-timeout error in 60.01 seconds. The launcher was reaped in both cases. The stalled probe intentionally caused the fixture's expected panic; the controller's timeout and cleanup assertions passed.

Validation

  • cargo fmt --all -- --check: passed.
  • TS_AUDIT_BROWSER_TESTS=1 CHROME=/usr/bin/chromium cargo test --locked --package trusted-server-cli --target x86_64-unknown-linux-gnu commands::audit::browser::tests:: -- --include-ignored --test-threads=1: 8 passed.
  • TS_AUDIT_BROWSER_TESTS=1 CHROME=/usr/bin/chromium cargo test --locked --package trusted-server-cli --target x86_64-unknown-linux-gnu --lib commands::audit::generate::browser_collector::tests:: -- --include-ignored --test-threads=1: 32 passed.
  • cargo clippy --locked --package trusted-server-cli --target x86_64-unknown-linux-gnu --all-targets --all-features -- -D warnings: passed.
  • All reported CI checks passed. Inspected logs confirm the reviewed head/base merge and successful ignored browser fixtures in the Axum job.
  • Existing reviews, inline comments, issue comments, and review threads were empty at review time.

Residual risk: the original loaded-runner flake was not reproduced. Timing probes ran on Linux, not macOS. The checkout remained clean; no files were edited and no review work was delegated.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Raise Chrome launch timeout for CLI browser fixture tests

3 participants