Skip to content

feat(runner): deliver Windows execution machine lifecycle - #875

Draft
AaronWangCong wants to merge 8 commits into
Tencent:mainfrom
AaronWangCong:codex/windows-runner-lifecycle
Draft

AaronWangCong wants to merge 8 commits into
Tencent:mainfrom
AaronWangCong:codex/windows-runner-lifecycle

Conversation

@AaronWangCong

@AaronWangCong AaronWangCong commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Adds installation and lifecycle management for Windows execution machines connecting to the existing platform. A machine can bind, execute tasks with its account's tools and CLI login, reconnect with the same identity and workspace, update with rollback, renew an expired binding, and uninstall while preserving user data.

  • Serve the standalone PowerShell installer and matching Windows Runner/Gate plus Linux Gate companion through the existing machine-plane download API.
  • Require HTTPS for remote platforms; verify SHA-256 and PE/ELF architecture before replacing an installation. Offline stop/local cleanup remains available for legacy HTTP installations.
  • Confirm registration with an authenticated, read-only session preflight. Rebinding requires the same platform owner and retains newly issued sessions if a later local configuration write fails.
  • Add Windows lifecycle CI, real installed-Runner acceptance, real Codex approval tests and optional live Docker acceptance.

Split review

This is part 3 of the Windows execution-machine work:

  1. Platform adapters: platform primitives with independent Windows CI.
  2. Windows task runtime: Windows execution, SSH transport and task process ownership.
  3. This PR: installer, downloads, documentation and integration verification.

This integration branch retains the complete feature for acceptance. It stays draft until the foundations merge, then will be rebased to the delivery-only changes. The delivery-only comparison contains 28 files.

Scope

  • Platform core / API / runner
  • Public adapter / deployment
  • Classic
  • Portable
  • Shared behavior contract
  • Installer / CLI
  • Documentation only

Compatibility

The platform runs on Linux/macOS; Windows joins as an execution host. The guide distinguishes these roles consistently with #163. No frontend or database migration changes are included.

Windows native tasks own their complete process tree. Linux Docker images used from Windows need Python 3 at a standard image path; personal container Git SSH also needs the OpenSSH client tools. Successful Docker script nodes retain services for subsequent nodes in the same reused sandbox. Active commands stop when canceled or when their Runner owner exits. The web interactive PTY uses a Unix execution machine.

Validation

All acceptance below ran on the local Windows amd64 machine and its Docker Desktop Linux engine, using real binaries and zero-cost loopback model gateways:

  • Seven installed native-Runner lifecycle/task cases: shell/native CLI work, Gate, artifacts, cancellation, forced shutdown, reconnect, workspace continuation, update/rollback, rebind and uninstall.
  • 46 distinct installer regressions under both Windows PowerShell 5.1 and PowerShell 7, including malformed artifacts, real locked files, PID identity, URL policy, local-only cleanup and retry behavior.
  • Nine actual pinned Codex approval/policy cases; actual native Git SSH isolation and authentication tests.
  • Live Windows-to-Linux Docker conversation, masks, Gate, real Codex, SSH push/ls-remote, credential isolation, process cancellation, warm services, failure cleanup, restart and missing-Python rejection.
  • Latest-binary Docker acceptance: all six groups passed in 204.92s. Forced script and real Codex termination both reaped parent/child/grandchild identities without zombies or delayed writes, while completed unrelated services kept running. The generic OpenCode provider path with OwnProcessGroup=false and byte-exact JSON stdin passed.
  • The exact embedded production browser Dockerfile and normalized entrypoint built and ran successfully on local Docker Desktop: real Chromium/CDP startup passed, including a cold build and a cached repeat. Package transport used an isolated test-only proxy with normal TLS/APT signature verification. The proxy and the containers created for task fixtures were removed afterward.
  • Linux full suite: 30 packages and 4,906 tests/subtests passed, zero failures; all five real Chromium cases and actual Codex/Claude custom-gateway cases passed. Full vet and public-content checks passed.
  • Exact adapter commit: 208 Linux parity tests/subtests plus selected vet checks passed.
  • Final changed Go source: full runtime and Runner packages passed 896 Linux tests/subtests, selected vet and public-content checks; actual default Unix supervisor and real Codex/Claude gateway cases passed.
  • Native Windows amd64 builds; Windows arm64, Linux amd64 and Darwin arm64 cross-builds.
  • Final candidate public-content check, git diff --check and Gitleaks 8.30.1 passed across the full PR stack. Linux amd64 platform/Runner/Gate and Windows/Darwin ARM64 Runner/Gate builds passed; executable headers confirm the ARM64 targets.

