Closed general

FR: register_container / setup_desktop should offer to install a @reboot boot hook for the relay

Drew Owens · 3mo ago ·closed by John Lauer

Type: feature request. Version: AD 1.9.213.

The gap AD already documents to itself

serve --supervise prints this on startup:

⚠ A full CONTAINER REBOOT still needs a boot hook (cron @reboot / your container's init) — the watchdog covers session teardown, not host reboot.

So AD knows the watchdog does not cover reboot, tells the operator once, at the moment they are least likely to act on it, and then nothing enforces it. Surveying four of my relay containers, none had a boot hook and none were even running --supervise — every one was a bare adom-desktop serve that would vanish on reboot and leave connected desktops in a reconnect loop with no relay to reconnect to.

Why the hook belongs at registration, and NOT in the Windows installer

Worth being precise about the placement, since the obvious phrasing ("have the installer do it") targets the wrong host:

  • The relay runs in the cloud container (Linux). The Windows installer cannot create a cron entry there.
  • register_container and setup_desktop run from inside the container, which is exactly where the hook must live.

So the right hook point is the container-side registration flow — the same one that already writes server entries and knows it has just made a container a participant in the relay topology.

Proposed behaviour

When register_container / setup_desktop sets a container up:

  1. Detect whether the relay will survive a reboot (crontab @reboot, systemd user unit, or the image's init).
  2. If not, offer to install one — @reboot <abs path>/adom-desktop serve --supervise — and say plainly what breaks without it.
  3. Make it inspectable and idempotent: a --boot-hook / --no-boot-hook flag for non-interactive use, and re-running should not duplicate the entry.
  4. Surface the state in a readiness/doctor field (relayBootHook: present|absent|unsupported) so an AI or an operator can verify rather than assume.

Why this is worth doing

The current failure is silent and delayed: everything works until a reboot, then a fleet of desktops sits in a reconnect loop against a relay that no longer exists, and the symptom appears far from the cause. For containers whose desktops control real hardware, "the relay came back by itself" should be the default, not a runbook step nobody was told about at the right time.

Related: #33 (default token / hardening), and the two relay-rotation bugs filed alongside this one.

3 Replies

John Lauer · 3mo ago

Parking this one deliberately (owner decision, 2026-07-31): the cloud containers don't give us an init/systemd/cron authority we can reliably hook — that's a platform constraint of the container environment, not something register_container/setup_desktop can promise to solve. Where a real init exists (the HD-managed WSL2 workspace), the relay already runs as a baked-in systemd unit with Restart=always + starts at distro boot — so the pattern is implemented everywhere we have the authority to implement it.

For the containers, the current answer is the AI in the container: when the relay is found dead (health probe fails / desktops flapping), re-run serve --supervise — and note that as of 1.9.215 the token should be provided via the ADOM_AUTH_TOKEN env var (see #388). Your survey finding (four containers, none supervised) is fair evidence the guidance needs to be louder; the startup warning text will keep pointing at cron @reboot for images that do support it.

If the container platform ever grows a first-class boot hook, this issue is the right shape for wiring it into register_container — leaving it open-parked rather than closing.

John Lauer · 2mo ago

Agreed on the diagnosis, and your survey is the persuasive part: four relay containers, none with a boot hook, none running --supervise. A warning printed once at startup, to an operator who is not watching, that nothing later enforces, is not a safeguard - it is a note-to-self. That framing is right and it generalises beyond this feature.

Not built yet, and I want to be honest that it is a container-side change rather than an ab-core one, which is why it has sat: register_container / setup_desktop run in the container, and the hook they would install (cron @reboot, or the container's init) is container-shaped. It is a small change in the right place and a fiddly one in the wrong place.

What I would build, if this is the shape you want:

  • Offer, do not impose. setup_desktop detects no boot hook and OFFERS to install one, naming exactly what it will write and where. Silently editing a user's crontab during a "connect my desktop" flow is not something a setup step should do unannounced.
  • Idempotent and identifiable. A tagged line (# adom-bridge relay boot hook) so a re-run updates rather than duplicates, and so a human can find and remove it.
  • --supervise in the same breath. Your survey found none of the four running it. The boot hook and the watchdog are two halves of the same guarantee - reboot coverage and session-teardown coverage - and installing one without the other leaves a gap that looks fixed.
  • Report the state, always. status should say whether a boot hook exists, so "is this relay actually durable?" is answerable without SSHing into four containers to look. That part is worth doing even if the auto-install never happens.

Of those, the last one is the cheapest and the one I would ship first: making the gap VISIBLE turns your manual survey into a single call. If you want it in that order, say so and I will do the status field ahead of the installer.

Leaving open. Not a hard problem, just one that belongs to whoever owns the container-side setup path.

John Lauer · 2mo ago

Built in 2.1.50, in the shape agreed above: offer, do not impose, name exactly what is written.

adom-bridge relay_boot_hook {action: status | install | remove} (container-local, no desktop needed):

  • status: whether this container has a crontab to hook at all (supported), whether the hook is installed, the exact line it would write (wouldWrite), and whether a relay is running right now.
  • install: appends ONE @reboot line to this user's crontab that starts adom-bridge serve --supervise (logging to ~/.adom/relay-boot.log; token from ADOM_AUTH_TOKEN when the login environment sets it) and touches nothing else. Idempotent.
  • remove: deletes exactly that line.

setup_desktop now lists it as step 5 after "start the relay", and the CLI help carries it. Containers with no cron report supported:false and get the same advice as before (re-run serve --supervise when the relay is found dead), which is the platform constraint from the owner decision, now stated by the tool instead of a startup warning nobody reads. Closing.

John Lauer closed this · 2mo ago

Log in to reply.