carlos / platform Public

A new instance of an already staged build waits about 17 s for a whole-box root pass before it can wake Issue open

Seen on the flagship on 2026-11-24 (woodstar-community, account bdm, channel edge, exec-backed, hibernating). The tenant creates an instance through the console API and requests it at once:

13:59:20 provision: minted instance route ws-techpreneurs.bdm.oncarlos.com
13:59:23 agent: ... needs a root pass for 543bc15 (...); asked for one
13:59:23 rollout: ...: install before its wake: materialize ...: its install is relayed to the root pass
13:59:23 activator: wake ...: refusing to wake: no build is installed for this instance yet
  ... the same pair every ~2s ...
13:59:40   ...: repointed  -> 543bc15 (edge; hibernating — runs it on next wake)
13:59:41 activator: ... booting fresh

Build 543bc15 was already staged on the box: sibling instances of the app run it. The new instance still could not wake for 17 s. Still so on main at 55f34c398.

Why it waits for root. A managed wake of a row with no installed build runs the adopt pass for that one host (internal/rollout/wakeplan.go:282, internal/release/materialize.go). Every gate passes, but the last step writes /opt/carlos/live/<host> (internal/release/versions.go:288), and the agent has only /data and /run/carlos writable (internal/host/units/carlos-edge.service:48-50). The pass relays to root (internal/release/adopt.go:1886) and the wake is refused until the row is stamped (wakeplan.go:288). That part is the privilege split working as designed.

Why root takes 17 s. The ask is prompt: carlos-stage.path starts carlos adopt --stage-only on the first touch. But that is the whole box's pass, not this host's. In order (internal/host/agent.go:5991 on): start-up and unit repair, config sync for every unit route (:6196), the restart pass (:6221), the capability pass (:6242), then release.Pass over every route (:6325), which reads each app's pointer and pipeline from the bucket (internal/release/adopt.go:754, :893) and takes hibernating routes last (:1251). The journal agrees: root's config sync names this host at 13:59:28 and repoints it at 13:59:40.

Two smaller things in the same trace:

  • The comment at agent.go:2626 sizes the 15 s re-ask window to outlast a root pass of "about eight seconds". The flagship's pass is now about twice that, so a re-ask can land while the pass is still running, and systemd drops a change made mid-run.
  • The deferred re-ask at 13:59:53 fired after the install had landed. It starts another full root pass for nothing, and on a box that creates instances on demand that makes "a pass is already running" more likely for the next create.

What could fix it. All of it is root-side and census-gated, and none of it should change without timing it on a box, so nothing was built:

  1. First installs first. In --stage-only, before config sync, one release.PassFilter narrowed to adoptable, exec-backed, hibernating routes with no live link and no installed version. It reads only those apps' pointers and restarts nothing. Estimated 17 s down to the pass's start-up cost. It gives up the sleepers-after-awake-hosts poison ordering for a row that has no previous build to stay on.
  2. Boot before the link. Let a new instance's first wake run the already staged and verified build before root's link lands, as a held wake already runs a retained copy (activator.go, step 0.65). The wait becomes zero. It touches the installed-means-linked invariant across rollout, activator and release, so it wants a spec.
  3. Size the re-ask window to the pass, or have the pass notice a request that arrived while it ran.

The other half of the same trace, the first generation running without its config, is fixed on branch instance-ready-before-wake (also #1384).

LLM

Found while fixing the config half of the same trace; analysis and three options, nothing built.

Option 1 is built on branch first-install-fast-path (tip 0a16383f0881582bb4b0d9653247f7eda6806000, CI green). Its description has the design, the tests and the reviews.

  • The root pass now takes hibernating exec rows with no installed build first, ahead of config sync and the box-wide release.Pass, and once more after it for rows minted meanwhile. It is the same pass narrowed, with no restart and no download, so only already staged builds get the fast path.
  • Off-box, with 40 other apps installed: 122 store reads before the new instance's link in the box-wide pass, 2 in the first-installs pass. With 40 ms per read that is about 5 s against about 90 ms.
  • Nothing was run on a box. What precedes the step in the root pass is untimed; on 2026-11-24 it was at most 5 s of the 17.
  • Code review (Opus 5.5) READY after two rounds. Census (Opus 5.5 in place of Astra at Paul's direction, author Fable 5.2) APPROVED, on #280.
  • Not merged and not released. The step stands down on a box with a root census. Options 2 and 3 and the wasted deferred re-ask are untouched; the follow-up list is on the branch.