Skip to content

Add Windows guest control and ConPTY - #431

Open
sjmiller609 wants to merge 7 commits into
hypeship/windows-imagesfrom
hypeship/windows-guest-control
Open

Add Windows guest control and ConPTY#431
sjmiller609 wants to merge 7 commits into
hypeship/windows-imagesfrom
hypeship/windows-guest-control

Conversation

@sjmiller609

@sjmiller609 sjmiller609 commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

summary

  • cross-compile the guest agent as a Windows LocalSystem service
  • listen through the virtio-win VioSock provider while retaining the existing gRPC protocol
  • add SYSTEM and active-desktop execution sessions
  • add ConPTY terminal allocation and resize handling
  • support Windows file copy, stat, readiness, and graceful shutdown
  • bind command trees to kill-on-close Job Objects and terminate them synchronously
  • promote Windows instances to Running when guest-agent readiness is proven
  • move guest-service protocol and lifecycle rationale into lib/system/README.md

targeted tests

  • guest, guest-agent, and Windows readiness unit tests
  • Windows guest-agent cross-compilation

Additional terminal signal-parity work is intentionally deferred. Long-running KVM and full CI suites were not run for this review pass.


Note

High Risk
Touches guest command execution, Windows token impersonation for desktop sessions, vsock transport, and process-tree kill semantics. Bugs here can leak processes, run commands as the interactive user, or break instance readiness.

Overview
Windows guests now run the same vsock gRPC guest protocol as Linux. The agent is cross-compiled as hypeman-guest-agent.exe, installed as the HypemanGuestAgent LocalSystem service, and listens through virtio-win VioSock.

Exec gains an explicit session (system vs desktop). Desktop mode impersonates the active interactive user so UI processes can appear on that desktop. Interactive sessions use ConPTY with resize; non-interactive commands use redirected handles. Windows process trees start suspended, join a kill-on-close Job Object, then resume so timeouts and RPC close terminate descendants.

Windows instances no longer skip the guest agent. Readiness probes use cmd.exe, and a successful agent probe can mark the instance Running. File copy/stat skip Unix ownership; network reconfigure is unimplemented; shutdown uses shutdown.exe. CI builds the Windows agent and runs a QEMU guest-control integration test against /ci/windows/image-agent.qcow2.

Reviewed by Cursor Bugbot for commit 0886125. Bugbot is set up for automated code reviews on this repo. Configure here.

@sjmiller609 sjmiller609 changed the title Add Windows guest control Add Windows guest control and ConPTY Aug 20, 2026
@socket-security

socket-security Bot commented Aug 20, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedgithub.com/​aymanbagabas/​go-pty@​v0.2.2100100100100100

View full report

@sjmiller609
sjmiller609 force-pushed the hypeship/windows-guest-control branch 2 times, most recently from c5bc68c to 0d96de5 Compare August 20, 2026 14:14
@sjmiller609
sjmiller609 force-pushed the hypeship/windows-guest-control branch from 0d96de5 to 73fd1af Compare August 20, 2026 15:42
@sjmiller609
sjmiller609 force-pushed the hypeship/windows-guest-control branch from 73fd1af to 7cd7a6e Compare August 20, 2026 16:46
Comment thread docs/windows-guest-agent.md Outdated
Comment thread lib/instances/windows_guest_agent_integration_linux_test.go
Comment thread lib/system/guest_agent/exec_session_windows.go
Comment thread lib/system/guest_agent/exec_tty_unix.go
Comment thread lib/system/guest_agent/listener_windows.go
Comment thread lib/system/guest_agent/listener_windows.go
Comment thread lib/system/guest_agent/process_job_windows.go
Comment thread go.mod
@sjmiller609
sjmiller609 force-pushed the hypeship/windows-guest-control branch from 0c1d3e4 to 1487012 Compare August 20, 2026 18:29
@sjmiller609
sjmiller609 force-pushed the hypeship/windows-guest-control branch from 1487012 to 96a8dd9 Compare August 20, 2026 20:25
@sjmiller609
sjmiller609 force-pushed the hypeship/windows-guest-control branch from 96a8dd9 to 38cabf0 Compare August 20, 2026 23:41
@sjmiller609
sjmiller609 force-pushed the hypeship/windows-guest-control branch from 38cabf0 to 0886125 Compare August 21, 2026 00:13
@sjmiller609
sjmiller609 marked this pull request as ready for review August 21, 2026 00:31

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0886125. Configure here.


cmd := exec.CommandContext(ctx, start.Command[0], start.Command[1:]...)
cmd.Env = s.buildEnv(start.Env, true)
cmd.Dir = start.Cwd

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TTY skips session validation

Medium Severity

Unix TTY exec never calls configureExecCommand, so EXEC_SESSION_DESKTOP and unknown sessions are not rejected on the PTY path. Non-TTY Unix correctly validates via configureExecCommand. A desktop or invalid session with tty=true against a Linux guest therefore runs as SYSTEM instead of failing.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0886125. Configure here.

CreationFlags: windows.CREATE_SUSPENDED,
}
cmd.WaitDelay = 2 * time.Second
return cleanup, nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Desktop missing interactive station

High Severity

Desktop sessions set a user Token and CREATE_SUSPENDED but never set SysProcAttr.Desktop to winsta0\default. From a Session-0 LocalSystem service, that leaves processes on the service window station, so UI processes do not appear on the active interactive desktop despite the documented DESKTOP session behavior.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0886125. Configure here.

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.

1 participant