All 19 official checks passed on 4e6b77d. The Windows job ran all seven installed lifecycle cases, 46 installer cases under each PowerShell version, all nine actual Codex hook cases, and vet.

Safety

  • No credentials, internal endpoints, production data or private deployment files included.
  • User files and unrelated changes preserved.
  • No Classic host bundle changes apply.
  • No third-party source was copied.

@AaronWangCong
AaronWangCong marked this pull request as ready for review November 15, 2026 01:28

@Yanami-2K Yanami-2K left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

首次审查(head f830312)结论:需要修改。

  1. cmd/agentflow-runner/main.go:Windows 上显式开启 -auto-update 时只打日志,没有关闭开关。 现在默认值改成了 goruntime.GOOS != "windows",但用户显式传 -auto-update=true 时,代码只是 log.Printf("automatic Runner updates are unavailable on Windows..."),*autoUpdate 仍为 true 并传给 runner.Config。之后如果真的下载了新版本,会走到 restartRunner,而 Windows 实现固定返回错误,进程随即 log.Fatal 退出。也就是说,提示「不可用」的功能实际仍会执行,并以进程退出收场。建议打印警告后紧接着 *autoUpdate = false,并在 update_windows_test.go 中断言 Windows 上 Config 的 AutoUpdate 为 false。
  2. deploy/bind-cli.ps1 Get-PlatformUrl 允许 http://。 安装和 -Update 都会从这个地址下载 Runner/Gate 可执行文件,并用同一来源返回的 SHA-256 做校验。走明文 HTTP 时,中间人可以同时替换二进制和摘要,校验起不到保护作用,bind code 也会明文传输。建议与 #174 VS Code 扩展的 normalizeBaseUrl 保持一致:只对 localhost/127.0.0.0/8/::1 放行 HTTP,其余地址强制 HTTPS,并在 scripts/test-windows-installer.py 中补拒绝用例。
  3. PR 体量过大,难以有效审查。 111 个文件、+6260/−273,同时包含:Unix 侧的行为等价重构(processgroup、procwatch、assistant_native_lock_*、preview/archive_links_*、gitwork/ssh_transport_*)、Windows 新实现(MSYS AF_LOCAL 兼容的 SSH agent、进程树、审批 hook)、安装器与下载端点、新的 Windows CI。审查工具只返回了前 100 个文件,其中大部分 patch 被省略。建议至少拆成三部分:(a) 抽出平台适配层、Unix 行为不变;(b) Windows SSH transport 与进程管理;(c) 安装器、下载端点和 CI。这样每一步都能单独验证「Unix 行为不变」。
  4. 文档冲突:#163 正在 README 中写入「Windows 暂不支持」,本 PR 在同一位置新增 Windows Runner 入口。两者先后合入会互相矛盾,请与 #163 协调措辞,例如改成「平台需部署在 Linux,Windows 可作为执行机接入」。

已确认的优点:msysSSHListener 用 DACL 限制目录、使用随机 cookie,私钥只放在内存;configuredBinaryPath 兼容无扩展名和 .exe 两种部署形态,并有测试覆盖。

@AaronWangCong
AaronWangCong marked this pull request as draft November 15, 2026 02:09
@AaronWangCong
AaronWangCong force-pushed the codex/windows-runner-lifecycle branch from f830312 to c7977a4 Compare November 15, 2026 04:53
@AaronWangCong AaronWangCong changed the title feat(runner): support native Windows execution machines feat(runner): deliver Windows execution machine lifecycle Nov 15, 2026
@AaronWangCong
AaronWangCong force-pushed the codex/windows-runner-lifecycle branch from d880303 to cda1608 Compare November 15, 2026 05:37
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