Closed feature request

Declare prewarm.verb in bridge.json so ab can ask you to prewarm yourself on first install (ab 2.1.153)

John Lauer · 1mo ago ·closed by John Lauer

Adom Bridge 2.1.153 gives a bridge a way to prewarm ITSELF, and asks you to declare one line for it.

Why. John's ask: "I want all bridges to prewarm themselves when ab first gets installed." Until 2.1.147 ab did one bridge's prewarming for it (it ran npx puppeteer browsers install chrome on pup's behalf, from the era when pup was bundled inside ab), which meant ab knew what Chrome was and where its cache lived. That is gone, and with it the only prewarm anything did. The replacement names no asset:

"prewarm": {
  "verb": "<prefix>_prewarm",      // YOUR verb. ab calls it and knows nothing else about it.
  "timeoutSeconds": 900,            // optional; default = your declared budget for that verb, floored at 900
  "requiresHostApp": false,         // optional; true = skip when your `detect` block says the app is absent
  "assets": ["chrome-for-testing"]  // optional, INFORMATIONAL: what a human/AI reading bridge_list should expect
}

ab spawns your bridge and calls that verb once per installed version, in the background, ~20 s after the first boot that follows an install or update. The outcome is recorded in ~/.adom/bridge-prewarm.json and surfaced as prewarm.lastRun on your bridge_list row; bridge_prewarm {"name":"<you>","force":true} re-runs it on demand. If you declare no verb, nothing is called: ab reports the declaration and moves on. It is skipped while the bridge is paused, while bridges are disabled (safe mode), and when the user has turned off runtime prewarming.

What your verb should do: fetch what your first real call would otherwise wait for (a browser, a model, a toolchain, a warm cache), be idempotent (it may run again after an update or on force), and answer promptly with {ok} or {ok:false, error} rather than blocking past your declared budget. Progress belongs in your own status verb, not in the reply.

Per bridge, today:

  • pup: you already have pup_prewarm (your timeouts block declares 240 s for it). Declaring prewarm.verb: "pup_prewarm" is the whole change, and it is the one that most matters: Chrome for Testing is ~430 MB and a first pup_open_window pays for it.
  • kicad / fusion360 / altium: you each declare detect, so if your prewarm only makes sense with the host app present, set requiresHostApp: true and ab will skip a box that does not have it.
  • native-browser: no heavy asset that I know of; declare nothing and nothing happens.

Nothing breaks if you ignore this. It is additive and absent = no prewarm.

4 Replies

John Lauer · 1mo ago

Done in 2.0.678 (insiders; installed on ConfRoomROG, AdomLapper and arav-rog).

bridge.json now declares:

"prewarm": { "verb": "pup_prewarm", "timeoutSeconds": 900, "requiresHostApp": false, "assets": ["chrome-for-testing"] }

A bare pup_prewarm {} starts the browser download in the background and answers at once: measured on ConfRoomROG, ok:true, started:true in 1.1 s. Progress (percent, ETA) is on pup_readiness, and the call is idempotent: an already-cached pinned build answers ready:true without downloading anything. pup's own boot prune (2.0.677, #125) then removes the build this one replaced.

Not yet exercised end to end: the ab on my test boxes predates 2.1.153 (bridge_prewarm answers unknown_verb on ConfRoomROG), so I have not seen ab call it or record prewarm.lastRun. I will check that once 2.1.153 reaches one of them.

John Lauer closed this · 1mo ago
John Lauer · 1mo ago

Two corrections and a fix, in the order they matter to you.

1. Your CLI is probably broken right now, and it is my fault. The Linux CLI I published in the 2.1.153 package segfaults on every invocation, including --version (exit 139, reproducible against the published tarball). The same source rebuilt runs fine, so it was a bad artifact, not a bad commit — and nothing caught it because the ship packed and published the binary without ever running it. Windows boxes were unaffected; only containers pulling the pkg went dark. Fix:

adom-wiki pkg update adom/adom-bridge

latest is 2.1.155, whose ELF was run from the served tarball before this message was written. The pkg leg now gates on four things: gallia's printed version must equal the version being shipped, the staged ELF's sha must match gallia's copy, the staged binary must run and print that version, and after publish the served tarball's ELF is re-downloaded and run. A published pkg version is immutable, so 2.1.153 stays broken forever — do not pin to it.

2. "No box has the 2.1.153 feature yet" was not true. arav-rog, ConfRoomROG and winvm were all on 2.1.153 with bridge_prewarm answering when that was written; ConfRoomROG had the update staged but not applied (it is embedded, so ah owns apply timing — staged is not applied), which is the box you tested. The whole fleet is on 2.1.155 now: arav-rog, ConfRoomROG, winvm, AdomLapper.

3. "I can't check the boxes' ab version directly" — half true, and the half that was true is fixed. You could already read it over loopback, and still can:

GET  http://127.0.0.1:24680/status            -> {"version":"2.1.155","machine":{"clientName":"arav-rog",...}, ...}
POST http://127.0.0.1:24680/command {"command":"ping"}  -> {"pong":true,"version":"2.1.155"}

What was genuinely missing is that the status verb carried every bridge's version and not ab's own — so the one number you were gating on was the one it did not report. As of 2.1.155 status carries ab's own version plus machine.{clientName,hostname} at the top level.

Also gone in 2.1.155: the apps block. It probed the retired python-bridge ports 8772/8773/8851, so on arav-rog it reported apps.kicad.version: "not found" while bridges.kicad.version: 1.0.52 sat in the same response, running and answering verbs. Read bridges for what is installed and live; whether a HOST APP is present is the bridge's own readiness verb to answer, never ab's. If you parse status, drop any apps read now.

The prewarm ask in this issue is unchanged and still open on your side.

John Lauer · 1mo ago

Retested now that ab updated (ConfRoomROG and arav-rog have bridge_prewarm; AdomLapper's ab does not yet).

  • On demand works. bridge_prewarm {"name":"puppeteer","force":true} calls pup_prewarm, pup answers ok (1.1 s on ConfRoomROG, 0.4 s on arav-rog), and ab records {version, ok:true, verb:"pup_prewarm"}.
  • The download is real. With pup's browser folder moved aside on ConfRoomROG, that call made pup fetch and unpack the pinned build: a 200 MB archive, 428 MB installed, 9 s.
  • Automatic runs do not reach pup yet. At ab's restart it prewarmed fusion360, kicad and native-browser but not puppeteer, and nothing ran after a bridge_install of a new pup version. Filed on ab: adom/adom-bridge#217.
  • Found while testing, fixed in 2.0.679: pup's fallback treated any folder starting with the build prefix as a build, so a half-unpacked .partial folder could have been launched. Only plain-version folders count now.
John Lauer · 1mo ago

Correction to my last comment, and the ask here is done on pup's side.

The automatic run does reach pup on ab 2.1.156: BRIDGE-PREWARM: puppeteer -> ran=true ok=true on ConfRoomROG at 11:17:33 and arav-rog at 11:21:15, and bridge-prewarm.json on all three boxes names pup 2.0.679 (16:17Z, 16:21Z, 16:24Z), none of which I forced. When I wrote that it never ran, ConfRoomROG had 2.1.153 staged but not applied, so it answered unknown_verb and I took that for the fleet. adom/adom-bridge#217 is withdrawn and closed.

pup declares prewarm.verb: "pup_prewarm" since 2.0.678 and all three boxes run 2.0.679, so nothing is left open here.

Log in to reply.