Skip to content

fix(replay): fail rasterizer startup on a non-headless-shell browser - #95849

Merged
trunk-io[bot] merged 4 commits into
masterfrom
posthog-self-driving/fixreplay-vision-fail-the-rasterizer-at-c41b05
Sep 9, 2026
Merged

fix(replay): fail rasterizer startup on a non-headless-shell browser#95849
trunk-io[bot] merged 4 commits into
masterfrom
posthog-self-driving/fixreplay-vision-fail-the-rasterizer-at-c41b05

Conversation

@posthog

@posthog posthog Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Problem

A replay vision scan can fail with a reason that names a container path and tells the user to retry, when no retry can succeed.
The rasterizer launches whatever PUPPETEER_EXECUTABLE_PATH points at. puppeteer-capture only rejects a binary that is not chrome-headless-shell when a capture attaches to a page.
A pod with the wrong binary therefore passes the readiness probe and fails every render, one scan at a time, with the library's error as the failure reason.

Changes

The worker now refuses to start when the launched browser is not chrome-headless-shell. The pod exits, and the worker log names the path and the variable to fix.

Nothing changes for a user on a correctly configured fleet. The path can no longer reach a scan result, because a browser that passes this check also passes the library's check at attach time.

The check runs once in BrowserPool.launch(), before the worker reports ready. Per-render relaunches in getPage() do not repeat it; the library already covers those.

Mechanical: the test helper mockBrowser takes a spawnfile.

How did you test this code?

One Jest case in browser-pool.test.ts: launch() rejects with the path, closes the browser, and getPage() does not hand out the refused browser. It catches a dropped or inverted check, and a check that leaves the refused slot in the idle pool.

Automatic notifications

  • Publish to changelog?

Docs update

None.

🤖 Agent context

Autonomy: Fully autonomous

  • Claude Code, from a PostHog inbox report. Skills invoked: /writing-tests, /writing-code-comments, /writing-user-facing-copy, /writing-pr-descriptions, /simplify, writing-simplified-technical-english.
  • No duplicate: gh pr list --state open --search over the rasterizer and browser keywords found nothing.
  • The first draft only stripped the path in the workflow. Reading the puppeteer-capture source showed the check runs per capture, not per launch, which is why the startup check is where the fix belongs and the workflow branch is the backstop.
  • The check throws from launchBrowser, not from main, so a browser relaunched later in the pod's life is covered by the same guard.
  • Public artifact: the work drew on an error tracking issue. No path, identifier, or message from it is committed. The tests use an invented /usr/bin/chromium.

Created with PostHog Desktop from this inbox report.

…nnot capture with

puppeteer-capture only rejects a non-chrome-headless-shell binary once a capture
attaches to a page. A PUPPETEER_EXECUTABLE_PATH pointing at another Chrome
therefore launches, passes the readiness probe, and then fails every render.

Check the launched process in BrowserPool.launchBrowser instead. pool.launch()
runs before the worker reports ready, so a bad path now kills the pod.

Classify the new BROWSER_MISCONFIGURED code as an internal error in replay
vision, with a message that carries no browser path and no retry prompt, and
register it in the exports failure handler.

Generated-By: PostHog Desktop
Task-Id: 0a4e466b-cb46-4bb5-ac77-fd241854739e
@trunk-io

trunk-io Bot commented Sep 7, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@posthog

posthog Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

🦔 PostHog Review reviewed this pull request

Nothing worth raising this time, so here's a calming picture instead:

Someone relaxing in a sunny garden

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

🤖 CI report

Trunk lane — non-backend lane (node:ingestion)

This PR is assigned to the non-backend lane (node:ingestion). It does not run backend Python tests and may merge in parallel with PRs in other lanes.

Comment density — 11% of added code lines are comments (3 of 28)

This section warns when comments are more than 3% of the code lines a PR adds, and alerts above 6%. Before agent-assisted PRs, the typical share was about 2%. Only full-line comments count. Docstrings, generated files, snapshots, migrations, and workflow files are left out.

Comments that restate the code, record how the change came about, or narrate the next line add noise for the next reader. Keep the comments that explain a reason the code cannot show, and remove the rest. See .agents/skills/writing-code-comments/SKILL.md for the house rules.

Files with the most added comment lines:

File Comment lines Added lines
nodejs/src/session-replay/recording-rasterizer/capture/browser-pool.ts 2 13
nodejs/src/session-replay/recording-rasterizer/__tests__/browser-pool.test.ts 1 15

This check does not block merging. It updates on every push and clears when the share drops.

stamphog[bot]
stamphog Bot previously approved these changes Sep 7, 2026

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved.

Contained rasterizer/workflow error-classification fix, not in risky territory (no auth, billing, migrations, public API, dependency, or CI changes); code follows the repo's required workflow-versioning pattern correctly and is covered by new tests, so no showstopper.

Gate mechanics and policy version
Gate Result
prerequisites all clear
deny-list no deny categories matched
size 47L, 4F substantive, 106L/6F incl. docs/generated/snapshots — within ceiling
tier T1-agent / T1c-medium (106L, 6F, two-areas, fix)
stamphog 2.0.0b4 .stamphog/policy.yml @ 2622685 · reviewed head 2622685

@trunk-io

trunk-io Bot commented Sep 7, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@posthog
posthog Bot marked this pull request as ready for review September 7, 2026 00:40
@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested review from a team, TueHaulund, arnohillen, fasyy612 and ksvat and removed request for a team September 7, 2026 00:42
@pr-assigner-resolver-posthog

Copy link
Copy Markdown

👀 Auto-assigned reviewers

These soft owners were skipped because they only have minor changes here. Nothing blocks merge, so self-assign if you'd like a look:

  • @PostHog/team-analytics-platform (products/exports/product.yaml)

Soft owners come from each directory's owners.yaml and each product's product.yaml (resolved nearest-file-wins). The locator after each owner is the file that decided it. Generated files and lockfiles are ignored when deciding ownership.

@stamphog
stamphog Bot dismissed their stale review September 9, 2026 09:48

New commits were pushed — dismissing the stamphog approval from an earlier head. This PR no longer qualifies for automatic review.

Comment thread nodejs/src/session-replay/recording-rasterizer/capture/browser-pool.ts Outdated
@fasyy612 fasyy612 changed the title fix(replay-vision): fail the rasterizer at startup on a browser it cannot capture with fix(replay): fail rasterizer startup on a non-headless-shell browser Sep 9, 2026
@fasyy612

fasyy612 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

/trunk merge

@trunk-io
trunk-io Bot merged commit 0907605 into master Sep 9, 2026
211 checks passed
@trunk-io
trunk-io Bot deleted the posthog-self-driving/fixreplay-vision-fail-the-rasterizer-at-c41b05 branch September 9, 2026 10:51
@deployment-status-posthog

deployment-status-posthog Bot commented Sep 9, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-09-09 11:18 UTC Run
prod-us ✅ Deployed 2026-09-09 11:32 UTC Run
prod-eu ✅ Deployed 2026-09-09 11:36 UTC Run

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.

1 participant