fix(desktop): keep local tasks available during Host recovery - #5101
Merged
Conversation
Generated-by: OpenAI Codex
jackwener
approved these changes
Sep 9, 2026
jackwener
left a comment
Member
There was a problem hiding this comment.
Approved at exact head af26d2bbb583415d8b6671992a585599ce750283 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.
The hosted test, effort-label, and Linux x64 checks were not yet terminal when this approval was submitted, so this approval does not assert that CI is green and is not a merge decision.
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.
Generated-by: OpenAI Codex
…logs Generated-by: OpenAI Codex
4 tasks
12 tasks
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
Local task entry can fail even when its Host is ready: offline Guest recovery bypasses backoff and invalidates the Owner catalog, while an abandoned
runtime-host-deployments.json.lockmakes the shared Host-list request time out. The latter also leaves Workspace settings without a default Host selection.Keep recovery-phase notifications inside active dials; wake reconnects only when changed candidates or a restored connection provide a usable path. Log once when an outage begins and once when the connection recovers; keep failed-attempt counts, first/last failure times and the latest error in copied diagnostics instead of appending each retry, even when dial errors alternate. Exclude Guest status changes from Owner new-task catalog invalidation. New routes still resume Guest connections, changed errors remain visible, and Owner replacement still invalidates its catalog.
Use the existing process-lifetime OS lock for deployment reads/migrations and updates. After acquiring Desktop's single-instance authority, startup reclaims empty legacy directory markers before opening this store. Current writers remain protected; unexpected directory contents are retained, and saved deployments are unchanged.
Verification
npm run build,npm run typecheck,npm run lint,npm run format:check, andnpx knip --workspace apps/desktop --workspace packages/uipassed.Live
dev:peersmoke on macOS with the existing default State Root: Local wasready/available, the project picker opened, onboarding returnedready_with_history, and entering a draft enabled Send. The macOS instance is the Owner; this smoke does not reproduce the Windows Guest topology. Guest-offline behavior is covered by the regressions above; Windows hardware and a real cross-device outage were not tested.AI use
Tool(s) and scope: OpenAI Codex — investigation, implementation, regression tests and PR preparation. The commit includes a
Generated-bytrailer.Checklist
Does this PR entail a change in behavior?
简体中文
Summary / 概述
即使 Local Host 已就绪,本地新任务入口仍可能不可用:离线 Guest 的恢复通知绕过重连退避并反复作废 Owner 目录;残留的
runtime-host-deployments.json.lock则会让共用的 Host 列表请求超时,使工作区设置也无法显示默认 Host。将恢复过程通知保留给正在进行的连接尝试,仅在候选路径变化或连接恢复、提供可用路径时唤醒重连;每次持续断线只在开始和恢复时各记一条日志;重试失败次数、首次/最近失败时间和最新错误保留在可复制的诊断中,即使连接错误交替变化也不逐次追加日志。相同错误不重复广播,Guest 状态不再作废 Owner 的新任务目录。新路由仍能恢复 Guest 连接,变化后的错误仍会展示,Owner 替换仍会作废其目录。
部署文件的读取迁移和修改改用现有的进程生命周期 OS 锁。启动取得 Desktop 单实例权限后,在打开该存储前回收旧的空目录锁;活跃写入者仍受保护,锁目录里的异常内容会保留,已有部署不变。
Verification / 验证
在 macOS 默认 State Root 上运行真实
dev:peer:Local 为 ready/available,项目选择器正常打开,onboarding 返回 ready_with_history,输入草稿后发送按钮可用。该 Mac 是 Owner,此检查不代表复现了 Windows Guest 拓扑;Guest 离线行为由上述回归测试覆盖,尚未进行 Windows 实机和真实跨设备断线测试。AI use / AI 使用
工具及范围:OpenAI Codex,参与调查、实现、回归测试及 PR 准备;提交包含
Generated-by标记。Checklist / 检查项
本 PR 是否改变行为?