Skip to content

v1.91.341.0 fix(ubicloud): no zombie VMs: owner required, 3h TTL, legacy sweep, leftover line (GST-118) - #3652

Merged
capy-ai[bot] merged 10 commits into
mainfrom
garrytan/gst-118-no-zombie-vms
Oct 30, 2026
Merged

capy-ai[bot] merged 10 commits into
mainfrom
garrytan/gst-118-no-zombie-vms

Conversation

@garrytan

@garrytan garrytan commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3652,
  "head": "51af23e879cca629dd3b2c63a2f104869917056c",
  "version": "1.91.335.0",
  "base": "main",
  "gate": {
    "pregate.json/remote_gate": {
      "pass": 18700,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "head_tree": "0dbf99d5e10766ae2d4896d4b0aef035fd678c56",
  "product_patch_id": "8cac9556c38cdac3dfb5a548d1016f1610c1877a",
  "gstack_version": "1.91.335.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 162,
    "rules": "55726fab80631072",
    "base": "94a10cc9042776d2ea85b46eccaf3eba449a8b93",
    "registry": "94a10cc9042776d2ea85b46eccaf3eba449a8b93",
    "gate_scan": {
      "tagged": 0,
      "head": "51af23e879cca629dd3b2c63a2f104869917056c"
    },
    "reasons": [
      "gate-class",
      "runtime=162>50"
    ]
  },
  "pregate": "requires-remote cleared @0dbf99d5e107 (1 checks, current for 51af23e879cc)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/41110395690",
    "windows-free-tests.yml/windows-free-shard: https://github.com/garrytan/gstack/actions/runs/41110400344",
    "pregate.json/remote_gate: remote-gate tree=0dbf99d5e107 tests=18700"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "README.md, AGENTS.md, CLAUDE.md, CONTRIBUTING.md, docs/ (excluding docs/designs), ubicloud/SKILL.md(.tmpl)"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 2,
    "deferred": 0,
    "noted": 11,
    "fixed": 8,
    "scope": "frozen",
    "fix_checks": 2,
    "dispatches": {
      "specialist": 12,
      "red-team": 1
    }
  }
}

What changed

A /ubicloud run now ends with UBICLOUD: left=0, the runner's own check that its VM is gone, and new VMs carry a 3h TTL

A /ubicloud run now ends with UBICLOUD: left=0, the runner's own check that its VM is gone, and new VMs carry a 3h TTL instead of 4h.

Text version
-        ubi-runner: creating eu-central-h1/ubirun-lane7-<epoch>-9f3a2c10-t4 (standard-16)
-        ubi-runner: ubirun-lane7-<epoch>-9f3a2c10-t4 carries a 4h TTL (any later run of this script reaps it); ...
+        ubi-runner: creating eu-central-h1/ubirun-lane7-<epoch>-9f3a2c10-t3 (standard-16)
+        ubi-runner: ubirun-lane7-<epoch>-9f3a2c10-t3 carries a 3h TTL (any later run of this script reaps it); ...
         ubi-runner: command exited 0 after 1140s
-        ubi-runner: destroyed eu-central-h1/ubirun-lane7-<epoch>-9f3a2c10-t4
+        ubi-runner: destroyed eu-central-h1/ubirun-lane7-<epoch>-9f3a2c10-t3
+        UBICLOUD: left=0 owner=lane7 vm=ubirun-lane7-<epoch>-9f3a2c10-t3 others=0

Why

On 2026-10-29 the shared Ubicloud project held 16 VMs (256 vCPUs). Three were more than 3 hours old, belonged to nobody anyone could name, and had cost about $15.90 before they were destroyed. None of the 16 names carried a TTL, because they came from an older copy of the runner, so nothing would ever have reaped them. Now a VM can't be created without an owner, every name carries a lifetime that the next up anywhere enforces, a lane's own old TTL-less VMs get swept after 4 hours, and every run reports whether its own VM is gone.

Blast radius

