You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A newly installed local CLI/TUI cannot use the existing Host generation and needs Restart / Wait / Cancel handling
installation context, generation-aware handshake, and exact-epoch takeover
Both drafts preserve important safety properties: exact Host Epoch fencing, local ownership checks, no registration/PID-only termination, remote/service isolation, and explicit user authority before destructive interruption. They also expose different design pressures.
Generic retirement is exposed through the historical host.upgrade.prepare wire operation.
Desktop Quit and Desktop Update share a retirement adapter, but concurrent requests coalesce onto the first policy. A later interrupt_active_work request cannot strengthen an in-flight refuse_active_work request.
The returned resume() callback means “allow the owner lifecycle to create a successor after retirement,” not “resume the retired Host.”
TUI performs an additional exact-generation handshake to obtain replacement facts instead of calling an owner-side lifecycle inspection contract.
A package path is a useful negative guard, but it is not positive proof of durable installation authority.
Package version and generation labels are diagnostics, not verified immutable deployment identity.
feat(cli): reconcile local Runtime Host generations #3254 records takeover of an epoch-24 Host with a scheduled-task residency, while the current Host kernel's generation-takeover path requires #isTrueIdle(). Durable incompatible takeover is therefore legacy-dependent rather than a forward-compatible control contract.
Artifact staging, transition ownership, successor verification, and recovery remain outside one explicit local owner transaction.
The system needs one local lifecycle model without turning either connection election or the Runtime Host Kernel into a universal deployment authority.
the narrow Host retirement contract controls admission, active work, drain/interruption, and writer release;
OS-service and local-process adapters apply those semantics through their respective authorities.
The managed-service path already provides exact-package deployment, side-by-side switching, current-operator handoff, process-lifetime locking, exact service/Host/Root fencing, readiness verification, and truthful retry recovery. #3687 adds verified npm integrity and binds selected current and target deployment identities to the update transaction. The remaining #3228 policy and scheduler work will add bounded and periodic desired-state reconciliation on top of those transactions.
Converge Desktop Quit, Desktop Update, installed CLI/TUI startup, and managed local ownership adapters on one layered, owner-scoped reconciliation model:
one deployment owner has positive authority for each mutating transition;
every owner transaction consumes the same narrow Host retirement contract;
capability and backend adapters remain bounded by observed Host and operator capabilities;
Surface code collects intent and presents typed outcomes without owning lifecycle policy.
#3706 can land independently as the urgent exact-owner retirement slice. #3254 remains paused as compatibility and UX evidence while its replacement policy moves out of ordinary connection election. The new local owner/reconciliation contracts should be frozen after the near-term #3228 reconciliation core establishes the shared policy, transaction, scheduling, and recovery boundaries.
Architecture principles
One layered reconciliation model. Policy, owner transaction, Host retirement, and platform capability are separate layers with one-way authority flow.
One owner per deployment. A mutation requires positive owner authority; an ordinary Client credential, package path, or successful connection is not deployment authority.
One narrow Host retirement contract. Runtime Host Kernel remains the sole authority for admission, activity, drain, checkpoint/interruption, semantic recovery, and writer release.
One explicit deployment identity.DeploymentIdentity carries source-appropriate verified evidence. Package version remains display and package-manager metadata.
One exact process fence. Every mutation against a present Host targets the observed HostEpoch and fails closed when identity or ownership changes.
Owner-scoped serialization. Process-lifetime owner locks serialize reconciliation and transactions. State Root writer ownership fences the actual cutover.
Bounded capability adapters. Compatible retirement, legacy incompatible takeover, and operator control may use different mechanisms while preserving the same typed semantics and removal conditions.
Thin Surface adapters. Desktop dialogs and TUI prompts collect consent and present outcomes; they do not select artifacts, own update journals, or implement replacement loops.
Operator authority remains separate. Remote and local service-mode Hosts are mutated only through their operator; a connecting Desktop or TUI never acquires that authority.
stopped is owner-scoped: the Host owned by the identified owner has retired. It does not assert that the State Root must remain globally stopped or prohibit another authorized owner from starting a successor.
The reconciler determines a convergence plan and invokes explicit owner transactions:
validate owner authority and serialize the owner transition;
resolve an exact desired deployment when running is requested;
inspect the exact current Host through an observed capability adapter;
stage the selected deployment before destructive mutation;
return typed blockers when policy refuses active-work interruption;
fence admission and request checkpoint/drain or explicit interruption;
observe writer release rather than infer retirement from stale registration;
stop at owner-scoped stopped, or activate and launch the selected deployment;
verify successor Root, Host Epoch, deployment identity, and readiness;
publish a typed terminal outcome sufficient for bounded retry and recovery.
The reconciler coordinates these transactions; it does not move deployment authority into the Host Kernel or replace explicit transaction recovery with an in-memory desired-state loop.
Serialization and ownership
A generic root-scoped transition lease is not a default requirement. It can serialize competing installations, but it cannot decide which installation is authorized and may preserve authority ambiguity instead of eliminating it.
The default model is:
one durable deployment owner provides positive mutation authority;
owner-scoped process-lifetime locks serialize its reconciliation and transactions;
exact owner/Host/service identity checks prevent mutation of a successor or another operator's Host;
the State Root writer fence protects the actual cutover.
A root-scoped transaction is introduced only for a supported ownership-transfer operation or another concrete path where multiple authorized owners must coordinate.
Deployment identity
Immutable deployment identity is partly delivered. #3687 uses verified npm SHA-512 integrity to distinguish registry artifacts, including same-version packages with different content, and binds the selected current and target deployment identities to the update transaction.
The shared contract should therefore be a small DeploymentIdentity envelope carrying source-appropriate verified evidence. Deployment identity participates in running(exactDeployment) reconciliation but remains outside Host retirement. Ownership and lifecycle semantics for transient invocation sources are separate product decisions and are not prerequisites for #3703 or this architecture.
Product mappings
Product action
Reconciliation
Policy
Desktop full Quit
owner-scoped stopped
checkpoint_and_interrupt
Close one Surface / TUI /exit
no reconciliation; disconnect only
n/a
Desktop or installed CLI update
running(exactDeployment)
refuse first; explicit interruption after confirmation
#3706 does not wait for #3228. The new local owner/reconciliation implementation waits only until these #3228 core contracts are stable:
policy resolves to an exact desired deployment;
bounded one-shot reconciliation delegates to the verified update transaction;
scheduling reuses the same reconciliation entry point;
retry and recovery outcomes form a stable machine contract.
Desktop update-policy UI or other remaining presentation work is not an architecture gate once those contracts are stable.
Convergence sequence
Land fix(desktop): retire the owned local Host on full quit #3706 as the urgent exact-owner retirement path. Improve concurrent policy escalation without treating its current fail-closed, recoverable behavior as a merge-blocking safety defect.
Identify and extract only the genuinely shared contracts and invariants.
Define the durable local owner record, machine-readable owner transaction surface, and local-process adapter.
Implement owner-scoped local reconciliation over the shared transaction model.
Move replacement policy out of connectOrSpawn and Surface-owned loops.
Retain bounded adapters for released Hosts and remove them when the stable owner control capability is broadly available.
AI-agent-assisted development keeps this architecture gate short and allows the resulting stack to land quickly without preserving transitional architecture for months. It does not require combining authority, protocol, deployment, recovery, and presentation changes into one oversized review unit.
Acceptance criteria
Desktop full Quit retires its exact durable-resident owned ephemeral Host before exit or returns an actionable bounded failure.
stopped is always interpreted within an explicit owner scope.
Installed CLI/TUI replacement policy is outside ordinary connectOrSpawn admission.
Desired-state policy, owner transactions, Host retirement, and capability adapters remain separate layers.
Concurrent Quit/Update/Restart consent and policy escalation produce deterministic typed outcomes.
Exact Host Epoch and State Root writer ownership are verified across retirement and successor startup.
Durable schedules and continuation intent recover under the selected successor; unresolved external effects remain result_unknown.
Remote and service-mode Hosts remain operator-owned.
Failure outcomes include bounded Host facts and authenticated PID when available, without automatic PID-only termination.
Released-Host compatibility adapters have explicit capability selection and removal conditions.
host.upgrade.prepare as the public lifecycle semantic after its bounded legacy window;
replacement-policy fields on ordinary connectOrSpawn calls;
Surface-owned restart and replacement loops;
package paths or successful connections as positive proof of deployment authority;
version, build, or generation labels used as substitutes for explicit protocol, epoch, or deployment identities;
in-memory callbacks as authority for a transition that crosses process replacement.
Non-goals
A universal Runtime Host-owned package or deployment state machine
A global “State Root must remain stopped” desired state
A generic root-scoped lease without a concrete ownership-transfer requirement
Deciding ownership semantics for transient invocation products
One atomic PR containing every authority, protocol, deployment, recovery, and presentation change
Registration/PID-only process termination
Stopping managed remote or local service-mode Hosts through ordinary Client authority
AI assistance disclosure
Codex assisted with architecture analysis and drafting. The proposal is based on #3228, #3231, #3687, the code and tests in #3706 and #3254, and the current Runtime Host retirement, takeover, service-management, and State Root ownership contracts.
English
Problem
Local Runtime Host lifecycle is split across two Draft PRs that discover different parts of the same owner transition:
host.upgrade.preparefollowed by exact-PID exit observationBoth drafts preserve important safety properties: exact Host Epoch fencing, local ownership checks, no registration/PID-only termination, remote/service isolation, and explicit user authority before destructive interruption. They also expose different design pressures.
#3706 design pressure
host.upgrade.preparewire operation.interrupt_active_workrequest cannot strengthen an in-flightrefuse_active_workrequest.resume()callback means “allow the owner lifecycle to create a successor after retirement,” not “resume the retired Host.”#3254 design pressure
connectOrSpawncarries connection admission, candidate launch, generation inspection, and takeover policy.scheduled-taskresidency, while the current Host kernel's generation-takeover path requires#isTrueIdle(). Durable incompatible takeover is therefore legacy-dependent rather than a forward-compatible control contract.The system needs one local lifecycle model without turning either connection election or the Runtime Host Kernel into a universal deployment authority.
Architectural foundation from #3228
#3228 establishes the layered model that local lifecycle work should reuse where the authority boundaries match:
The managed-service path already provides exact-package deployment, side-by-side switching, current-operator handoff, process-lifetime locking, exact service/Host/Root fencing, readiness verification, and truthful retry recovery. #3687 adds verified npm integrity and binds selected current and target deployment identities to the update transaction. The remaining #3228 policy and scheduler work will add bounded and periodic desired-state reconciliation on top of those transactions.
Refs #3228
Refs #3231
Refs #3243
Refs #3245
Refs #3703
Desired outcome
Converge Desktop Quit, Desktop Update, installed CLI/TUI startup, and managed local ownership adapters on one layered, owner-scoped reconciliation model:
#3706 can land independently as the urgent exact-owner retirement slice. #3254 remains paused as compatibility and UX evidence while its replacement policy moves out of ordinary connection election. The new local owner/reconciliation contracts should be frozen after the near-term #3228 reconciliation core establishes the shared policy, transaction, scheduling, and recovery boundaries.
Architecture principles
DeploymentIdentitycarries source-appropriate verified evidence. Package version remains display and package-manager metadata.HostEpochand fails closed when identity or ownership changes.Target contract
stoppedis owner-scoped: the Host owned by the identified owner has retired. It does not assert that the State Root must remain globally stopped or prohibit another authorized owner from starting a successor.The reconciler determines a convergence plan and invokes explicit owner transactions:
runningis requested;stopped, or activate and launch the selected deployment;The reconciler coordinates these transactions; it does not move deployment authority into the Host Kernel or replace explicit transaction recovery with an in-memory desired-state loop.
Serialization and ownership
A generic root-scoped transition lease is not a default requirement. It can serialize competing installations, but it cannot decide which installation is authorized and may preserve authority ambiguity instead of eliminating it.
The default model is:
A root-scoped transaction is introduced only for a supported ownership-transfer operation or another concrete path where multiple authorized owners must coordinate.
Deployment identity
Immutable deployment identity is partly delivered. #3687 uses verified npm SHA-512 integrity to distinguish registry artifacts, including same-version packages with different content, and binds the selected current and target deployment identities to the update transaction.
The shared contract should therefore be a small
DeploymentIdentityenvelope carrying source-appropriate verified evidence. Deployment identity participates inrunning(exactDeployment)reconciliation but remains outside Host retirement. Ownership and lifecycle semantics for transient invocation sources are separate product decisions and are not prerequisites for #3703 or this architecture.Product mappings
stoppedcheckpoint_and_interrupt/exitrunning(exactDeployment)running(exactDeployment)#3228 architecture gate
#3706 does not wait for #3228. The new local owner/reconciliation implementation waits only until these #3228 core contracts are stable:
Desktop update-policy UI or other remaining presentation work is not an architecture gate once those contracts are stable.
Convergence sequence
connectOrSpawnand Surface-owned loops.AI-agent-assisted development keeps this architecture gate short and allows the resulting stack to land quickly without preserving transitional architecture for months. It does not require combining authority, protocol, deployment, recovery, and presentation changes into one oversized review unit.
Acceptance criteria
stoppedis always interpreted within an explicit owner scope.connectOrSpawnadmission.result_unknown.Concepts to delete
host.upgrade.prepareas the public lifecycle semantic after its bounded legacy window;connectOrSpawncalls;Non-goals
AI assistance disclosure
Codex assisted with architecture analysis and drafting. The proposal is based on #3228, #3231, #3687, the code and tests in #3706 and #3254, and the current Runtime Host retirement, takeover, service-management, and State Root ownership contracts.
简体中文
问题
本地 Runtime Host 生命周期被拆在两个 Draft PR 中;它们发现的是同一次 owner transition 的不同部分:
host.upgrade.prepare,随后观察精确 PID 退出两个 Draft 都保留了重要的安全属性:精确 Host Epoch fencing、本地 ownership 检查、禁止只依据 registration/PID 终止进程、隔离 remote/service,以及破坏性中断前的明确用户授权。它们也暴露了不同的设计压力。
#3706 的设计压力
host.upgrade.preparewire operation 暴露。interrupt_active_work无法增强正在执行的refuse_active_work。resume()表示“retirement 后允许 owner lifecycle 创建 successor”,并不是恢复已经退场的 Host。#3254 的设计压力
connectOrSpawn同时承载 connection admission、candidate launch、generation inspection 和 takeover policy。scheduled-taskresidency 时的 takeover,而当前 Host kernel 的 generation-takeover 路径要求#isTrueIdle()。因此,不兼容 Host 的 durable takeover 依赖 legacy 行为,而不是 forward-compatible control contract。系统需要一套本地生命周期模型,同时不能把 connection election 或 Runtime Host Kernel 变成万能 deployment authority。
#3228 提供的架构基础
#3228 建立了本地生命周期工作在 authority 边界一致时应复用的分层模型:
Managed-service 路径已经提供 exact-package deployment、side-by-side switching、current-operator handoff、process-lifetime locking、精确 service/Host/Root fencing、readiness verification 与真实的 retry recovery。#3687 增加了经过验证的 npm integrity,并将选定的 current/target deployment identity 绑定到更新事务。#3228 剩余的 policy 与 scheduler 工作将在这些事务之上增加 bounded 与 periodic desired-state reconciliation。
关联 #3228
关联 #3231
关联 #3243
关联 #3245
关联 #3703
期望结果
让 Desktop Quit、Desktop Update、installed CLI/TUI startup 与 managed local ownership adapter 收敛到一套分层、owner-scoped reconciliation 模型:
#3706 可以作为紧急的 exact-owner retirement 切片独立合并。#3254 保持暂停并作为兼容性与 UX 证据,同时把 replacement policy 移出普通 connection election。新的本地 owner/reconciliation 契约应在近期 #3228 reconciliation core 确立共享 policy、transaction、scheduling 与 recovery 边界后再冻结。
架构原则
DeploymentIdentity携带与来源匹配且经过验证的证据;package version 只负责展示与 package-manager metadata。HostEpoch,identity 或 ownership 改变时 fail closed。目标契约
stopped具有 owner 作用域:由指定 owner 拥有的 Host 已经退场。它不声明 State Root 必须全局保持停止,也不禁止另一个经过授权的 owner 启动 successor。Reconciler 决定收敛计划并调用显式 owner transaction:
running时解析精确 desired deployment;stopped结束,或 activate 并启动 selected deployment;Reconciler 负责协调这些事务;它不会把 deployment authority 移入 Host Kernel,也不会用内存 desired-state loop 取代显式 transaction recovery。
序列化与 ownership
通用 root-scoped transition lease 不是默认要求。它可以序列化相互竞争的 installation,却不能决定哪个 installation 有权操作,反而可能保留 authority 歧义。
默认模型是:
只有存在受支持的 ownership-transfer operation,或其他多个合法 owner 必须协调的具体路径时,才引入 root-scoped transaction。
Deployment identity
Immutable deployment identity 已经部分交付。#3687 使用经过验证的 npm SHA-512 integrity 区分 registry artifact,包括同版本不同内容的 package,并将选定的 current/target deployment identity 绑定到更新事务。
因此,共享契约应是一个很薄的
DeploymentIdentityenvelope,携带与来源匹配且经过验证的证据。Deployment identity 参与running(exactDeployment)reconciliation,但仍位于 Host retirement 之外。临时 invocation 来源的 ownership 与生命周期语义属于独立产品决策,不是 #3703 或本架构的前置条件。产品动作映射
stoppedcheckpoint_and_interrupt/exitrunning(exactDeployment)running(exactDeployment)#3228 architecture gate
#3706 不等待 #3228。新的本地 owner/reconciliation 实现只等待以下 #3228 核心契约稳定:
这些契约稳定后,Desktop update-policy UI 或其他剩余 presentation 工作不再构成 architecture gate。
收敛顺序
connectOrSpawn与 Surface-owned loop。AI agent 辅助开发使这个 architecture gate 保持短暂,并能在不让过渡架构存在数月的前提下快速交付整组实现。它不要求把 authority、protocol、deployment、recovery 与 presentation 变更合并成一个过大的评审单元。
验收标准
stopped始终在明确 owner 作用域内解释。connectOrSpawnadmission 之外。result_unknown。应删除的概念
host.upgrade.prepare;connectOrSpawn调用中的 replacement-policy 字段;非目标
AI 辅助声明
Codex 协助了架构分析与起草。该提案依据 #3228、#3231、#3687、#3706 与 #3254 的代码和测试,以及当前 Runtime Host retirement、takeover、service-management 与 State Root ownership 契约。