feat(cli): wait for ssh on up; tell booting from failed - #157
Merged
Merged
Conversation
|
Warning Review limit reachedNext included review available in 16 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (23)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
up now blocks until sshd answers and recipe health checks pass when stdout is not a terminal or under --json, or with --wait; --no-wait opts out. up on a running VM and down on a stopped VM exit 0. wait draws elapsed time on a terminal's stderr. sshx.Run returns ErrUnreachable when ssh exits 255 with its own connection error, so a booting VM is no longer reported as a command that exited 255. The CLI says the VM is booting and to run stoat wait; MCP returns cannot_reach with call wait first. cp maps scp's connection errors the same way. MCP wait defaults to 300s. MCP exec returns partial output with timed_out=true on timeout and runs the command under the guest's timeout so the remote process ends too. Signed-off-by: NovusEdge <novusedge0@gmail.com>
NovusEdge
force-pushed
the
qol/readiness
branch
from
September 29, 2026 18:30
9406bec to
c89cbd8
Compare
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
stoat upblocks until sshd answers, then until applied recipes' health checks pass, when stdout is not a terminal, under--json, or with--wait.--no-waitopts out.--no-applyskips the health part.upon a running VM anddownon a stopped VM print "already running" / "already stopped" and exit 0.up --waiton a running VM still waits.rmon a missing VM still exits 1.stoat waitredraws an elapsed-time line on stderr when stderr is a terminal (not under--jsonor-q).sshx.Runreturnssshx.ErrUnreachablewhen ssh exits 255 and its stderr is a connection failure (refused, banner exchange timeout, no route, reset, closed). A command that exits 255 on its own stays a result. The error maps to the existingcannot_reachcode. All guest tools that go throughsshx.Runget this.exec,cpandsshsay<vm> is booting; run stoat wait <vm>.cpuses the same stderr check on scp output.sshprobes for a banner for up to 3s before it replaces the process.ErrUnreachableend withcall wait first.waitdefaultstimeout_secondsto 300 (cap stays 600), stated in the schema and docs.execreturns partial stdout/stderr withtimed_out: trueand a message pointing atexec_bginstead of atimeouterror. The command now runs under the guest'stimeout -s KILL <n>when the guest hastimeout, because killing the local ssh alone leaves the remote process running.wire.CommandResultgains optionaltimed_outandmessagefields.docs/reference/cli.md,docs/reference/mcp.md,docs/troubleshooting.md.Existing tests that pinned
downon a stopped VM as an error now expect success.TestFanOutStopsAtTheFirstErrorusesrmfor its failing step, sincedownno longer fails there.Needs a live check
No VM was booted for this PR; the tests use fake ssh and fake running VMs. Please verify on a real guest (label
needs-live-boot):stoat up x | catblocks until ssh works and an immediatestoat exec x truesucceeds.stoat up --no-wait x && stoat exec x trueprints the booting hint and exits 1.sshx.transportMarkersmatch what the installed OpenSSH prints for a real booting guest.timeout -s KILLexists and ends the command on alpine (busybox) and a cloud image. Busyboxtimeoutmay not kill grandchildren of a shell.stoat ssh xon a booting VM prints the hint; on a ready VM it opens the session with no visible delay.stoat wait xdraws the progress line on a real terminal and clears it.Checks
go test ./...,golangci-lint run ./...(0 issues), gofmt andgo vetpass.shellcheckis not installed here and no shell files changed.go test -raceon sshx, mcpsrv and cli passes; core'sTestStartAndStopPropagateTheProvidersErrorfailed under race only because the host had 476 MB free and the memory guard refused the fake start. It passes without-race.