Every caller of scripts/ubicloud/ubi-runner.sh that creates a VM (up, run, verify, bun run test:ubicloud, the keyed remote pregate, the Drive ubicloud skill once sync.sh runs) now needs UBI_OWNER, and fails before any API call with UBI_OWNER_REQUIRED and the fix line when it is missing (tested: ubicloud-runner.test.ts "up and run refuse without UBI_OWNER before any API call"). The TTL-less legacy sweep touches only the caller's own ubirun-<UBI_OWNER>-* names that are 4 hours old or more, so another lane's TTL-less VM, an untagged one, and names under other prefixes are never reaped; only a TTL lets reap judge another lane's VM (tested against a fake API with ubirun-gbra240-…, untagged and team-db names, and the test fails on the earlier any-owner sweep). An earlier version of this branch swept every owner's TTL-less VMs, and one of its remote pregates destroyed 22 of gbrain's eval VMs (GST-324); that is what the owner scoping fixes.

Approvals

Date Asked Exact words Outcome Covers Still pending
2026-10-29 Approve the plan "Plan: gstack never leaves zombie Ubicloud VMs (GSTA-164, GST-118)" (autoplan run autoplan-20261029160511, 3 decisions) “do it” (Garry (via GStack Minder), relayed by agent:GSTA-36) approved the reviewed plan (sha256 8bd53db7f78e), every recommendation taken none
2026-10-29 Approve the plan "Plan: gstack never leaves zombie Ubicloud VMs (GSTA-164, GST-118)" (autoplan run autoplan-20261029160511, 3 decisions) “do it” (Garry (via GStack Minder), relayed by agent:GSTA-36) approved the reviewed plan (sha256 8bd53db7f78e), every recommendation taken none
2026-10-29 Replace the Drive ubicloud skill's runner with gstack's runner (GST-221) “yes, a, no rotate needed” (Garry (via GStack Minder)) approved Drive skills/ubicloud/scripts: byte copy of main's runner plus sync.sh none
2026-10-30 Ship GST-118 while P-1 holds other /ship runs “ship. P-1 is lifted for GST-118 only: zombie VMs cost more than one normal-cost /ship.” (GStack Minder (Captain)) approved /ship on PR #3652 on gstack 1.91.335.0, unstamped READY with cost.credits at start and end none
2026-10-29 Destroy the three unattributed Ubicloud VMs older than 3h “down. Destroy the three...” (GStack Minder (Captain)) approved the three unattributed ubirun VMs listed in reports/GSTA-164-decisions.tsv row 3 none

Source: gstack-approvals record for garrytan/gst-118-no-zombie-vms (display only; not an approval citation).

Summary

A lane that died mid-run, or a stale copy of the runner, could leave a VM billing in the shared project with no owner and no TTL. The runner now refuses to create a VM without UBI_OWNER, defaults the TTL to 3 hours (UBI_TTL_HOURS, 1-999, checked only when a VM is created), and its reap, which every up runs first, also destroys the caller's own ubirun-<UBI_OWNER>-* names with no TTL once they are UBI_LEGACY_HOURS old (default 4); another owner's or an untagged TTL-less VM is never touched. run and verify end with UBICLOUD: left=<0|1|unknown> owner= vm= others=, checked against the project's VM list after teardown; anything but left=0 turns a passing command into exit 1 and prints the down command.

The remote pregate refuses without UBI_OWNER (PREGATE_REMOTE_OWNER_REQUIRED), names its VM with a TTL taken from its stop deadline plus 15 minutes (-t1 today), and reports PREGATE_REMOTE_INFRA unless the runner wrote left=0 to UBI_LEFT_FILE. It never reads that line from the remote command's output. Docs and the /ubicloud skill say the same.

Behavior changes. UBI_TTL_HOURS=0 (no TTL) is refused; a lane's own TTL-less ubirun- names are no longer exempt from reap (sync this runner into a lane only after its own TTL-less VMs over 4 hours are finished, or run with UBI_REAP=0 until then); up/run/verify without UBI_OWNER refuse instead of using a random per-machine id. A refused up still writes the old random owner-id file, because the top-level owner lookup runs first; no VM ever carries that id (kept on purpose, see Plan Completion).

Test Coverage

Coverage: 92% value-weighted (23 of 25 paths rated ★★ or better). Test value: 0 tests written, 0 rejected by the authoring gate, 4 existing tests extended, 1 path weakly covered.

  • Weak path: the EXIT trap being armed before cmd_up is checked by a source-text assertion only (★).
  • Gap, rejected as log text only: the "has no TTL" log line for run -n NAME.

