Skip to content

refactor(runtime-host): make operator control platform-neutral - #4657

Draft
M4n5ter wants to merge 1 commit into
mainfrom
refactor/runtime-host-operator-command
Draft

refactor(runtime-host): make operator control platform-neutral#4657
M4n5ter wants to merge 1 commit into
mainfrom
refactor/runtime-host-operator-command

Conversation

@M4n5ter

@M4n5ter M4n5ter commented Sep 3, 2026

Copy link
Copy Markdown
Member
English

Summary

Make managed Runtime Host control describe a target-platform invocation instead of assuming every operator is a POSIX-executable path. New deployments use one exact { nodePath, modulePath, platform } command across Desktop, CLI, SSH, and WSL; Windows SSH uses an encoded PowerShell invocation independent of the account's default shell.

SSH preflight now reports the remote Node identity as a fact. Published npm onboarding derives only the operator platform from it, while development archive selection alone applies the finite Direct-peer prebuild policy; supported published targets such as macOS x64 are no longer rejected by an unrelated native-artifact whitelist.

Shipped path-based SSH/WSL profiles, interrupted SSH pairing journals, and Desktop managed bindings are upgraded automatically without changing their target identity or credential binding. Existing POSIX deployment operators become stable forwarders to the persisted exact package, so migrated WSL and SSH installations survive later updates and package pruning. The shipped WSL profile set --operator-path CLI remains a legacy POSIX alias for existing automation, while new callers use --operator-command. Native Windows also receives its correct application-data root. This slice deliberately adds no lifecycle provider; that is the stacked follow-up.

Re-adding an existing WSL Host now recognizes deployment identity independently from its control route. It upgrades the existing profile and binding atomically instead of creating a duplicate profile; a failed binding write restores the previous profile.

The stable operator also preserves child signal exits: it removes only its own forwarding handlers before reproducing the child's signal, so lifecycle callers cannot mistake a terminated exact package for a successful operation.

Refs #4646

Verification

  • CLI, Runtime Host, and Desktop builds/typechecks
  • affected operator, SSH, WSL, setup, profile, and Desktop management tests
  • generated-operator integration coverage for real SIGTERM propagation
  • Windows-native build and installed development-tarball validation on the stacked product

Review focus

The operator command is the only cross-platform invocation authority. Callers must not reconstruct shell commands or infer the target platform. Compatibility is limited to persisted shapes that shipped: reads work immediately, owning mutations rewrite current schemas, and unreleased intermediate representations remain unsupported.

AI use

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

Tool(s) and scope: OpenAI Codex implemented and verified the refactor under maintainer direction.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No
中文

摘要

managed Runtime Host 控制面不再假设所有 operator 都是 POSIX 可执行路径,而是描述目标平台调用。新部署在 Desktop、CLI、SSH 与 WSL 中统一使用精确的 { nodePath, modulePath, platform } 命令;Windows SSH 使用编码后的 PowerShell 调用,不依赖账号默认 shell。

SSH preflight 现在只报告远端 Node identity 这一事实。发布版 npm onboarding 仅据此确定 operator platform,只有开发 archive 选择才应用有限的 Direct-peer prebuild 策略;macOS x64 等发布版可支持目标不再被无关的原生产物白名单拒绝。

已发布版本留下的 path-based SSH/WSL profile、未完成的 SSH pairing journal 与 Desktop managed binding 会自动升级,并保持原 target identity 与 credential binding。既有 POSIX deployment operator 会变为指向持久化 exact package 的稳定 forwarder,使迁移后的 WSL/SSH 安装在后续更新和 package pruning 后仍可工作。已发布的 WSL profile set --operator-path CLI 会保留为既有自动化使用的 legacy POSIX alias,新调用方使用 --operator-command。该切片同时使用 Windows 原生 application-data 目录;lifecycle provider 位于 stack 的后续 PR。

重新添加既有 WSL Host 时,会独立于 control route 识别 deployment identity,原子升级已有 profile 与 binding,而不是创建重复 profile;binding 写入失败则恢复原 profile。

稳定 operator 还会保留子进程的 signal exit:在复现子进程信号前只移除自身安装的 forwarding handler,避免 lifecycle 调用方把被终止的 exact package 误判为成功。

关联 #4646

验证

  • CLI、Runtime Host 与 Desktop build/typecheck
  • operator、SSH、WSL、setup、profile 与 Desktop management 相关测试
  • generated operator 真实 SIGTERM 传播集成覆盖
  • 在 stack 完整产品上完成 Windows 原生 build 与 development tarball 安装验证

审查重点

operator command 是唯一跨平台调用 authority。调用方不得重新拼 shell command,也不得重新猜测目标平台。兼容范围只覆盖真正发布过的持久化形态:读取立即可用,下一次 owning mutation 写回当前 schema;未发布的中间表示不兼容。

AI 使用

  • 没有生成式工具作出实质贡献
  • 生成式工具作出实质贡献

工具与范围:OpenAI Codex 在维护者指导下实现并验证本次重构。

检查清单

  • 测试覆盖该变更,且没有变更时会失败
  • lint、format、typecheck 与受影响测试已在本地通过

该 PR 是否改变行为?

  • 是——已在摘要中说明

@github-actions github-actions Bot added the effort/XL Over 1000 readable lines label Sep 3, 2026
@M4n5ter M4n5ter self-assigned this Sep 3, 2026
@M4n5ter
M4n5ter force-pushed the refactor/runtime-host-operator-command branch 12 times, most recently from 0f19a1c to 1bf5ba1 Compare September 3, 2026 17:40
@M4n5ter
M4n5ter force-pushed the refactor/runtime-host-operator-command branch from 1bf5ba1 to e43706e Compare September 3, 2026 17:55
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.

1 participant