Skip to content

feat(runtime-host): support WSL as a local environment - #4064

Merged
M4n5ter merged 2 commits into
mainfrom
feat/runtime-host-wsl-environment
Aug 28, 2026
Merged

feat(runtime-host): support WSL as a local environment#4064
M4n5ter merged 2 commits into
mainfrom
feat/runtime-host-wsl-environment

Conversation

@M4n5ter

@M4n5ter M4n5ter commented Aug 28, 2026

Copy link
Copy Markdown
Member
English

Summary

Make WSL a first-class local execution environment instead of modeling it as an SSH remote Host.

  • Add credential-free environment / wsl profiles and route all non-local profiles through one shared connector used by Desktop and CLI.
  • Use the system wsl.exe with literal argv for distribution enumeration and daily operator calls; no WSL SSH server, dynamic IP, localhost forwarding, or shell-built operator command is required.
  • Add operator connect --framed, which activates the managed on-demand deployment and bridges the existing local IPC byte stream over stdio without duplicating State Root election.
  • Install the exact package through /bin/sh -lc only during initial WSL setup; normal activation and connection execute the persisted absolute operator path directly.
  • Add Windows-only Desktop onboarding for SSH Computer / WSL Environment and persist no meaningless bearer credential for WSL.
  • Define profile kinds once and classify their workspace authority through an exhaustive type-checked map. Adding another profile kind now fails compilation until its client/Host workspace semantics are explicit.

Refs #3984

Review focus

  1. wsl-control.ts and wsl-environment.ts: Windows control boundary, literal argv, bounded output, and framed transport.
  2. managed-stdio-bridge.ts plus runtime-host-connect-command.ts: activation followed by verified local IPC bridging.
  3. host-profile.ts and profile-kind.ts: environment identity, credential-free persistence, and compile-time workspace-authority coverage.
  4. Desktop and CLI workspace consumers: shared Host-workspace semantics without weakening remote-only SSH and credential boundaries.

Invariants

  • WSL is a local environment security boundary, not an SSH remote.
  • A persisted WSL profile contains distribution, expected Root ID, and absolute operator path, but no bearer credential.
  • Daily operator calls never interpolate distribution names or operator paths into a shell.
  • Activation continues to use the canonical managed deployment reconciliation and State Root election authority.
  • WSL defaults to on-demand; this PR does not claim machine-level persistence.
  • local uses the Client workspace; environment and remote use the Host workspace. Remote credentials, SSH, and pairing remain separate remote-only concerns.

Verification

  • Runtime Host build, CLI build, Desktop full typecheck/main build, repository format check, and diff check passed.
  • Focused CLI and Desktop regression selections: 56 passed. Existing tests were extended for WSL semantics rather than adding broad duplicate suites.
  • Real Windows-to-WSL smoke on this head: Windows Electron enumerated Ubuntu through the system wsl.exe, installed the exact development package, activated the on-demand Host, and connected through the stable framed stdio operator bridge.
  • A real Desktop Session completed with WSL_DESKTOP_SESSION_OK. On the final head, the Session was restored under the Ubuntu E2E Host group, its Linux project remained accessible, and task readiness reported runtime/model/workspace all ready with no blockers.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex contributed implementation, tests, Windows/WSL verification, and this description under human direction.

Checklist

中文

摘要

将 WSL 建模为一等本地执行环境,而不是伪装成 SSH remote Host。

  • 新增无凭据的 environment / wsl profile;Desktop 与 CLI 的非本地 profile 共用同一个 connector。
  • 使用系统 wsl.exe,发行版枚举和日常 operator 调用都通过 literal argv;不要求 WSL SSH server、动态 IP、localhost forwarding,也不拼接 shell command。
  • 新增 operator connect --framed:先 activation managed on-demand deployment,再把现有 local IPC byte stream 通过 stdio bridge 暴露;不复制 State Root election。
  • 只有首次 WSL setup 安装 exact package 时使用 /bin/sh -lc;日常 activation/connection 直接执行持久化的绝对 operator path。
  • Desktop 在 Windows 上提供 SSH Computer / WSL Environment onboarding,WSL 不保存无意义的 bearer credential。
  • profile kind 只定义一次,并通过穷尽、受类型检查的映射声明 workspace authority。以后新增 kind 而未明确 client/Host workspace 语义时,编译会直接失败。

关联 #3984

审查重点

  1. wsl-control.tswsl-environment.ts:Windows 控制边界、literal argv、bounded output 与 framed transport。
  2. managed-stdio-bridge.tsruntime-host-connect-command.ts:activation 后验证并桥接 local IPC。
  3. host-profile.tsprofile-kind.ts:environment identity、无凭据持久化契约和编译期 workspace-authority 覆盖。
  4. Desktop 与 CLI workspace 消费者:共享 Host-workspace 语义,同时不削弱 remote 专属的 SSH 与凭据边界。

不变量

  • WSL 是本地 environment security boundary,不是 SSH remote。
  • WSL profile 只保存 distribution、expected Root ID 和 absolute operator path,不保存 bearer credential。
  • 日常 operator 调用绝不把 distribution 或 operator path 插值进 shell。
  • Activation 继续复用 canonical managed deployment reconciliation 与 State Root election authority。
  • WSL 默认 on-demand;本 PR 不宣称 machine-level persistence。
  • local 使用 Client workspace;environmentremote 使用 Host workspace。远程凭据、SSH 与 pairing 仍是独立的 remote-only 关注点。

验证

  • Runtime Host build、CLI build、Desktop 全量 typecheck/main build、仓库 format check 与 diff check 均通过。
  • CLI 与 Desktop 聚焦回归测试共 56 项通过;只扩展现有测试覆盖 WSL 语义,没有增加宽泛重复测试套件。
  • 在当前 head 上完成真实 Windows→WSL smoke:Windows Electron 通过系统 wsl.exe 枚举 Ubuntu、安装 exact development package、激活 on-demand Host,并经稳定 operator 的 framed stdio bridge 建连。
  • 一个真实 Desktop Session 已完成并返回 WSL_DESKTOP_SESSION_OK。在最终 head 上,该 Session 正确恢复到 Ubuntu E2E Host 分组,Linux project 仍可访问,task readiness 的 runtime/model/workspace 三个维度均为 ready,无 blocker。

AI 使用情况

OpenAI Codex 在人工指导下参与了实现、测试、Windows/WSL 验证和本描述编写。

检查清单

@M4n5ter M4n5ter self-assigned this Aug 28, 2026
@M4n5ter M4n5ter changed the title feat(runtime-host): add WSL environment support feat(runtime-host): support WSL as a local environment Aug 28, 2026
@github-actions github-actions Bot added the effort/XL Over 1000 readable lines label Aug 28, 2026
@M4n5ter
M4n5ter force-pushed the feat/runtime-host-wsl-environment branch 8 times, most recently from 282621d to 26170b1 Compare August 28, 2026 09:09
Give WSL activation a cold-start budget, keep semantic failures in the framed transport, and make bounded subprocess diagnostics non-rejecting. Classify persistent identity mismatches as terminal and separate Desktop Host ownership from target location.

Generated-by: OpenAI Codex
@M4n5ter
M4n5ter force-pushed the feat/runtime-host-wsl-environment branch from 26170b1 to 2ba90c7 Compare August 28, 2026 10:46

@jackwener jackwener left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved at exact head 2ba90c7841004aac30290b4afaaefb8a88247f77.

I found no release-blocking correctness or security issue in the current change. The WSL path uses the system wsl.exe with literal arguments for normal operation, keeps the managed deployment and State Root election as the single Host authority, binds the bridge to the expected Root and Host epoch, and owns cancellation, child failure, timeout, EOF, and half-close cleanup. Desktop and CLI consistently treat WSL as a credential-free environment with Host-owned workspace semantics rather than weakening the SSH remote boundary.

The focused Runtime Host, CLI, and Desktop verification passed, including activation/rollback, identity mismatch, WSL process failure, framed transport, backpressure, and half-close coverage. All applicable hosted checks on this exact head are complete and successful, and the synthetic merge with current main is clean.

One backward-reader limitation is suitable for a follow-up rather than a release hold: after a current client writes an environment entry to runtime-host-profiles.json, an older client sharing the same Client Data Root cannot decode that document. The failure is fail-closed and does not overwrite or corrupt the file; reopening it with the current client restores access. A follow-up should give new profile kinds a forward-compatible persistence boundary so one new entry cannot hide otherwise readable remote profiles from an older client.


Posted by an automated review agent operated by @WAWQAQ. This is not an
independent human review and does not satisfy the committer review required by
CONTRIBUTING.md. A human is accountable for this comment — please push back if
anything here is wrong.

简体中文

本条评论由 @WAWQAQ 运行的自动化审查程序发出。它不构成 CONTRIBUTING.md
所要求的独立人类审查,也不能替代人类审查。有人类对本条评论负责,如有错误请直接指出。

@M4n5ter
M4n5ter merged commit 4b20261 into main Aug 28, 2026
17 checks passed
@M4n5ter
M4n5ter deleted the feat/runtime-host-wsl-environment branch August 28, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/XL Over 1000 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants