Skip to content

v1.92.41.0 fix(ubicloud): pack and usage on macOS, reap and up on an empty project (#3680, #3679, #3678) - #3746

Merged
capy-ai[bot] merged 7 commits into
mainfrom
gsta210/ubicloud-macos-empty-project
Nov 1, 2026
Merged

capy-ai[bot] merged 7 commits into
mainfrom
gsta210/ubicloud-macos-empty-project

Conversation

@garrytan

@garrytan garrytan commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3746,
  "head": "14e754f6fb7486d1af6cf48b8ebaa9ec42334a9b",
  "version": "1.92.30.0",
  "base": "main",
  "gate": {
    "ubicloud": {
      "pass": 75,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "head_tree": "8ee5ae170b2372dfabbdc1b347168b4caac7dca2",
  "product_patch_id": "40b294248f7ac8c9a71c854e49c1f6f2206bfab0",
  "gstack_version": "1.92.1.0",
  "review_depth": {
    "depth": "standard",
    "class": "code",
    "runtime_lines": 56,
    "rules": "150435b0a543019a",
    "base": "83ae96e086dede0235aa80139d93249f40b215e4",
    "registry": "83ae96e086dede0235aa80139d93249f40b215e4",
    "gate_scan": {
      "tagged": 0,
      "head": "14e754f6fb7486d1af6cf48b8ebaa9ec42334a9b"
    },
    "reasons": [
      "runtime=56>50"
    ]
  },
  "pregate": "requires-remote cleared @8ee5ae170b23 (1 checks, current for 14e754f6fb74)",
  "requires_remote": [
    "windows-free-tests.yml/windows-free-shard: https://github.com/garrytan/gstack/actions/runs/41316917146",
    "pregate.json/remote_gate: remote-gate tree=8ee5ae170b23 tests=392"
  ],
  "issues": {
    "fixes": [
      3678,
      3679,
      3680
    ],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "docs/, ubicloud/, README.md (docs/TESTING_INTERNALS.md updated)"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 2,
    "fixed": 1,
    "scope": "frozen",
    "dispatches": {
      "specialist": 1
    }
  }
}

What changed

gstack-ubi on a real Mac (Dyson Sphere, macOS 27.0.1): pack, usage and reap fail on main and work on this branch

gstack-ubi on a real Mac (Dyson Sphere, macOS 27.0.1): pack, usage and reap fail on main and work on this branch.

Before/after as text: gstack-ubi on a real Mac (Dyson Sphere, macOS 27.0.1): pack, usage and reap fail on main and work on this branch
--- Before · before.txt · captured output
+++ After · after.txt · captured output
+$ gstack-ubi pack .   # same Mac, same repo
+exit=0; extracted git status matches the source:  D gone | A  staged | ?? untracked
+0 AppleDouble ._* entries (GNU tar on the VM side extracts the same tree)
+
+$ gstack-ubi usage
+OWNER           VMS  VCPUS
+(other)           1     16
+lane7             1      4  (you)
+total             2     20
+exit=0
-$ gstack-ubi pack .   # macOS 27.0.1, /usr/bin/tar (bsdtar 3.5.3)
-tar: untracked: Cannot stat: No such file or directory
-tar: a: Cannot stat: No such file or directory
-exit=1; archive holds only .git; extracted: D a | D gone | D link | AD staged
 
+$ gstack-ubi up -s standard-4   # UBI_QUOTA_VCPUS=16, 20 in use
+quota preflight refused ...: it needs 4 vCPUs and the project's VMs already use 20 of 16
+create requests sent: 0
-$ gstack-ubi usage   # /usr/bin/awk 20200816, 2 VMs
-awk: syntax error at source line 4
- context is ... cpu[o], o >>>  == <<<
-exit=2   (the vCPU quota check reads no total and lets every create through)
 
 $ gstack-ubi reap    # a project with no VMs
+ubi-runner: reap: no expired VMs
+exit=0
-ubi-runner: reaping expired ./- (owner -; its TTL ended 29891208 min ago)
-ubi-runner: invalid VM name '-'
-exit=1   (every up runs reap first, so up dies too)
 

Why

"On macOS, gstack-ubi pack exits 1, so sync (and every run/verify that syncs) fails" (#3680). The same Mac's awk rejected one line of usage, which also turned the vCPU quota check off (#3679), and on any machine a Ubicloud project with no VMs made reap and every up die with invalid VM name '-' (#3678). Now a Mac user can sync and run on Ubicloud, the quota check works there, and a fresh project can start its first VM.

Blast radius

Only scripts/ubicloud/ubi-runner.sh changes behavior: pack (used by sync, run, verify and the remote pregate), vm_rows (feeds reap, gc, list, usage and teardown), usage and the quota preflight. What makes it safe: the whole runner suite passes under both GNU and BSD userlands (script ran: 75 tests with GNU tools, 52 with bsdtar 3.7.2 and original-awk on PATH), the remote pregate ran this branch's pack and VM lifecycle end to end on Ubicloud (226 tests, 0 failed, VM destroyed), and a no-VM smoke ran main and this branch side by side on a real Mac (repro).

Approvals

Date Asked Exact words Outcome Covers Still pending
2026-10-31 Approve the plan "Ubicloud runner on macOS and empty projects: #3680, #3679, #3678" (autoplan run ap-20261031175212, 2 decisions) “Approved: do it (A1: keep the order, local + real-Mac proof, CI listing handed to GSTA-203 after merge; B1: plan as reviewed with the four High findings folded in).” (GStack Minder, relayed by agent:GSTA-210) approved the reviewed plan (sha256 ffe53e3fc787), every recommendation taken none

Source: gstack-approvals record for gsta210/ubicloud-macos-empty-project (display only; not an approval citation).

Summary

Three bugs reported by Jared, each reproduced on main 5ba425a before the fix with a test that fails there:

  • ubicloud: pack (and so sync/run) fails on macOS bsdtar #3680, pack on macOS. bsdtar stops reading options at the first operand and resolves -T names after a -C, so no single tar command line works on both tars. Pack now builds files.tar from the file list, appends the .git snapshot with tar -rf, and gzips it, all chained with && so a failure leaves no partial stream. COPYFILE_DISABLE=1 stops Apple's tar from adding ._* AppleDouble entries: checked on the Mac, a file with an extended attribute packs as ._a plus a without it (GNU tar extracts both) and as a alone with it.
  • ubicloud: usage is an awk syntax error on macOS, which also disables the vCPU quota preflight #3679, usage on macOS. The ternary inside printf's argument list is parenthesized, which every awk accepts. usage also stops reporting a partial count as the project's usage: it exits 1 when the VM list or a size read fails, and it skips a VM that 404s because it was destroyed between the two reads. The quota preflight retries an unreadable usage while UBI_QUOTA_WAIT has time left, then logs that it could not read usage and leaves the decision to Ubicloud's own refusal.
  • ubicloud: reap and up die with "invalid VM name '-'" on a project with no VMs #3678, empty project. Ubicloud answers vm list on an empty project with a bare newline; vm_rows now skips a row with no name, so nothing downstream sees a VM called -.

Security read (crew rule for outside code): Jared's issues carried proposed diffs; they were read as text and rewritten here, and none of his scripts ran. The change adds no network call, no new environment or secret read, no permission change, no workflow, setup or install edit and no dependency. COPYFILE_DISABLE is an Apple tar switch that other tars ignore.

Test Coverage

All new code paths have test coverage. Regression proof: each new case fails at 5ba425a (or at the previous commit for the review fixes) and passes at this head.

  • test/regression-issue3680-ubicloud-bsd-userland.test.ts (new): pack under real bsdtar (tracked, staged, deleted, untracked, symlinked, spaced and option-like names, a linked worktree, an empty file list) and usage plus the quota refusal under the one-true-awk. It runs where those tools exist (macOS by default; Linux with libarchive-tools and original-awk) and skips with the package name elsewhere, so Linux CI does not run it yet; see Review notes.
  • test/ubicloud-runner.test.ts: an empty project for reap, usage and list --mine; up on an empty project; every pack tar runs with COPYFILE_DISABLE=1; usage on an unreadable list or size, a VM destroyed since the list, and the preflight's log and wait retry.

Tests ran: ubicloud 75

Pre-Landing Review

Pass 1 (specialist batched, Red Team at light depth) found 2 informational findings; the vanished-VM race was fixed in the diff and fix-checked, the CI-coverage gap is a handoff. Step 11's native adversarial pass found 3 low, non-blocking findings: the quota wait now retries an unreadable usage (fixed, fix-checked with no findings), the 404-means-destroyed reading is noted below, and the uncompressed staging copy is the plan's approved decision 1.

REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=2 fixed=1 scope=frozen dispatches=1
(The Step 9 row above was logged before Step 11; Step 11 added one more fix, the quota wait retry, checked by a second fix-check with no findings.)
Gate edits: none detected (5 listed, 1 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)
Outside review: not run (code class, no numeric claims); the Eng and CEO plan reviews had a GPT-6.1 Sol outside voice.

Review notes

  • BSD cases skip in Linux CI (testing, informational). Neither bsdtar nor original-awk is on the Linux runners, and the macos-named-regressions job lists files explicitly. Handoff: GSTA-203 (owner of .github/workflows) adds test/regression-issue3680-ubicloud-bsd-userland.test.ts to that list after merge.
  • A failed size read now prints curl's own error line on stderr (fix-check, informational); the VM still counts as unread and usage still exits 1.
  • Any 404 on vm show counts as destroyed (adversarial, low). Ubicloud answers 404 for a name the project no longer has; a routing 404 would also break every other runner command for that VM.
  • Pack stages one uncompressed copy of the archive in $TMPDIR (adversarial, low): the approved plan's decision 1; it fails closed on a full disk.
  • Outside this PR, urgent: reap destroys any owner's expired-TTL VM, which the owner-scoped-deletes rule forbids. Tracked as GST-573 and fixed in the PR stacked on this one.

Plan Completion

Plan: autoplan run ap-20261031175212 (CEO + Eng, one round, approved by GStack Minder "do it"). Every plan item is done; the four High review findings folded into the build are done (COPYFILE_DISABLE, usage failure exit, whole runner suite under BSD tools, real-Mac smoke).

Issues

Fixes #3678
Fixes #3679
Fixes #3680

Verification Results

  • Merged main 83ae96e (v1.92.30.0) at 14e754f under GStack Minder's rule 19 grant. v1.92.30.0 test(free): split files over the 60 s seed ceiling and the Windows doctor file, then reseed (GSTA-151 A) #3585 had split test/ubicloud-runner.test.ts, so this branch's four tests moved unchanged into test/ubicloud-runner.test.ts and test/ubicloud-runner-verify-quota.test.ts, and the fake API's list/show change moved into test/helpers/ubi-runner-fake-vm.ts. The runner, docs, changelog and BSD test diffs are byte-identical to before the merge, so the review carries (rule 30(b)).
  • After the merge: the eight ubicloud test files ran 75 pass, 0 fail; the BSD-shim run 33 pass; free-seed and module-size ratchets 19 pass; remote pregate at tree 8ee5ae170b23 ran 392 tests, 0 failed, UBICLOUD: left=0; Windows Free Tests run 41316917146 succeeded.
  • Remote pregate on Ubicloud at tree 1732eb634221 (UBI_REAP=0, owner gsta210): 226 tests, 0 failed, spent $0.05, UBICLOUD: left=0.
  • windows-free-tests dispatched at 8d8a3cc: https://github.com/garrytan/gstack/actions/runs/41235221239 (success).
  • Real Mac (macOS 27.0.1, bsdtar 3.5.3, awk 20200816, bash 3.2.57), no VM and no API key: main pack exit 1 / branch exit 0 with matching git status; main usage awk error / branch table; branch up refuses at 20 of 16 vCPUs with 0 create requests; main reap invalid VM name '-' / branch no expired VMs.

TODOS

No TODO items completed in this PR.

Documentation

Scope: the diff 5ba425a..fe2eb4b (ubi-runner.sh pack/vm_rows/usage/quota preflight, two test files, one changelog fragment), checked against docs/TESTING_INTERNALS.md, docs/pregate.md and ubicloud/SKILL.md.tmpl. Result: added one sentence to the Ubicloud runner paragraph of docs/TESTING_INTERNALS.md saying the quota preflight now retries an unreadable usage within UBI_QUOTA_WAIT, then logs and defers to the API, and that usage exits 1 on an unreadable list or size and skips a VM that 404s. The macOS bsdtar pack fix and the empty-project vm_rows fix are internal behavior with no documented contract, so no doc change. docs/pregate.md only mentions quota in failure classification, which is unaffected. Debt: ubicloud/SKILL.md.tmpl and its generated SKILL.md could mention the quota retry behavior; skipped because it needs regeneration.

Test plan

  • bun test test/ubicloud-runner.test.ts test/regression-issue3680-ubicloud-bsd-userland.test.ts test/ubicloud-pregate-remote.test.ts test/spawnsync-timeout-tripwire.test.ts: 75 pass, 0 fail
  • Same runner files with tar -> bsdtar 3.7.2 and awk -> original-awk first on PATH: 52 pass, 0 fail
  • bun run typecheck: no errors
  • Remote pregate (Ubicloud, UBI_REAP=0): 226 tests, 0 failed

garrytan and others added 5 commits October 31, 2026 19:06
…3678)

pack builds its archive in two tar passes plus gzip, which bsdtar and GNU
tar both accept, with COPYFILE_DISABLE=1 so Apple's tar adds no ._* files.
vm_rows skips the blank row Ubicloud returns for a project with no VMs.
usage parenthesizes its ternary for the one-true-awk and exits 1 on an
unreadable list or size; the quota preflight logs that and defers to the API.

Co-authored-by: Jared <[email protected]>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ist; spawn timeout)

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>
…path

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

trunk-io Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits November 1, 2026 14:29
Rule 19 grant (GStack Minder). #3585 split test/ubicloud-runner.test.ts; the
four tests this branch added move unchanged into test/ubicloud-runner.test.ts
and test/ubicloud-runner-verify-quota.test.ts, and the fake API's list/show
change moves into test/helpers/ubi-runner-fake-vm.ts.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@github-actions github-actions Bot changed the title fix(ubicloud): pack and usage on macOS, reap and up on an empty project (#3680, #3679, #3678) v1.92.41.0 fix(ubicloud): pack and usage on macOS, reap and up on an empty project (#3680, #3679, #3678) Nov 1, 2026
@capy-ai
capy-ai Bot merged commit 74836e4 into main Nov 1, 2026
72 of 74 checks passed
garrytan added a commit that referenced this pull request Nov 1, 2026
Rule 19 grant (GStack Minder), after #3746 landed as v1.92.41.0. #3585 split
test/ubicloud-runner.test.ts; this branch's test edits move unchanged into
test/ubicloud-runner.test.ts, -run and -verify-quota. The #3746 changelog
fragment is dropped: main already carries it in CHANGELOG.md.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant