Toolbox

A running Herdr Core Shell is refreshed on offer, not automatically

Status: accepted

The Herdr Core Shell is a Detached Shell: toolbox herdr creates it and exits, so no host process attaches to it, no Image Prefetch polls behind it, and the Idle Reload, a precmd trigger in an attached shell, cannot reach it. A Shell left up for days stayed on its image until a toolbox herdr stop.

The decision: a toolbox herdr that joins a running Shell whose image is behind (the local store newer than the container, or the registry newer than the store) lists what the recreate would end and asks. That is the Detached Shell Refresh. The default answer is yes when the Shell is quiescent, that is nothing outside its baseline would end, and no otherwise. The replacement goes through the create path, so the machine is updated and hc installed again. This narrows, for this Shell only, the Start-up Refresh Prompt's rule that a running container is never asked about (ADR 0005, ADR 0008): the reason behind that rule, ending whatever else is attached, is shown to the person and left to them.

Considered Options

Automatic recreate when quiescent. Rejected: herdr-core keeps agents alive with nobody attached, and an agent waiting at its prompt is a live process. A rule strict enough to be safe would almost never fire, and one that skips idle agents would end sessions nobody chose to end, the surprise Session Reload was named to avoid.

A poller in the bridge daemon. It already runs on the host, but it would take on destroying containers, which it does not do today. Kept for later, if the offer turns out to be too rare in practice.

A watcher inside the container. It would need the Docker socket.

Gate on herdr-core's agent state (hc get). It tells an idle agent from a working one, but the process table (ContainerTop) is enough to tell an empty terminal from an occupied one, and the person decides the rest.

Consequences

Without a tty there is no probe and no offer, so a toolbox herdr run from a script never recreates. Only toolbox herdr offers, since only it registers the machine. The Orca Shell has the same gap and is left to its own change.