Skip to content

Remove a terminal task's dind + config volumes once its container exits - #438

Merged
tildesrc merged 1 commit into
mainfrom
panopticon/sweep-dind-volumes
Nov 4, 2026
Merged

tildesrc merged 1 commit into
mainfrom
panopticon/sweep-dind-volumes

Conversation

@tildesrc

Copy link
Copy Markdown
Contributor

A docker_in_docker task's panopticon-dind-<id> volume holds the nested daemon's whole image store (30–60 GB each), and nothing ever removed it. LocalRunner tears down with a plain docker rm --force, and no docker volume rm exists anywhere. On 2026-10-27 the host had 145 orphaned dind volumes (1.0 TB) and its root disk was at 94%. This is the structural fix. The plan is in the task's plan.md artifact.

What changes

  • LocalRunner.remove_volume(name) runs docker volume rm --force <name>. --force makes an already-gone volume a no-op, but a volume still in use is refused, so real failures raise. New dind_volume() and config_volume() helpers give the volume names a single source, and spawn mounts through them too.

  • Spawner.sweep(task) runs in the host daemon's pass right after cleanup. When a task is terminal and no container is running for it on this host, it:

    1. removes the stopped container, since task containers aren't started with --rm and a stopped one pins its volumes;
    2. removes the dind volume, then the config volume, each in its own best-effort try so a failure on one can't skip the other.

    It tracks swept ids in-process, so Docker runs once per task per runner process and a restart re-sweeps each task once. It skips shell-workflow tasks, which have no volumes.

  • Respawns keep their volumes. heal, snooze wake and R only ever act on non-terminal tasks, so the image cache and CLI session history they depend on survive.

The task memo vs. this PR

The memo suggested gating the sweep on tasks claimed by this runner. I didn't, because the claim is almost always gone by the time a task is terminal and exited: the agent releases it on exit, and cleanup releases any that's left. The sweep uses cleanup's gate instead (terminal, not running). On a host that never ran the task, the removals are harmless no-ops.

Tests cover the emitted command, the sweep's order, gates and failure isolation, that heal never removes a volume, and that each daemon pass sweeps after cleanup. AGENTS.md's module map and test notes are updated to match.

🤖 Generated with Claude Code

A docker_in_docker task's `panopticon-dind-<id>` volume holds the nested
daemon's whole image store (30-60GB), and nothing ever removed it: the
host had 1TB of them orphaned. The host daemon's pass now runs a `sweep`
after `cleanup`: a terminal task with no running container has its
stopped container removed (it would pin the volumes), then its dind and
config volumes removed with `docker volume rm --force`, each independently
and best-effort. Swept ids are tracked in-process so docker runs once per
task per runner process. Respawns never reach it, so the image cache and
session history they rely on survive.

The sweep isn't gated on the claim: the agent releases its claim on exit
and `cleanup` releases any left, so a claim gate would almost never fire.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tildesrc
tildesrc marked this pull request as ready for review November 4, 2026 16:38
@tildesrc
tildesrc merged commit c27635a into main Nov 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant