Browse documentation

The playground runs in the browser by default for versions with WebAssembly modules

Date: 2026-12-03 Area: website Refines: ADR 0236, whose browser runs were opt-in

Context

ADR 0236 made running a version's WebAssembly modules in the browser the visitor's choice, off by default, until the modules had Intl data and the page answered fetch through the embedder transport. Both have landed: the page offers the modules a fetch device (ADR 0237), and the modules link ICU and read its data on their first use of it (ADR 0245, ADR 0246). What still differs from a server run is listed in WebAssembly — In a browser: the browser follows redirects and resolves names itself, CORS applies, ICU's data file holds 22 locales, and a stack overflow reports a trap.

A browser run can also fail where a server run would not: the browser may lack WebAssembly or module workers, the module may not download or compile in time, or a redeploy may have removed the module the page was built with.

Decision

  • A version whose modules are staged runs in the browser by default. The Run in browser checkbox starts ticked for it; a version without modules runs on the server as before, with no checkbox. Which versions have modules is decided at build time by website/scripts/fetch-binaries.ts, as ADR 0236 describes.
  • The visitor's choice is kept. Ticking or unticking the checkbox stores browser or server in this browser (localStorage, src/lib/playground-engine.ts), and a stored choice wins over the default for every version with modules. A visitor who never touched the checkbox follows the default, so a later change of default reaches them.
  • A browser that cannot run the modules runs on the server. Without WebAssembly or Worker, the page shows no checkbox, as for a version without modules.
  • A default run whose module does not start runs on the server instead. When the module fails to load (a worker that cannot be created, a download or compile failure, the load deadline, a module gone after a redeploy), the page sends the same request to the server, says so above the output, and runs that version on the server for the rest of the page's life. A run that fails after its module started is not repeated, since it may already have done part of its work, such as a fetch; nor is a run the visitor sent to the browser by ticking the checkbox: they see the error and how to untick it, and their code goes to the server only when they say so.
  • The landing page's quick run and the WebMCP tools stay on the server. The quick run executes one short example of the default version, which is a stable release, and loading a module of several MB for it would cost the visitor more than the run. The WebMCP tools are the public API (/api/execute, /api/test) offered to an agent in the page, and answer what the API answers; a tool call that downloads and compiles a module first would differ from the API in time and in what it can reach.
  • Telemetry says which way a run went. Each browser_execute_completed and browser_test_completed event carries choice (default or explicit), and a loadFailed run that went to the server carries fallback: "server".

Consequences

  • Until a release publishes the wasm32-wasip1 archive, only nightly has modules, so the default version still runs on the server; the release that first carries the archive moves its playground runs to the browser with no further change.
  • A visitor's first default run of a version downloads its module, a few MB compressed; the checkbox gives the size.
  • A visitor who unticked the checkbox once keeps running on the server for every version until they tick it again.
  • The browser-run telemetry with choice and fallback is what shows whether the default holds up: a rising share of loadFailed with fallback: "server" means the modules fail to start for visitors the default sent to them.