Repository navigation
feat(readiness): probe the guest agent + domain state BEFORE the sshd wait - #18
Conversation
… wait
The prepare-venue flow waited on sshd with a blind 30m cap, so a CRASHED /
shut-off / absent domain burned the entire cap and then failed with a generic
'timeout'. RCA: there was no boot signal earlier than sshd, and no way to tell
'still booting' from 'will never be ready'.
Fix: a NEW (c0) readiness gate that runs FIRST:
- invokes the vm plugin's new internal 'guest-ping' op (verb:libvirt), which
checks the DOMAIN STATE and then pings the qemu-guest-agent;
- a TERMINAL domain (crashed / shut off / absent / unreachable) returns
ErrPollFatal so the poll aborts on the FIRST probe — a dead domain is
detected in seconds, not after 30 minutes;
- a merely booting guest (domain running, agent not yet connected) stays
transient and keeps polling;
- only a READY agent proceeds to the sshd wait, which is a strictly weaker
signal (it needs sshd config + firewall + key delivery on top of a booted OS).
The gate is DATA-DRIVEN: it is skipped unless the VM entity declares the
guest-agent channel (structured channels:, or a raw libvirt.snippets: string) —
this plugin serves every repo's VM deploys, so an unconditional wait would
deadlock a guest that has no agent.
Coverage (R7): TestWaitGuestAgent_TerminalDomainHardFails proves a terminal
domain aborts after ONE probe with ErrPollFatal; _BootingIsTransient proves a
live guest keeps polling; _ReadyReturnsNil the happy path; and
TestDeclaresGuestAgentChannel pins the data-driven gate.
Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Blocks
Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
[step: review]Review — BLOCKHead SHA: Blocks
Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
… name LIVE-CAUGHT by the R10 bed check-guest-agent-vm: the gate looked up `"charly-"+in.Alias` — but in.Alias IS ALREADY the domain name (kit.VmSshAlias(domainID) == "charly-"+domainID, the same convention the domain/disk/state dir use). The double prefix looked up a non-existent `charly-charly-<id>` and reported a RUNNING domain as absent: wait-for-guest-agent: ... domain "charly-charly-check-guest-agent-vm" is absent The terminal-abort path worked (fast 21s fail, not a 30m cap), but the verdict was wrong. With the fix the bed passes end to end: [deploy-add] PASS 27.675s (the gate runs) [check-live] PASS 11.756s (check the guest agent answers [ga-ping] agent responsive) [check-live-rebuild] PASS 9.347s (R10 fresh-rebuild) check-guest-agent-vm: PASS (steps=11) Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Blocks
Comments considered
Placement (B16): Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
[step: review]Review — BLOCKHead SHA: Blocks
Comments considered
Placement (B16): Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
Review — PASSHead SHA: Security screen: PASS — untrusted PR content only; no secrets/egress/ Checklist: All applicable rules PASS or NA.
Comments considered:
Verdict: PASS opencode/deepseek-v4.1-flash — action-review. |
[step: review]Review — PASSHead SHA: Security screen: PASS — untrusted PR content only; no secrets/egress/ Checklist: All applicable rules PASS or NA.
Comments considered:
Verdict: PASS opencode/deepseek-v4.1-flash — action-review. |
Review — PASSHead SHA: Security screen: PASS — diff is confined to Checklist: All applicable rules PASS or NA — A1–A3 (body accounts for both changed files; change-class gate Comments considered:
Verdict: PASS opencode/deepseek-v4.1-flash — action-review. |
[step: review]Review — PASSHead SHA: Security screen: PASS — diff is confined to Checklist: All applicable rules PASS or NA — A1–A3 (body accounts for both changed files; change-class gate Comments considered:
Verdict: PASS opencode/deepseek-v4.1-flash — action-review. |
Summary
The VM deploy's
prepare-venuewaited on sshd with a blind 30-minute cap. Acrashed / shut-off / absent domain therefore burned the entire cap and then failed with a
generic
absolute cap exceeded— with no indication the domain was dead the whole time.RCA (R1)
Measured on
check-omarchy-eval-edge-inst:deploy-addran 30m55s and failed withwhile the domain had never booted. There was no boot signal earlier than sshd and no way
to distinguish "still booting" from "will never be ready", so the poll could only exhaust its
cap.
Fix — probe the guest agent + domain state FIRST
A new
(c0)readiness gate runs before the SSH bootstrap, invoking the vm plugin'sguest-pinginternal op (over theverb:libvirtOpRunreverse channel — the same pathplugin-preempt / plugin-ssh / plugin-substrate use), which checks the domain state and, only
if running, pings the qemu-guest-agent (which answers only once the guest OS is up — a real
boot signal, strictly stronger than sshd):
ErrPollFatal, so the pollaborts on the FIRST probe (a dead domain is detected in seconds, not after 30 minutes);
ErrPollFatalwith the cause, NOT masked as "still booting" (the masking the RCA names);The gate is data-driven: skipped unless the VM entity declares the guest-agent channel
(structured
channels:, or a rawlibvirt.snippets:string) — this plugin serves every repo'sVM deploys, so an unconditional wait would deadlock a guest that has no agent.
Dependency: the op (
guest-ping) ships inopencharly/plugin-vm#35. Per the B15 landingorder that op PR lands FIRST; this PR was then re-derive-validated against the op's merged
behaviour (the live run below serves the op compiled into the host binary).
How tested
Live R10 bed —
check-guest-agent-vm, COMPLETE PASS (steps=11)A disposable bed (
disposable: true,lifecycle: dev) ineval-omarchyclones the freshinstrumented base golden (
from: check-omarchy-eval-base-inst:golden), declares the guest-agentchannel, and probes it. Run with the changed plugin served via
CHARLY_REPO_OVERRIDE(theoverride is visible in the deploy log):
The live bed CAUGHT A REAL BUG (the value of running it)
The first live run failed — and correctly so:
The gate had double-prefixed the domain name:
in.Aliasis already the libvirt domain(
kit.VmSshAlias(domainID) == "charly-"+domainID), so"charly-"+in.Aliaslooked up anon-existent
charly-charly-<id>and reported a RUNNING domain as absent. The terminal-abortpath worked (fast 21s fail, not a 30m cap — the fix's whole point), but the verdict was wrong.
The second commit fixes it; the PASS above is the post-fix run. This is exactly the class a
unit test cannot catch and a live bed does.
Coverage (R7) — fails on the pre-change source
TestWaitGuestAgent_TerminalDomainHardFailsdrives the REALvmshared.PollUntiland proves aterminal state aborts after exactly one probe with
ErrPollFatalin < 5s (not the cap).TestWaitGuestAgent_ProbeFailureIsFatalproves an unmade probe isErrPollFatalat once —fails on the masking version:
TestWaitGuestAgent_BootingIsTransient(a still-booting guest keeps polling),TestWaitGuestAgent_ReadyReturnsNil, andTestDeclaresGuestAgentChannel(the data-drivengate: channel-bearing VM gated, channel-less VM not).
Rulebook compliance
surfaced and RCA'd the double-prefix bug before landing.
opencharly/plugin-vm#35(separate repo), and the liverun is re-derived against the op's merged behaviour.
vmshared.PollUntil+ErrPollFatal, not a newsleep/retry loop.
CHARLY_REPO_OVERRIDE; the host binary was rebuiltfrom the final tree (
2026.260.9999) for the run.fresh-rebuild → check-live-rebuild → cleanup on the final tree;
ok: true, zero errors.SDD note (the
vmGuestAgentStatedecode)The gate's reply decode (
vmGuestAgentState,json.Unmarshal) is a hand-written consumerstruct for the vm plugin's internal-op reply. The
guest-pingrequest rides the CUE-sourcedspec.VmPluginEnv(the shared#VmPluginEnvdef). Internal-op replies are decoded by fieldname at every existing consumer —
plugin-preempt(var st struct{ Running bool }),plugin-substrate,plugin-ssh— because they are versioned with the serving plugin, not partof the authored-config contract (
#VmResolveResultis the one reply promoted to CUE, for thegraphics-endpoint path). This consumer follows that established shape; promoting it to CUE would
require a coordinated
specchange landing before this PR and is not needed for aplugin→plugin reply whose producer ships in the companion PR.
Change classification
Plugin Go code — venue readiness. Verification gate:
gofmt/go vet/go testplus the live R10bed
check-guest-agent-vm. Attribution tier:fully tested and validated.Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)