fix(engine): keep Chrome's sandbox on for local renders where the host supports it (#7625)

* fix(engine): keep Chrome's sandbox on for local renders where the host supports it

Chrome launched with --no-sandbox on every host. Keep the sandbox on
macOS, Windows and non-root Linux outside containers; drop it as root,
in Docker/Podman/Kubernetes, on Lambda and Cloud Run, and where Linux
restricts unprivileged user namespaces. --no-zygote now ships only with
--no-sandbox, since Chrome refuses it while sandboxed. A sandboxed Linux
launch that fails at startup retries once without the sandbox and warns.
HYPERFRAMES_CHROME_SANDBOX=1|0 overrides the choice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(cli): cover the Linux sandbox retry in managed browser launches

The off-macOS closed-pipe case now passes --no-sandbox, so it still
pins "no seatbelt relaunch" rather than the new Linux sandbox retry,
which gets its own case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(engine): honor HYPERFRAMES_CHROME_SANDBOX=1 and latch the fallback on clear evidence only

With the override set to 1, a sandboxed launch Chrome refuses now fails
instead of retrying unsandboxed. A bare startup exit (TargetCloseError)
retries that launch without the sandbox but only latches the sandbox off
after a second one, so a single unrelated early kill no longer disables
it for the rest of a long-lived process. Chrome naming the sandbox in its
error still latches at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
James Russo
2026-11-12 23:16:45 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 9c3258ccbf
commit 400a4e2285
7 changed files with 339 additions and 15 deletions
+8
View File
@@ -1894,6 +1894,14 @@ Low-memory detection reads **host** RAM, not cgroup or container limits, so
containerised callers — including `--docker` — should set
`PRODUCER_LOW_MEMORY_MODE` explicitly.
Render Chrome keeps its sandbox on macOS, on Windows, and on Linux for a
non-root user outside a container. It runs without one as root, in Docker,
Podman or Kubernetes, on AWS Lambda and Cloud Run, and where Linux restricts
unprivileged user namespaces (Ubuntu 23.10 and later). If a sandboxed Linux
launch still fails, the render prints a warning and continues without the
sandbox. Set `HYPERFRAMES_CHROME_SANDBOX=0` to always run without it, or `1` to
require it: with `1`, a launch Chrome refuses fails instead of falling back.
#### When a render times out
Three separate budgets can expire, and the error message tells you which. All