VA-9: host the agent as a Windows service (SCM) #54
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/VA-9-windows-service"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements Windows service hosting (VA-9), the Phase-6 Windows-parity item, behind
cfg(target_os = "windows"). The agent registers with the Service Control Manager (SCM), runs under it, and tears down cleanly onsc stop.What changed
install_windows.rs(new):install_serviceregisters an auto-startLocalSystemSCM service namedvervain-agent, sealing the seed into%ProgramData%\vervain-agentand copying the binary to%ProgramFiles%\vervain-agent.uninstall_servicestops and deletes it and is idempotent (a missing service is treated as success, mirroring the Linux uninstall).win_service.rs(new): the bin-side service-control dispatcher. The hiddenservice-runsubcommand is what the SCM launches; it reports Running, drives the shared agent loop on its own tokio runtime, and reports Stopped on exit. A Stop/Shutdown control trips a global signal thatwait_for_shutdownnow awaits alongside Ctrl-C, sosc stopruns the same graceful mDNS-goodbye teardown as a console interrupt.main.rs: the agent run loop is factored out ofmainintorun_agentso the foregroundrunpath and the service dispatcher share one implementation. Windows getsinstall/uninstall/service-runsubcommands parallel to the existing Linuxinstall/uninstall.vervain-agent(consistent with the binary and the Linuxvervain-agent.serviceunit). The issue'smeshagentnaming was legacy MeshAgent carry-over; there is nomeshagentcrate.Toolchain (the shared MinGW blocker)
gcc-mingw-w64-x86-64and thex86_64-pc-windows-gnurust target are now baked into both the dev image (Dockerfile) and the CI check image (oci-build/check.Dockerfile).cargo check --workspace --target x86_64-pc-windows-gnu.just check-windowsruns the same cross-check locally.Validation
x86_64-pc-windows-gnu, and the Linuxfmt/clippy --deny warnings/build/testsuite stays green (verified via theoci-build/check.Dockerfilebuild).sc query vervain-agent, reboot survival,uninstallidempotency) require a Windows host with the SCM. Per the agreed interim bar, this PR ships the implementation with a type-check / link cross-check in CI; the runtime ACs are validated manually on Windows.Refs VA-9.