Skip to content

Disable CUA-irrelevant Chrome subsystems to reduce snapshot memory#200

Merged
kalyazin merged 1 commit into
mainfrom
kalyazin/chrome-opts
May 27, 2026
Merged

Disable CUA-irrelevant Chrome subsystems to reduce snapshot memory#200
kalyazin merged 1 commit into
mainfrom
kalyazin/chrome-opts

Conversation

@kalyazin
Copy link
Copy Markdown
Contributor

Add startup flags to google-chrome.desktop that disable Chrome feature subsystems that serve no purpose in a computer-use-agent context. Security features (Safe Browsing, Site Isolation, phishing detection, WebAuthn, component updates, Privacy Sandbox) are deliberately left on because a single sandbox session may load multiple origins in tabs where one could be adversarial.

Measured on a Chrome-only bench build (ubuntu:22.04 + Xvfb + google-chrome-stable, no desktop environment; 3 browse cycles of 5 page navigations each). The absolute deltas are expected to carry over to the full desktop template as they are attributable solely to Chrome's own process memory.
snapshot memfile: −87 MB
snapshot rootfs: −42 MB
per-3-cycle memfile overhead: −49 MB
combined first-snapshot saving: ~129 MB

Flags added and rationale:

--disable-extensions
The extension system initialises a renderer and on-disk profile
directory even when no extensions are installed. CUA agents do not
use extensions.

--disable-default-apps
Skips the bundled "default app" install step (e.g. Chrome Web Store
shortcut, Docs, Sheets) that runs on first launch and writes to the
profile.

--disable-sync
Prevents the Chrome Sync service from starting. There is no Google
account in a sandbox; the service polls and writes to disk for
nothing.

--disable-spell-check
The Hunspell spell-checker loads dictionary files on startup.
Agents interact with pages programmatically and have no use for
in-browser spell checking.

--disable-breakpad
Disables the Breakpad crash reporter. The crash handler process and
its shared memory regions are unnecessary in a managed environment
where crashes are captured at the orchestrator level.

--metrics-recording-only --no-pings
Keeps Chrome's internal metrics counters working (so nothing crashes
expecting them) but disables all outbound UMA/UKM uploads and ping
traffic to Google servers.

--mute-audio
Prevents Chrome from opening an audio sink. There is no audio device
in the sandbox; without this flag Chrome still initialises the audio
subsystem and may log errors or spin waiting for a device.

--disable-features=Autofill,AutofillEnableUpi,PasswordManager,
FederatedCredentialsManagement
Autofill and the password manager scan every form field on every
page load, maintain an in-memory model, and write to the profile
database. Agents fill forms programmatically via xdotool/CDP.

--disable-features=InterestFeedContentSuggestions,PromotionalTabsEnabled
Prevents Chrome from fetching and storing content-suggestion feeds
and from opening promotional NTP tiles, both of which trigger
background network requests on startup.

--disable-features=Translate,TranslateUI,ReadAnything,DistilledPageContent
The translation and reading-mode subsystems watch every page load for
language signals and spin up background tasks. Agents read page
content via CDP or screenshot, not via Chrome's reader view.

--disable-features=PictureInPicture,Notifications
Picture-in-picture and the Notifications permission UI are human-
facing overlays that serve no purpose in a headless-style CUA session.

--disable-features=WebUSB,WebHID,WebMIDI,WebBluetooth,WebSerial,WebXR
Hardware-access APIs. There is no USB, HID, MIDI, Bluetooth, serial,
or XR device in the sandbox. Disabling them prevents Chrome from
enumerating device buses and registering device-arrival watchers.

--disable-features=MediaRouter,GlobalMediaControls,MediaSession
The Media Router (Chromecast/DIAL discovery), global media controls
overlay, and Media Session API all initialise background threads and
mDNS/SSDP listeners that are irrelevant without A/V playback or
casting targets.

--disable-features=PaymentRequest,Payments
The Payment Request API handler initialises the payments service and
loads payment-handler service workers on pages that include
payment-method metadata. No CUA workflow involves a payment flow.

--disable-features=WebRTC,WebRtcHWEncoding
WebRTC brings up the ICE agent, STUN/TURN resolution, and hardware
codec enumeration at browser start even when no page has called
getUserMedia or RTCPeerConnection. Absent microphone/camera devices
this is pure overhead.

--disable-features=BackgroundSync
A Service Worker API that queues "sync" events to be fired when
network connectivity is restored. Intended for offline-first apps
(e.g. sending a queued email after reconnecting). The sandbox is
always online and ephemeral; the sync queue machinery initialises
regardless.

--disable-features=BackgroundFetch
Extends BackgroundSync for large transfers that continue after all
tabs are closed. No CUA session needs multi-hour background downloads
that outlive the tab.

--disable-features=Push
The Web Push API. On subscribe, Chrome opens a persistent connection
to Google's FCM push service and can receive server-pushed messages
to wake a Service Worker even when the site is not open. The sandbox
has no push subscriptions and this is pure outbound noise.

--disable-features=Prerender2
Chrome's speculative pre-rendering: when confident the user will
navigate to a link, Chrome renders the destination in a hidden
background renderer process so the transition appears instant. A CUA
agent navigates programmatically and gains nothing from speculation;
the hidden renderer consumes a full process worth of memory for a
page the agent is about to load anyway.

@cursor
Copy link
Copy Markdown

cursor Bot commented May 26, 2026

PR Summary

Low Risk
Template-only launcher flag changes; security features are explicitly left enabled per PR description, with possible site-compat impact from disabled APIs.

Overview
Extends the Google Chrome desktop launcher Exec line with many startup flags aimed at computer-use-agent sandboxes: extensions, sync, spell-check, breakpad, outbound metrics pings (while keeping internal metrics), muted audio, and a long --disable-features= list (autofill/passwords, feeds, translate/reader, PiP/notifications, hardware APIs, media router/session, payments, WebRTC, background sync/fetch/push, prerender).

Also trims trailing whitespace on StartupWMClass=Google-chrome (no behavior change).

Intent: cut Chrome background work and memory on snapshots (~129 MB combined in bench per PR description) without turning off security-related subsystems called out in the PR body.

Reviewed by Cursor Bugbot for commit 37dd6e9. Bugbot is set up for automated code reviews on this repo. Configure here.

Add startup flags to google-chrome.desktop that disable Chrome feature
subsystems that serve no purpose in a computer-use-agent context.
Security features (Safe Browsing, Site Isolation, phishing detection,
WebAuthn, component updates, Privacy Sandbox) are deliberately left on
because a single sandbox session may load multiple origins in tabs where
one could be adversarial.

Measured on a Chrome-only bench build (ubuntu:22.04 + Xvfb +
google-chrome-stable, no desktop environment). A cycle is one
pause-resume iteration: the VM is paused to produce a snapshot,
resumed, then Chrome opens 5 URLs in new tabs via the DevTools
Protocol before the next pause. Figures are reductions from disabling
the flags below:

  Initial snapshot (Chrome started, first page loaded, VM paused):
    memfile (memory pages Chrome dirtied during startup): −87 MB
    rootfs  (disk writes Chrome made during startup):     −42 MB

  Cumulative memfile across 3 subsequent pause-resume cycles
  (pages re-dirtied by 5 navigations per cycle):           −49 MB

  Combined saving on first snapshot:                       ~129 MB

The absolute deltas are expected to carry over to the full desktop
template as they are attributable solely to Chrome's own process
memory.

Flags added and rationale:

--disable-extensions
  The extension system initialises a renderer and on-disk profile
  directory even when no extensions are installed. CUA agents do not
  use extensions.

--disable-default-apps
  Skips the bundled "default app" install step (e.g. Chrome Web Store
  shortcut, Docs, Sheets) that runs on first launch and writes to the
  profile.

--disable-sync
  Prevents the Chrome Sync service from starting. There is no Google
  account in a sandbox; the service polls and writes to disk for
  nothing.

--disable-spell-check
  The Hunspell spell-checker loads dictionary files on startup.
  Agents interact with pages programmatically and have no use for
  in-browser spell checking.

--disable-breakpad
  Disables the Breakpad crash reporter. The crash handler process and
  its shared memory regions are unnecessary in a managed environment
  where crashes are captured at the orchestrator level.

--metrics-recording-only --no-pings
  Keeps Chrome's internal metrics counters working (so nothing crashes
  expecting them) but disables all outbound UMA/UKM uploads and ping
  traffic to Google servers.

--mute-audio
  Prevents Chrome from opening an audio sink. There is no audio device
  in the sandbox; without this flag Chrome still initialises the audio
  subsystem and may log errors or spin waiting for a device.

--disable-features=Autofill,AutofillEnableUpi,PasswordManager,
  FederatedCredentialsManagement
  Autofill and the password manager scan every form field on every
  page load, maintain an in-memory model, and write to the profile
  database. Agents fill forms programmatically via xdotool/CDP.

--disable-features=InterestFeedContentSuggestions,PromotionalTabsEnabled
  Prevents Chrome from fetching and storing content-suggestion feeds
  and from opening promotional NTP tiles, both of which trigger
  background network requests on startup.

--disable-features=Translate,TranslateUI,ReadAnything,DistilledPageContent
  The translation and reading-mode subsystems watch every page load for
  language signals and spin up background tasks. Agents read page
  content via CDP or screenshot, not via Chrome's reader view.

--disable-features=PictureInPicture,Notifications
  Picture-in-picture and the Notifications permission UI are human-
  facing overlays that serve no purpose in a headless-style CUA session.

--disable-features=WebUSB,WebHID,WebMIDI,WebBluetooth,WebSerial,WebXR
  Hardware-access APIs. There is no USB, HID, MIDI, Bluetooth, serial,
  or XR device in the sandbox. Disabling them prevents Chrome from
  enumerating device buses and registering device-arrival watchers.

--disable-features=MediaRouter,GlobalMediaControls,MediaSession
  The Media Router (Chromecast/DIAL discovery), global media controls
  overlay, and Media Session API all initialise background threads and
  mDNS/SSDP listeners that are irrelevant without A/V playback or
  casting targets.

--disable-features=PaymentRequest,Payments
  The Payment Request API handler initialises the payments service and
  loads payment-handler service workers on pages that include
  payment-method metadata. No CUA workflow involves a payment flow.

--disable-features=WebRTC,WebRtcHWEncoding
  WebRTC brings up the ICE agent, STUN/TURN resolution, and hardware
  codec enumeration at browser start even when no page has called
  getUserMedia or RTCPeerConnection. Absent microphone/camera devices
  this is pure overhead.

--disable-features=BackgroundSync
  A Service Worker API that queues "sync" events to be fired when
  network connectivity is restored. Intended for offline-first apps
  (e.g. sending a queued email after reconnecting). The sandbox is
  always online and ephemeral; the sync queue machinery initialises
  regardless.

--disable-features=BackgroundFetch
  Extends BackgroundSync for large transfers that continue after all
  tabs are closed. No CUA session needs multi-hour background downloads
  that outlive the tab.

--disable-features=Push
  The Web Push API. On subscribe, Chrome opens a persistent connection
  to Google's FCM push service and can receive server-pushed messages
  to wake a Service Worker even when the site is not open. The sandbox
  has no push subscriptions and this is pure outbound noise.

--disable-features=Prerender2
  Chrome's speculative pre-rendering: when confident the user will
  navigate to a link, Chrome renders the destination in a hidden
  background renderer process so the transition appears instant. A CUA
  agent navigates programmatically and gains nothing from speculation;
  the hidden renderer consumes a full process worth of memory for a
  page the agent is about to load anyway.

Signed-off-by: Nikita Kalyazin <nikita.kalyazin@e2b.dev>
@kalyazin kalyazin force-pushed the kalyazin/chrome-opts branch from e53e146 to 37dd6e9 Compare May 26, 2026 16:07
@kalyazin kalyazin merged commit cc0bb06 into main May 27, 2026
11 checks passed
@kalyazin kalyazin deleted the kalyazin/chrome-opts branch May 27, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants