Skip to content

Draw server visuals on Chrome 158 and keep them well under the time limit - #883

Merged
sambitcreate merged 1 commit into
mainfrom
fix/server-visuals-sandboxed-iframe
Nov 22, 2026
Merged

sambitcreate merged 1 commit into
mainfrom
fix/server-visuals-sandboxed-iframe

Conversation

@sambitcreate

Copy link
Copy Markdown
Owner

What was wrong

aiden serve draws HTML visuals (render_artifact) with an installed headless Chrome. The visual's guest page sits in a sandboxed srcdoc iframe, and Chrome's IsolateSandboxedIframes feature puts that frame in a process of its own.

  • Chrome 158 can't draw them at all. As soon as the host page is set with Page.setDocumentContent, the browser crashes (FATAL: site_instance_impl.cc: Check failed: has_site_.). Every HTML visual comes back as "Not shown: … drawing it failed or took too long". This reproduces locally with Google Chrome 158.0.8127.36. A page without the sandboxed iframe draws fine, and so does one with an unsandboxed iframe.
  • CI flake. packages/cli/tests/server-visuals.test.mjs, "an installed browser draws a chart offline into a picture and leaves no profile behind", takes 8–15 s in Desktop tests (renderer-other) on runs that pass (8.3 s on main, 14.3 s on another branch). It failed at 15.2 s twice on Text-only Live Activities and answerable run alerts on iPhone #881, which doesn't touch packages/cli. The deadline is SERVER_VISUAL_TIMEOUT_MS = 15_000.

What changed

  • serverBrowserArguments adds IsolateSandboxedIframes to --disable-features. The guest frame keeps its sandbox attribute, the export CSP, offline emulation and the DevTools rule that fails every request. Only the separate process for that frame goes away. The browser is throwaway (temporary profile, no network, one visual), so that process added no protection worth a crash.
  • The timeout is unchanged and nothing retries, per the flaky-test rule.
  • Docs: packages/cli/README.md (Inline visuals) and docs/pi-gui-artifacts.md (Visuals on aiden serve).

Timing (local, macOS, Chrome 158)

Step Before After
Chrome ready (Target.createTarget) ~370 ms ~380 ms
Page set → height settled crash at ~620 ms ~510 ms
Whole draw, browser closed no picture ~1.05 s
The chart test fails (no picture) passes in 1.1–1.2 s (3 runs)

The CI runner's Chrome is older and doesn't crash, so this PR's own CI run gives the Linux before-and-after number. Compare this test's duration_ms in Desktop tests (renderer-other) with the 8–15 s above.

Tests

  • cd packages/cli && npm test: 367 tests, 364 passed, 3 skipped, 0 failed.
  • The chart test is the behavioral check. It failed before this change on Chrome 158 and passes after it. No test asserts the flag list itself.

With IsolateSandboxedIframes on, Chrome 158 crashes when the host page
is set (Check failed: has_site_), so aiden serve could draw no HTML
visual at all, and on slow CI runners the extra frame process pushed
drawing a chart to the 15 s limit. The frame stays sandboxed, offline
and fully blocked.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes Checked the Chromium launch adjustment, the server visual containment path, its behavioral coverage, and the accompanying documentation.

  • Chrome 158 compatibility — serverBrowserArguments now disables IsolateSandboxedIframes for the throwaway renderer, avoiding the sandboxed srcdoc process crash and reducing render startup cost.
  • Containment preserved — The opaque-origin iframe sandbox, browser sandbox, CSP, offline emulation, closed proxy and resolver, and CDP request blocking remain in place; only renderer-process isolation changes.
  • Documentation aligned — Both server visual guides explain the process-placement exception and its Chrome 158 rationale.
  • Focused verification — The installed-browser render test passed on Chrome 157 in 1.57 seconds, including PNG output and temporary-profile cleanup; the PR also records manual Chrome 158 verification.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏

@sambitcreate
sambitcreate merged commit 9bb17df into main Nov 22, 2026
29 checks passed
@sambitcreate
sambitcreate deleted the fix/server-visuals-sandboxed-iframe branch November 22, 2026 23:49
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