Judge idle per rig and delete a rig as a unit

A two-plane rig lost its forge VM to the idle self-delete. The VM had no ssh session and no sim-job process of its own, so it counted as idle, while a worker polled a long job on it from the peer VM. The registry, signing key and staged data went with it.

The rig is one unit (ADR 0006), so idleness is now judged per rig rather than per VM.

What changes:

  • --rig <name> puts VMs in one rig through a label and a metadata key. lab up --two-plane and the Geo recipe set it.
  • Each member publishes its idle clock as a guest attribute. Before deleting, a member looks up its peers by label and reads their clocks. It deletes only when every member has been idle for the full window, then deletes the peers first and itself last. A peer that refuses keeps this VM. Any doubt about a peer counts as busy. A rig of one has no peers and makes no extra calls.
  • just lab hold --instance <name> --for <duration> defers the self-delete, for at most 12 hours and never past the max run. status shows the hold.
  • The budget TTL and the max run are untouched and remain the hard ceiling.

I chose the peer idle clock over watching established connections because it needs only the compute permissions the self-delete already holds and works the same whatever the workers use to reach the VMs.

sequenceDiagram
    participant W as Worker
    participant F as Forge VM
    participant P as Peer VM
    W->>P: ssh in, poll the long job on F
    F->>F: idle check, no ssh, no sim-job
    F->>P: read idle clock
    P-->>F: busy (ssh session live)
    Note over F: old code deleted F here, now it stays
    W->>P: job finishes, ssh closes
    F->>P: read idle clock, idle for the full window
    F->>P: delete peer
    F->>F: delete self

Testing:

  • The idle and engine selftests cover the rig and hold paths offline against stubbed gcloud, curl, ss and pgrep. Each new check fails when the fix is reverted to main's files.
  • On a small live two-plane rig, a control run on main's code deleted the forge VM while its peer was busy. A run with this change kept it, then deleted both VMs together after the window. reap and a gcloud listing confirmed nothing remained for the rig owner afterwards.
  • The word ceiling rises by the 21 words the operations guide gains.

Merge request reports

Loading
Loading