The image upgrade that filled the data volume and left the agent dead


The upgrade looked routine: a new image, a container restart, and then nothing. No gateway, no chat, no logs from the agent — only a Docker volume at zero bytes free and a shell that cannot even write its own history.

This was not a rare edge case in November. When v0.22.6 baked the documents extra into the image, every older volume was asked to rebuild its recorded selection on first boot. On agents with a tight data volume, that rebuild merged the image’s entire uv cache into the volume before building anything. About 3% of upgraded agents — 23 of the first ~430 — filled their disk within two minutes of the swap. The ones with 650–775 MB free died outright; the ones with 980 MB or more were fine.

What happens on the first boot of a new image

Hermes keeps a record of which optional dependency set a volume installed. On boot, docker/stage2-hook.sh calls refresh_dependencies, which rebuilds that selection into a new generation under /opt/data/installs. Before building, it computes where uv’s cache should live and merges the image’s cache into /opt/data/cache/uv.

Merging is cheap when you have space and fatal when you do not: the cache copy has to land before the build starts, and if the volume cannot hold both, it fills to zero. Then the gateway cannot start — not because the build failed, but because there is no room to write anything at all.

The second half of the trap is the retry loop. A failed build falls back to the image venv, but the fallback records the selection as stale, so the next boot tries the rebuild again. Each retry re-merges the uv cache — its .seeded marker is only written after a complete copy — and fills the volume again. An agent that has already died stays dead, forever, on every restart.

Why most of those rebuilds were pointless

For a typical hosted agent, the recorded selection plus the restored baseline equals the extras the image already bakes. The “rebuilt” generation was a copy of /opt/hermes/.venv, materialized onto the volume for no reason. The expensive work existed to reproduce something that was already there.

What the fix does

refresh_dependencies now computes the selection sync_venv would build — recorded extras that are still declared, the restored baseline, and discovered plugin members — and compares its stamp with the selection the image recorded. If they match, it drops the volume’s venv fact so that selected_venv resolves to the image venv. Nothing is copied, nothing is built, and the old generation is unselected (and collected once it is a day old).

That covers every upgrade, not just the v0.22.6 incident, because the stamp changes with each new uv.lock.

The rest of the change is about failing well:

  • If a rebuild is genuinely needed but there is not enough room, the refresh skips it and takes the existing offline fallback: the image venv boots, the selection stays recorded, and a later boot with room rebuilds it.
  • If the volume is too full even to boot, the uv cache is freed before the fallback record is written — otherwise the fallback’s own write is what fails, and every boot repeats it. The cache is only removed when free space is under 256 MB; above that, a failed build keeps the cache its retry needs.
  • A fallback now records a stale stamp, never the recorded one. Otherwise a restart whose check raised (a broken plugin manifest, a config.yaml typo) could read the image venv as current forever once the cause cleared, and your extras and plugin dependencies would never come back.

What it looks like in a container

The author verified on arm64 with 5 GB ext4 loop volumes, preparing each volume on v0.22.5 and then upgrading to an image built from the branch:

Scenario Before After the upgrade
v0.22.6-style upgrade, 700 MB free fal generation + 794 MB uv cache dependency environment: image, 1 generation collected, uv cache removed, 3,013 MB free, gateway running on /opt/hermes/.venv
Agent already killed by v0.22.6 reproduced on official v0.22.6: [Errno 28] No space left on device, container dead, 0 MB free first boot on this branch: image, 3,013 MB free, gateway running
Plugin with Python deps, 700 MB free plugin generation refresh skipped (699 MB free, rebuild needs 702 MB), fallback, 2 generations collected, 3,739 MB free, cache untouched; plugin logs No module named 'humanize' as expected
Same agent, with room — rebuilt in 5.5 s, actually used 554 MB against the 702 MB estimate; the plugin loads
Plain restart, no update — current in 0.3 s, cache and disk unchanged

The dependency step, measurement included, took 0.3–0.6 s on every boot except the real rebuild. The gateway’s mapped libraries confirmed the accounting: image-path agents loaded only /opt/hermes/.venv, the rebuilt agent loaded its new generation, and no agent loaded an old one.

If your agent is stuck right now

An agent that already filled its volume will not heal itself on the old image. You need a boot on an image that contains this fix (v0.23.5 or later for CLI/Docker distributions), or a console session to free space before restarting:

# from a shell that can still reach the container
df -h /opt/data
du -sh /opt/data/cache/uv /opt/data/installs 2>/dev/null

If you are on Hermes Cloud, the portal already holds back agents with under 900 MB free as a stopgap, which is worth knowing when an upgrade seems to be skipped rather than applied.

The trade-off that remains

On a genuinely low-disk upgrade, plugin agents with Python dependencies boot without those dependencies until a boot with room rebuilds them. That is the same contract as the pre-existing offline fallback: better an agent that runs without one plugin than a volume that cannot boot at all. The log line tells you which path you got — dependency environment: image, rebuilt, current, or fallback.

For the broader family of disk incidents, our update disk-blowup recovery guide and the autoprune notes cover cleanup; the v0.23.5 rollup covers the rest of this window.