fix(runtime-host): recover approved Guest regeneration - #4636
Merged
M4n5ter merged 1 commit intoSep 3, 2026
Conversation
jackwener
approved these changes
Sep 3, 2026
jackwener
left a comment
Member
There was a problem hiding this comment.
Approved at exact head f0dc0f4cdf55b280859673b5e07037bbc38393be at the explicit direction of M4n5ter. No technical review was performed as part of this action; M4n5ter requested the approval and accepts responsibility for subsequent handling.
Review notice: This approval was submitted by an automated review agent operated by jackwener and is published at the direction of M4n5ter, who requested this action and is the human accountable for it.
Admit durable Guest authorization on regenerate roots, and let explicit managed-Host repair safely replace a Host that dies while preparing retirement. Generated-by: OpenAI Codex
M4n5ter
force-pushed
the
fix/guest-regenerate-managed-host-crash
branch
from
September 3, 2026 08:32
f0dc0f4 to
bbd769c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
English
Summary
Fix approved Session Guest regeneration from crashing the managed Runtime Host and replaying the same pending request on every restart.
The Guest approval is durable authorization for the regenerated root, so the storage contract now accepts that proof for both external messages and regenerations. The coordinator test exercises the real store boundary and verifies that a retry without the same proof conflicts.
This also makes Desktop repair usable after that crash:
host.upgrade.prepareis treated as an unknown retirement outcome;--allow-manual-updateflag.No workspace or Session data is migrated or deleted.
Root cause
PR #4608 began carrying
session_turn_access_requestauthorization intoturn.regenerate, but the durable admission store still rejected authorization on every execution kind exceptexternal_message. The approval coordinator consequently requested Host drain while leaving the request pending. Startup replay hit the same invariant again, producing the apparentMANAGED_ROOT_REQUIRES_OPERATORloop.The existing Repair action then had two independent failure paths: it aborted on an interrupted retirement mutation, and a subsequent development-archive repair passed an invalid CLI flag combination.
Verification
npm run lintnpm run format:checknpm run typechecknpm --workspace @maka/storage run buildand the regenerate admission testnpm --workspace @maka/runtime-host run buildand the approved-regenerate coordinator testnpm --workspace @maka/cli run buildnpm --workspace @maka/desktop run build:mainand the local-operator testnpm --workspace @maka/runtime-host run test:dist: 1,607 passed, 12 skipped, 0 failednpm run build:test, thennode scripts/run-workspace-tests-parallel.mjs --concurrency=1: all workspace tests passedstarted, and the Session loaded with its regenerated answer without deleting stateThe default concurrent local runner exceeded existing fixed Runtime Host startup deadlines under process contention; the same compiled Runtime Host suite passed in isolation and every workspace passed serially.
AI use
Select exactly one:
Tool(s) and scope: OpenAI Codex diagnosed the persisted crash loop, implemented the contract and recovery fixes, added focused tests, and exercised the real Electron repair path.
Checklist
Does this PR entail a change in behavior?
中文
概要
修复 Session Guest 的“重新生成”请求在批准后导致 managed Runtime Host 崩溃,并在每次启动时反复重放同一条待处理请求的问题。
Guest 审批记录是重新生成这条 root Turn 的持久授权凭据,因此存储契约现在同时允许外部消息和重新生成携带这份凭据。协调器测试会穿过真实存储边界,并确认缺少同一份授权的重试会发生冲突。
同时补齐崩溃后的 Desktop 修复路径:
host.upgrade.prepare中断时,不猜测这次修改是否已经生效;--allow-manual-update参数。不会迁移或删除工作区、Session 数据。
根因
#4608 开始把
session_turn_access_request授权传给turn.regenerate,但持久化 admission 仍只允许external_message携带授权。审批协调器因此要求 Host 退出,却把请求留在 pending 状态;下次启动重放后再次撞上同一条不变量,最终表现为MANAGED_ROOT_REQUIRES_OPERATOR循环。原来的“修复”操作还有两个独立问题:退休请求在连接中断后直接失败;再次修复开发归档时,又传入了 CLI 不接受的参数组合。
验证
started,原 Session 和重新生成的回答均可正常加载,未清理任何用户状态本机并发执行时,已有的 Runtime Host 固定启动时限在进程竞争下被超过;同一份产物隔离运行 Runtime Host 全套和串行运行全部 workspace 均通过。