Tests ran: pregate.json/remote_gate 18700 (0 failed, tree 0dbf99d5e107)

Pre-Landing Review

Pass 1 found two blocking defects, both fixed in 1923151: TTL validation at startup blocked down and reap (adversarial native), and the left= line was parsed from an async log that could be missing or spoofed by remote output (outside voice, openai/gpt-6.1-sol; security raised the same as informational). Six informational findings were fixed in the same commit; eight were skipped with reasons. Pass 2 found nothing at the blocking floor. The final remote pregate then caught a spawnSync without a timeout in one of pass 1's new tests (test/spawnsync-timeout-tripwire.test.ts), fixed in 715e3a1 and cleared by one fix-check reviewer. After that, the any-owner legacy sweep destroyed 22 of gbrain's eval VMs during this /ship's first remote pregate (GST-324). 51af23e scopes the sweep to the caller's own VMs; a second fix-check found nothing at the floor and three informational items: a lane that syncs this runner while its own TTL-less VMs are over 4 hours old loses them; the owner-less reap assertion can't fail without a pre-written owner id; owners longer than 12 normalized characters collide.

REVIEW_LOOP: passes=2 blocking_found=2 deferred=0 noted=11 fixed=8 scope=frozen fix_checks=2 dispatches=13

Gate edits: none detected (GATE_SCAN tagged=0 at 51af23e)

Outside review: openai/gpt-6.1-sol on pass 1, completed. The Codex CLI is not installed, so the Codex structured pass is unavailable (missing coverage).

Review notes

Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.

  • INFORMATIONAL scripts/ubicloud/pregate-remote.sh:258 Nothing tests that left= is read only from UBI_LEFT_FILE. The stub tees the same line to stderr and to the file, and the 'none' row prints nothing at all. If the parser went back to reading "$log", every pregate test would still pass, so the spoofing fix in item 2 has no regression test.
  • INFORMATIONAL scripts/ubicloud/ubi-runner.sh:806 No test covers the three name-classification log branches in cmd_run (grep for 'no TTL' in test/ubicloud-runner.test.ts finds nothing). The branches also do not match vm_rows. The TTL branch promises a reap for any name ending in -t, such as '-n box-t3' or a four-digit TTL. vm_rows only computes expires for prefixed names with a TTL of 1-3 digits, so the reaper never reaps those names. The legacy branch skips the owner-less 'ubirun--' form that the reaper does match, so for those names it wrongly says 'nothing reaps it'.
  • INFORMATIONAL scripts/ubicloud/pregate-remote.sh:221 Tests only check the VM TTL derived from stop_after at its t1 value (every pregate test regex hard-codes -t1). A regression back to a literal -t1, or a broken rounding formula, would pass, and a longer cap wall would then produce VMs the reaper destroys mid-run.
  • INFORMATIONAL scripts/ubicloud/ubi-runner.sh:808 Fix (4) left the run log's reap promise out of step with the reaper. vm_rows (lines 307-313) treats a name as reapable when it matches the prefix-owner-epoch form or the ownerless ubirun-<epoch>- form, and it counts a TTL only when the name has an epoch and a 1-3 digit -t suffix. cmd_run's log uses its own regexes instead, so it is wrong in both directions. A -n ubirun-1761500000-x name, which the legacy sweep does reap, gets told 'nothing reaps it'. A -n myvm-t3 or -n ubirun-x-t1234 name, which reap never touches, takes the first branch and is told 'any later run of this script reaps it'. The cost is a misleading log line, not a leaked VM, because the printed down command is still correct; but this second copy of the name grammar will drift again.
  • INFORMATIONAL [ADVISORY] scripts/ubicloud/pregate-remote.sh:223 UBI_LEFT_FILE is $logs/run.log.left, inside the same $logs directory that both --pull entries untar remote-produced archives into, and the pulls run before teardown. A VM whose shell controls the tar -czf - stream (for example through ~/.bashrc on the VM) could plant run.log.left. If the planted file has no trailing newline, the runner's >> append joins onto that line and the sed reads left=0. If the runner dies before leftover(), the planted file is read as-is. The impact is small: teardown and the VM-list check run locally and the remote cannot keep the VM alive, so this only hides a destroy that also failed locally. Still, it undercuts the doc's claim that the line is 'out of reach of the command's output'.
  • INFORMATIONAL [ADVISORY] scripts/ubicloud/pregate-remote.sh:239 Across a quota retry, the UBI_LEFT_FILE result of attempt 1 is deleted without being checked. The retry trigger greps the whole log, and that log includes the remote command's own output, so a remote test run that fails and prints 'vCPU quota exhausted' sets off a retry. test/ubicloud-runner.test.ts and test/ubicloud-pregate-remote.test.ts both contain that string. If attempt 1 created a real VM and its teardown reported left=1 or left=unknown, attempt 2 runs rm -f "$log.left", and the final check sees only attempt 2's VM. The gate can then report a confirmed cleanup while attempt 1's VM is still running until its TTL reap. The log is copied to attempt-1.log, but .left is not copied and nothing parses either file.
  • INFORMATIONAL scripts/ubicloud/ubi-runner.sh:806 Fix 4 is incomplete. The TTL branch still promises a reap for any name that ends in -t, but vm_rows sets expires only when the name has the ubirun-[owner-]- prefix and the TTL is 1 to 3 digits. So a name like -n foo-t3 or ubirun-x--t1000 is told 'any later run of this script reaps it', and nothing ever reaps it. The new elif has the opposite problem: it misses untagged ubirun-- names, which cmd_reap does reap, and labels them 'nothing reaps it'.
  • INFORMATIONAL scripts/ubicloud/ubi-runner.sh:148 leftover() appends to UBI_LEFT_FILE with no error handling; under set -e a failed write aborts run_teardown in the EXIT trap, so a clean left=0 run exits 1 and the down hint or --keep log line is skipped. Fails closed.
  • INFORMATIONAL scripts/ubicloud/ubi-runner.sh:325 cmd_reap dies on an invalid UBI_LEGACY_HOURS, but up calls it as cmd_reap || log 'reap failed; continuing', so up/run/verify abort instead of continuing; with UBI_REAP=0 the bad value is accepted silently.
  • INFORMATIONAL scripts/ubicloud/ubi-runner.sh:141 run -n still validates UBI_TTL_HOURS though the caller supplies the name, so a stale value blocks pregate before any VM exists; any die before create makes pregate print 'left=missing … destroy ubirun-…' for a VM never created (pre-existing misreport).

Exploratory QA

One live run on Ubicloud during the build: UBI_REAP=0 UBI_OWNER=gsta164 gstack-ubi run -s standard-2 -- true printed UBICLOUD: left=0 (about $0.01). Every remote pregate in this /ship ended with UBICLOUD: left=0 owner=gsta164 ... others=0. The last one ran with UBI_REAP=0 and reaped nothing.

Design Review

No frontend files changed — design review skipped.

Eval Results

scripts/eval-select.ts --base origin/main selects no paid probes and no judges, so no evals ran.

Greptile Review

No Greptile comments.

Plan Completion

22 plan items: 14 done, 1 changed, 1 partial, 3 not done, 3 not verifiable from the repository.

  • Changed: "resources prints and exits 1 on a leftover" is the UBICLOUD: line at the end of run/verify, with no separate resources command.
  • Partial: a refused up still writes the random owner-id file (no VM carries it; fixing needs a second owner check at top level).
  • Not done, dropped with reasons: the lib/pregate/checks/lanes.ts UBI_OWNER=<code> prefix (lanes.ts:420 executes the obligation command, so a literal <code> would break it; the refusal carries the fix); the ship/sections/tests.md.tmpl sentence (it selected 24 paid probes plus the ship judge). CREW.md's REMOTE_PREGATE line is the Captain's edit.
  • Not verifiable here: notices to the truther, harness and Founderstar lanes before merge (relayed through GStack Minder), and failing-first order (one build commit).

Verification Results

Focused: test/ubicloud-runner.test.ts, test/ubicloud-pregate-remote.test.ts, test/spawnsync-timeout-tripwire.test.ts, test/skill-md-size-guard.test.ts and test/parity-suite.test.ts, 60 pass, 0 fail at 51af23e; the changed reap test fails on the earlier any-owner sweep. bun run typecheck clean, gen:skill-docs (default and codex) fresh, parity suite and skill size guard pass (at 1923151; nothing since touches their inputs). Local pregate at 51af23e: stage 1 pass, lanes requires-remote. Remote pregate at tree 0dbf99d5e107 with UBI_REAP=0: 18700 tests, 0 failed, $0.08. macOS and Windows lanes are cleared by dispatched CI runs at 51af23e (below).

TODOS

No TODO items completed in this PR.

Documentation

Status: current. No authored doc still claims the TTL-less legacy sweep covers every owner or untagged names; no edits were needed after 51af23e.

Scope: re-audit of garrytan/gst-118-no-zombie-vms at 51af23e against base 723b73e, focused on the owner-scoped TTL-less sweep in scripts/ubicloud/ubi-runner.sh (cmd_reap reaps TTL-less ubirun-<owner>-* VMs only when <owner> is the caller's UBI_OWNER; TTL-expired VMs of any owner are still reaped). Authored docs in scope: docs/ (excluding docs/designs), README.md, CONTRIBUTING.md, CLAUDE.md, AGENTS.md and ubicloud/; 80 files grep-scanned, sweep-relevant sections read in full.

Documentation health:

  • docs/TESTING_INTERNALS.md: Current (reaper paragraph names the caller's own ubirun-<UBI_OWNER>-* names and says another owner's or an untagged TTL-less VM is never reaped)
  • docs/skills.md: Current (/ubicloud section: "its own owner's VMs with no TTL once they are 4 hours old")
  • ubicloud/SKILL.md.tmpl and ubicloud/SKILL.md: Current (Step 1 states the owner scope; generated body in sync with the template)
  • docs/pregate.md: Current (owner requirement, PREGATE_REMOTE_OWNER_REQUIRED, left= failure; no sweep claim)
  • CONTRIBUTING.md: Current (UBI_OWNER listed as a prerequisite)
  • README.md, AGENTS.md, docs/PROJECT_STRUCTURE.md: Current (one-line "TTL + reaper" summaries, no owner-scope claim)
  • CLAUDE.md: Current (no Ubicloud sweep content)
  • CHANGELOG.md: Current, not edited (Unreleased entry already says only the caller's own TTL-less VMs are reaped)

Coverage: the owner-scoped sweep and UBI_LEGACY_HOURS have reference coverage (docs/TESTING_INTERNALS.md, runner --help) and how-to coverage (the /ubicloud skill, Step 1). No tutorial is needed for an operator knob. No new public surface lacks documentation.

Diagram drift: none; no diagram names the reaper.

Debt: minor wording only. In ubicloud/SKILL.md.tmpl, "(its TTL will reap it)" is loose for another owner's TTL-less VM; the next sentence corrects it. Optional tighten plus regeneration.

Test plan

  • UBI_REAP=0 UBI_OWNER=gsta164 gstack-pregate --stage tests --remote --spend-cap 2 --timeout 2700 --allow-repo-commands: 18700 tests, 0 failed, tree 0dbf99d5e107, UBICLOUD: left=0, nothing reaped
  • gstack-pregate --allow-repo-commands: stage 1 pass; lanes requires-remote (remote gate, macOS, Windows)
  • bun test test/ubicloud-runner.test.ts test/ubicloud-pregate-remote.test.ts test/spawnsync-timeout-tripwire.test.ts: 60 pass, 0 fail (with the size guard and parity suite)
  • Free Tests and Windows Free Tests dispatched at 51af23e (runs 41110395690 and 41110400344)

🤖 Generated with Claude Code

Refs GST-118, GST-324.

garrytan and others added 2 commits October 29, 2026 22:04
…UBICLOUD left line (GST-118)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 8 commits October 30, 2026 16:47
…s override, --keep, leak exit status, missing left= line)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ne via UBI_LEFT_FILE, pregate TTL from its deadline)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…d remote pregate

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…(GST-324)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ombie-vms

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@github-actions github-actions Bot changed the title fix(ubicloud): no zombie VMs: owner required, 3h TTL, legacy sweep, leftover line (GST-118) v1.91.341.0 fix(ubicloud): no zombie VMs: owner required, 3h TTL, legacy sweep, leftover line (GST-118) Oct 30, 2026
@capy-ai
capy-ai Bot merged commit 5532345 into main Oct 30, 2026
62 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