Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix: review fixes (empty-project tests pin vm_rows' blank-row skip; CHANGELOG cites GST-573 and counts six new and two updated cases)

garrytan6ef2979d29e5
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 645924a501..6692b1297a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -40,7 +40,7 @@ identifiers and attribution are available in the pre-removal Git revision
- `scripts/pregate-remote-gate.sh`: `--list` refuses (no inventory) for a tree that changes `test.yml`, `e2e.yml`, `ci-reuse.ts`, `ci-full-suite-tree.sh`, `ci-executed-counts.ts` or `lib/gh-issue.ts` relative to `origin/master`, when there is no `origin/master`, and under `GBRAIN_PREGATE_REUSE=0`. The reuse path and `--list` share one check. `test/scripts/pregate-remote-gate.test.ts` pins this.
- `docs/ci-event-parity.md`: the profiles and the refusal.
-**`ubi-runner.sh reap` now destroys only the caller's own VMs, and pack, usage and reap work on macOS and on an empty project (gstack #3756, #3746).** Reap used to destroy any owner's VM whose TTL had ended. That is how one project's `up` destroyed another lane's VMs (GST-324). Now it destroys only VMs whose owner tag equals `UBI_OWNER` and logs `reap: left N expired VMs of other owners` for the rest. The operator reaper, `reap-expired.ts`, still covers every owner. gbrain keeps `UBI_REAP=0` by default, so `up` still reaps nothing unless asked. On macOS, `pack` exited 1 under bsdtar after the VM was already created. On a project with no VMs, Ubicloud's bare-newline list read as a VM named `-`, and reap died on it. A failed size read made `usage` print a short total, which the quota preflight took as room.
+**`ubi-runner.sh reap` now destroys only the caller's own VMs, and pack, usage and reap work on macOS and on an empty project (gstack #3756, #3746).** Reap used to destroy any owner's VM whose TTL had ended. That is how one project's `up` destroyed another lane's VMs (GST-573). Now it destroys only VMs whose owner tag equals `UBI_OWNER` and logs `reap: left N expired VMs of other owners` for the rest. The operator reaper, `reap-expired.ts`, still covers every owner. gbrain keeps `UBI_REAP=0` by default, so `up` still reaps nothing unless asked. On macOS, `pack` exited 1 under bsdtar after the VM was already created. On a project with no VMs, Ubicloud's bare-newline list read as a VM named `-`, and reap died on it. A failed size read made `usage` print a short total, which the quota preflight took as room.
### Itemized changes
@@ -50,7 +50,7 @@ identifiers and attribution are available in the pre-removal Git revision
- `cmd_usage` exits 1 with no total when the list or a size read fails, and skips a VM whose `show` answers 404.
- `quota_preflight` retries an unreadable usage while `UBI_QUOTA_WAIT` lasts, then logs it and leaves the decision to the API.
- `cmd_pack` builds `files.tar`, appends `.git` with `tar -rf` and gzips it, with `COPYFILE_DISABLE=1` on every tar call.
-- `test/scripts/ubi-runner-run.test.ts` and `test/scripts/ubi-runner.test.ts` pin the owner-scoped reap, the empty project, the unreadable usage and `COPYFILE_DISABLE`. All eight new cases fail on the old runner. The reap cases that expected another owner's VM destroyed now expect it kept.
+- `test/scripts/ubi-runner-run.test.ts` and `test/scripts/ubi-runner.test.ts` pin the owner-scoped reap, the empty project, the unreadable usage and `COPYFILE_DISABLE`. The six new cases and the two updated reap cases fail on the old runner. The updated cases expected another owner's VM destroyed and now expect it kept.
- `test/scripts/ubi-runner-bsd-userland.test.ts` runs `pack` under bsdtar. It fails on the old runner and is skipped where no bsdtar is installed. `test/helpers/mock-ubicloud-api.ts` gains `listBody`, `ghosts` and a `show` fault.
- `scripts/ubicloud/README.md`: reap's owner scope.
diff --git a/scripts/ubicloud/README.md b/scripts/ubicloud/README.md
index 46e907c0d8..9ecb4256df 100644
--- a/scripts/ubicloud/README.md
+++ b/scripts/ubicloud/README.md
@@ -44,7 +44,8 @@ two-hour TTL (`--ttl-hours N` changes it, up to 999). `ubi-runner.sh up` and
`-t<H>`, and a `ubirun-` name without a TTL is refused (nothing could ever reap it).
`ubi-runner.sh reap` destroys only the caller's own VMs: its `ubirun-<owner>-*`
VMs whose TTL ended over ten minutes ago, and its TTL-less ones once they are
-`UBI_LEGACY_HOURS` (4) old. Another owner's expired VM is only counted in reap's
+`UBI_LEGACY_HOURS` (4) old. Another owner's expired VM, including one this machine
+created under a different tag (which `list --mine` and `gc` do cover), is only counted in reap's
log; `reap-expired.ts` is the operator reaper that destroys expired VMs of every owner. gstack's `up` runs that reap first; gbrain's copy
does only with `UBI_REAP=1` (or `true`, `yes`, `on`; `0`, `false`, `no` and `off`
turn it off, and any other value is refused), and logs one `reap skipped` line otherwise, until
diff --git a/test/scripts/ubi-runner-run.test.ts b/test/scripts/ubi-runner-run.test.ts
index 3763a42006..91020e70ac 100644
--- a/test/scripts/ubi-runner-run.test.ts
+++ b/test/scripts/ubi-runner-run.test.ts
@@ -639,6 +639,7 @@ describe("quota preflight", () => {
const up = await run(["up"], { UBI_REAP: "1" });
expect(up.stderr).toContain("reap: no expired VMs");
expect(up.stderr).not.toContain("invalid VM name");
+ expect(up.stderr).not.toContain("expired VMs of other owners");
expect(up.stderr).not.toContain("reap failed");
expect(creates()).toHaveLength(1);
}, 60_000);
diff --git a/test/scripts/ubi-runner.test.ts b/test/scripts/ubi-runner.test.ts
index f3d593f4bc..1edd8811f7 100644
--- a/test/scripts/ubi-runner.test.ts
+++ b/test/scripts/ubi-runner.test.ts
@@ -253,6 +253,7 @@ describe("empty project and unreadable usage", () => {
const reap = await run(["reap"], { UBI_OWNER: "t1" });
expect(reap.stderr).toContain("reap: no expired VMs");
expect(reap.stderr).not.toContain("invalid VM name");
+ expect(reap.stderr).not.toContain("expired VMs of other owners");
expect(reap.code).toBe(0);
const usage = await run(["usage"], { UBI_OWNER: "t1" });
expect({ code: usage.code, stdout: usage.stdout }).toEqual({ code: 0, stdout: "OWNER VMS VCPUS\ntotal 0 0\n" });