From 26b23d0bf6a815d44d5bb9c30f2ba342c9404bb2 Mon Sep 17 00:00:00 2001 From: Rafael Garcia Date: Wed, 24 Dec 2025 12:12:41 +0000 Subject: [PATCH 1/2] feat: add --wait-for-agent flag to exec command By default, waits up to 30 seconds for the guest agent to become ready. This prevents immediate failures when the VM is still booting. Use --wait-for-agent=0 to fail immediately (old behavior). Depends on: https://github.com/onkernel/hypeman/pull/50 --- pkg/cmd/exec.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/pkg/cmd/exec.go b/pkg/cmd/exec.go index b0defbb..9e7d071 100644 --- a/pkg/cmd/exec.go +++ b/pkg/cmd/exec.go @@ -30,11 +30,12 @@ func (e *ExecExitError) Error() string { // execRequest represents the JSON body for exec requests type execRequest struct { - Command []string `json:"command"` - TTY bool `json:"tty"` - Env map[string]string `json:"env,omitempty"` - Cwd string `json:"cwd,omitempty"` - Timeout int32 `json:"timeout,omitempty"` + Command []string `json:"command"` + TTY bool `json:"tty"` + Env map[string]string `json:"env,omitempty"` + Cwd string `json:"cwd,omitempty"` + Timeout int32 `json:"timeout,omitempty"` + WaitForAgent int32 `json:"wait_for_agent,omitempty"` } var execCmd = cli.Command{ @@ -65,6 +66,11 @@ var execCmd = cli.Command{ Name: "timeout", Usage: "Execution timeout in seconds (0 = no timeout)", }, + &cli.IntFlag{ + Name: "wait-for-agent", + Usage: "Seconds to wait for guest agent to be ready (0 = fail immediately)", + Value: 30, // Default: wait up to 30 seconds for agent + }, }, Action: handleExec, HideHelpCommand: true, @@ -126,6 +132,7 @@ func handleExec(ctx context.Context, cmd *cli.Command) error { if timeout := cmd.Int("timeout"); timeout > 0 { execReq.Timeout = int32(timeout) } + execReq.WaitForAgent = int32(cmd.Int("wait-for-agent")) reqBody, err := json.Marshal(execReq) if err != nil { From e1cd1f620ae3d407f9f3a26c665e5c567df8d217 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 24 Dec 2025 12:20:57 +0000 Subject: [PATCH 2/2] Fix: Make WaitForAgent a required field in execRequest Co-authored-by: raf --- pkg/cmd/exec.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cmd/exec.go b/pkg/cmd/exec.go index 9e7d071..9a72a96 100644 --- a/pkg/cmd/exec.go +++ b/pkg/cmd/exec.go @@ -35,7 +35,7 @@ type execRequest struct { Env map[string]string `json:"env,omitempty"` Cwd string `json:"cwd,omitempty"` Timeout int32 `json:"timeout,omitempty"` - WaitForAgent int32 `json:"wait_for_agent,omitempty"` + WaitForAgent int32 `json:"wait_for_agent"` } var execCmd = cli.Command{