Skip to content

Build1 publisher3 min readPublished Updated

Chrome drops the extension the moment the native host logs to stdout

A dev.to writeup wires CPU and RAM telemetry from a Manifest V3 extension down to a standalone Windows binary. The first of its seven written rules: nothing may print to stdout, where Chrome expects a 4-byte length prefix.

The Engineer · Build desk

Illustration accompanying Chrome drops the extension the moment the native host logs to stdout

What happened

  • A dev.to writeup describes a CPU, RAM and uptime monitor built as three subsystems: a Manifest V3 extension, a self-contained Node.js .exe host and an Inno Setup 6 installer, with zero external dependencies.
  • A constitution file sets seven non-negotiable principles, among them a hexagonal split that keeps the pure domain away from node:os, process.stdin and chrome.runtime.
  • The article lists a single console.log in the native host among the field's mines: it corrupts the binary socket and the browser disconnects the extension instantly, with no clue as to why.
  • The installer, not the user, writes the native messaging registration under HKCU\Software\Google\Chrome\NativeMessagingHosts.

Compiled by The EngineerSomething wrong?How this is made

Why it matters

  • constraint Print debugging is unavailable inside the host. A log destination other than stdout has to exist before the first line of protocol code is written.
  • cost The no-prerequisite promise is paid for in build machinery: a packed x64 executable plus a PE metadata injector that must leave the pkg overlay intact.
  • capability A machine with neither Node.js nor Python installed can still hand host telemetry to an extension, and the user runs one Setup executable to get there.
  • decision Adopting this method means accepting that no file is written before its contract exists, and three subsystems means three spec folders somebody has to keep current.

Native messaging frames every message with its own length. The project's first principle requires a little-endian UInt32LE prefix on everything crossing stdin and stdout, and bans plain text or log output on stdout outright [3]. A reader on the other end takes the first four bytes as a byte count, then consumes exactly that many bytes of payload [5]. Anything console.log writes lands in the same stream, so the next four bytes Chrome reads are whatever the log line happened to start with. The disconnect the article describes follows from that, and it arrives without a diagnostic [4].

Two of the remaining constraints are about the machine you ship to. The writeup says requiring the end user to have Node.js or Python preinstalled ruins adoption [7], so principle two makes the host compile to a standalone x64 executable [6]. The cost shows up in the file listing as host/scripts/set-metadata.js, a PE injector whose stated job is to preserve the overlay that pkg appends [8].

Registration is the third constraint. Asking a non-technical user to open regedit.exe is not viable, according to the article [11], and the Inno Setup 6 script runs in user mode against a JSON template for the host manifest [10]. HKCU is the per-user hive. An installer with no administrator rights can write there [12].

The claim about models is the thinnest part of the writeup. It says that asking an LLM to build this system without a strict methodology almost always ends in hallucinations and code that is incompatible between subsystems [13]. The article does not name a model or show a run done without the specs. The repository does show what generated code has to be checked against: a spec folder per phase, 001-native-protocol-host, 002-chrome-extension-ui and 003-windows-installer-pkg [14], with requirements written in EARS syntax [15]. The constitution states the rule this way: "Ningún archivo de código fuente se crea ni se modifica si el cambio no está previamente especificado en un contrato formal." [16] In English: no source file is created or modified unless the change was specified in a formal contract first.

Enforcing a stdout ban is easier when the domain code never touches stdout, and principle seven isolates the pure domain from node:os, process.stdin and chrome.runtime [17]. On the browser side, principle four allows async service workers only, with no background pages [18], and principle five requires disconnects and timeouts to degrade the popup visually without blocking the browser [19]. The article reports 100% automated tests [2]; the host tree holds unit, integration and benchmark suites, and the extension tests run under JSDOM [21]. Those figures describe one Windows repository. The framing rule they protect applies to any native messaging host, in whatever language it is written [5].

What to watch

  • Whether the repository publishes results from the host benchmark suite, which so far appears only as a folder in the listing.
  • Whether a machine-wide variant appears, since the registration described is user-scope under HKCU only.
  • Whether the author posts a run of the same task, same model, with the spec folders removed.
Loading claim ledger
Loading source directory links
Loading share composer
Loading topic controls
Loading related stories