Repository navigation
v1.91.376.0 feat(ubicloud): reattach to a live verify VM and checkpoint tiers (GSTA-158 P3) - #3615
Merged
Merged
Conversation
…TA-158 P3) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
…m skill prose (GSTA-158 P3) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
3 tasks done
…while the VM TTL covers the run (GSTA-158 P3) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
ubi-runner runandverifynow survive a dead local runner. Their setup, command and tier phases run detached on the VM (~/.ubirun-<phase>.{out,err,pid,exit}), and a rerun of the same command reattaches to the live VM instead of paying for a new one.--enventry, each--passname plus a sha256 of its value (raw values are never stored), size, location, image, storage, origin/HEAD, tiers,--key-inputstrings and the runner's own sha256. The VM recomputes the tree after unpack and refuses a mismatch (UBI_VM_TREE_MISMATCH, exit 3).ubi-runner: reattached to <vm> created_at=<epoch> key=<k12>and continues from the first phase without an exit file (a finished setup is not rerun).UBI_ATTACH_BUSYwhen another live runner owns it; exit 125UBI_ATTACH_LOSTwhen the remote session died without a status.UBI_DETACHED: vm=… key=… reattach: rerun the same command, exit 129, VM left under its TTL. SIGKILL or a machine stop leaves the record and VM for the next same-key run. Reattach never extends a TTL.attach NAMEresumes a recorded run explicitly.run --probeprintsUBI_ATTACH_INFOand the tier plan without creating anything.--key-input Sadds caller inputs to the key..gstack/ubicloud.jsonacceptstiers: [{name, command}](UBI_CONFIG_TIERS_AND_COMMAND,UBI_CONFIG_TIER_NAME). Each tier is its own detached phase with write-once start/pass/fail checkpoints underUBI_CHECKPOINT_DIR/<run key>/, published under flock with a monotonic generation. Reruns printUBI_VERIFY_RESUME:per tier, reuse a pass younger thanUBI_CHECKPOINT_MAX_AGEwhose log re-hashes, hold a recorded fail until--rerun-failed(thenprior_failures), and honour--no-resume. A tier that edits the source gets no pass record (UBI_VERIFY_TREE_MOVED). The final line isUBI_VERIFY: tree= key= tiers= passed= reused= failed= prior_failures= saved_s=.--key-input, so a rerun ofgstack-pregate --stage tests --remotereattaches. spent= bills from the original created_at, and the wall budget subtracts minutes already billed (PREGATE_REMOTE_CAP_SPENT, exit 5;PREGATE_REMOTE_ATTACH_BUSY, exit 4). ThePREGATE_REMOTE:receipt grammar is unchanged; lib/pregate is untouched.ssh NAME COMMANDstays attached.Why
GSTA-158 P3 (autoplan-20261029035729, APPROVED gate rev 2): a Capy machine that sleeps or a runner that gets SIGKILLed lost a whole remote verify and left a paid VM running to its TTL.
Blast radius
scripts/ubicloud/ubi-runner.sh,scripts/ubicloud/pregate-remote.sh, their two test files,ubicloud/SKILL.md(.tmpl)anddocs/TESTING_INTERNALS.md. The fake ssh intest/ubicloud-runner.test.tsnow executes remote commands in a directory, so detached phases, tail --pid and pkill run for real.Real smoke on Ubicloud standard-2 (≈$0.01): SIGKILL the runner 30 s into a 90 s command, rerun, reattached and reported exit 5, VM destroyed.
Approvals
GSTA-158 plan approved by Garry (autoplan-20261029035729, gate rev 2); P3 shipping in parallel with P1 approved by GStack Minder.
Review fixes (pre-landing review, pass 1 + one fix-check)
PREGATE_VM_TREEandPREGATE_VM_TREE_BUILTafter a kill and no longer reports a falsePREGATE_REMOTE_TREE_MOVED.verifyreturns.Merge with main and re-plan (rule 19 grant, GStack Minder)
UBI_OWNERis required on creates, every generated VM carries-t<h>(default 3 h),run_teardownprints theUBICLOUD: left=line, and the legacy sweep reaps only the caller's own TTL-less VMs. A detach printsleft=1 … detached=1and--keepprintskept=1. pregate-remote keeps v1.91.341.0 fix(ubicloud): no zombie VMs: owner required, 3h TTL, legacy sweep, leftover line (GST-118) #3652's TTL'd VM names andUBI_LEFT_FILE.ttl_shortcompares the VM's remaining TTL (created_at plus-t<h>, minus now) with the run still to do plusUBI_REATTACH_MARGIN(900 s). The run still to do is theUBI_RUN_TIMEOUTbound of each unfinished phase, and 0 whenUBI_RUN_TIMEOUTis unset. When the TTL is too short, the runner printsUBI_REATTACH_TTL_SHORT: vm=… ttl_left=…s needs=…s (…), destroys that VM (its own run record, after theUBI_ATTACH_BUSYcheck), and starts a fresh VM that reuses the tier checkpoints.--probereportsnone … ttl_short, so pregate-remote agrees with the run.--srcandmake testunder P3's fake ssh, which really executes commands. Every VM test runs against the fake API.changelog.d/gsta158-ubi-reattach.md.ttl_shortcounts setup even after setup finished, which only biases toward a fresh VM; and a probe-to-run TTL flip makes pregate overstate spend.Review notes
Below the blocking floor (informational, test gaps); recorded here and not fixed in this PR.
ubi-runner.shrun key includes origin/HEAD, so agit fetchthat moves it defeats reattach and checkpoint reuse.ubi-runner.shvm_alivetreats a transient show error (timeout, 5xx) as absent, so a rerun starts a fresh VM and leaves the old one under its TTL (pregate's names have none). This matches pre-PR behaviour for any killed runner.pregate-remote.sh:197the probe and the real run decide reattach independently and repeat thebash ~/.pregate-run.shliteral the key hashes; the teardown hint keys off the probe.ubi-runner.shthe tree snapshot copies the index without preserving mtime (gstack-evidence can report FRESH after a source change (intermittent, load-dependent): evidence.test.ts allow-paths carve-out #2687 racy-git hardening); checkpoint copies use the default umask.ubi-runner.shdetached()duplicateswatched()'s watchdog loop;write_recordpersists RESUME/RERUN_FAILED redundantly.attach NAME,UBI_VM_TREE_MISMATCH,--keeprecord removal, probe-vs-run key equality, and the settled-verify teardown have no dedicated test; the HUP tests still sleep 500 ms after the phase start.docs/pregate.mdreason-code table lacksPREGATE_REMOTE_ATTACH_BUSYandPREGATE_REMOTE_CAP_SPENT;scripts/free-test-durations.jsonseeds ubicloud-runner.test.ts at 2.5 s (now ~140 s).Sibling trial merge
#3612 (P1) also edits
docs/TESTING_INTERNALS.md. Trial merge of 35deaa6 with #3612 head c86543f in a scratch worktree: git auto-merged with no conflict; flaky-run, context-budget and pregate-remote tests pass on the merge (68/68).