Skip to content

Conversation

@rgarcia
Copy link
Contributor

@rgarcia rgarcia commented Dec 24, 2025

Summary

Adds a --wait-for-agent flag to the exec command that allows the CLI to wait for the guest agent to become ready before executing commands.

Motivation

When a VM is still booting, the guest agent may not be ready immediately. Previously, hypeman exec would fail immediately if the agent wasn't responding. This was especially problematic for:

  • Newly started VMs
  • VMs running systemd images (which have longer boot times)
  • Scripts that run hypeman exec immediately after hypeman run

Changes

  • Added --wait-for-agent flag with a default of 30 seconds
  • The flag accepts seconds (e.g., --wait-for-agent=60 for 60 seconds)
  • Use --wait-for-agent=0 to fail immediately (old behavior)
  • Added wait_for_agent field to the exec request JSON

Usage

# Default: waits up to 30 seconds for agent
hypeman exec my-instance whoami

# Wait up to 60 seconds
hypeman exec --wait-for-agent=60 my-instance whoami

# Fail immediately if agent not ready
hypeman exec --wait-for-agent=0 my-instance whoami

Dependencies

This PR depends on the server-side support in:

The wait_for_agent field is passed to the exec endpoint, which will retry connecting to the guest agent on AgentConnectionError until the timeout expires.


Note

Introduces a configurable wait period for the guest agent before executing commands.

  • Adds --wait-for-agent CLI flag (default 30s; 0 to fail immediately) to exec command
  • Extends exec request with wait_for_agent field and sets it in handleExec based on the flag
  • No other behavior changes; existing flags and execution flow remain intact

Written by Cursor Bugbot for commit e1cd1f6. This will update automatically on new commits. Configure here.

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: onkernel/hypeman#50
Co-authored-by: raf <raf@onkernel.com>
@cursor
Copy link

cursor bot commented Dec 24, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@rgarcia rgarcia requested a review from sjmiller609 December 24, 2025 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants