Skip to content

Requirement 2.0c's free-disk stand-down reads workspace_root only, so a short state_dir warns in doctor.sh and stands nothing down

Id: TD-PPagop-26082517 · Status: resolved · Filed: 2026-08-25 · Resolved: 2026-09-21 · Ref: https://github.com/Pullwright/agent-ops/pull/1750

Noticed while reviewing PR #782 (requirement 2.0c, agent-ops#756).

Requirement 2.0c stands a cycle down before the clone when free space on workspace_root falls below min_free_workspace_bytes. The gate reads exactly one directory:

Terminal window
disk_free_kb="$(disk_space_free_kb "$workspace_root")"

scripts/doctor.sh’s advisory warning — which 2.0c deliberately re-points at the same helper and the same config key, so the two “cannot silently disagree about what ‘low’ means” — reads two, looping over "state_dir=$state_dir" "workspace_root=$workspace_root". The floor and the verdict are now shared; the set of directories they are applied to is not. A state_dir below the floor warns in doctor.sh and stands nothing down.

state_dir is the half of the cited incident the gate does not cover. The rationale carried by lib/disk-space.sh, by the 2.0c block in lib/standdown.sh, by requirement 2.0c and by issue #756 itself is the ockham failure, and that failure was both halves: a mid-flight truncated write left “zero-length git objects in both nodes’ state mirrors, permanently disabling git gc” (#604) — that is state_dir — and left “4.2 GB of orphaned clones” (#605) — that is workspace_root. Only the second is gated, so the corruption that made #604 permanent can still be started into.

state_dir is also the more consequential of the two to run short on. A workspace_root clone that fails is discarded with the cycle; state_dir holds the state mirrors, the event log and the fleet files that outlive every cycle and that the dashboard and every peer read.

Where the two share a filesystem the gate’s single df reading covers both and nothing is missed, which is the common case — ~/.local/state/poetic-agents and ~/.cache/poetic-agents/workspaces under one home. They are not structurally the same filesystem, though, and the shipped deployment models them as separate: deploy/docker/compose.yaml mounts state: and workspaces: as two named volumes, and deploy/docker/entrypoint.sh checks each on its own as “the state volume” and “the workspaces volume”. Either is free to be bind-mounted to a different disk.

Decide, and then make the code and the requirement say the same thing:

  • If 2.0c is meant to cover only the clone, say so in requirement 2.0c and in min_free_workspace_bytes’s own description — both currently justify the check with an incident that spans both directories — and note there that a short state_dir is doctor.sh’s business alone.
  • If it is meant to cover the cycle’s writable state as a whole, have the gate take the minimum free space across state_dir and workspace_root (skipping the second reading when both resolve to the same filesystem, so a shared-disk host still reports one figure), carry the shortfall’s own directory in the stand-down event’s existing path field, and update requirement 2.0c and acceptance check 2n to match.

The second reading is the one the issue’s own evidence argues for, but the key name, the requirement and the shipped behaviour all consistently say workspace_root, so this is a scope decision for #756’s author rather than a defect to correct in place.

  • lib/standdown.sh — the 2.0c block.
  • lib/disk-space.sh — the shared helper.
  • scripts/doctor.sh — the two-directory loop.
  • docs/IMPLEMENTATION-PIPELINE-SPEC.md — requirement 2.0c, acceptance check 2n, and min_free_workspace_bytes’s configuration row.
  • Related but distinct: #757 bounds the sum of several nodes’ disk on one shared host; this item is about which of one node’s own directories the existing gate reads.

Migrated to https://github.com/Poetic-Poems/agent-ops/issues/992.