Skip to content

docs(desktop): document the missing-Node.js bootstrap recovery - #9135

Merged
huangruiteng merged 30 commits into
loopx-project:mainfrom
LIHUA919:codex/app-nodejs-missing-9133
Nov 26, 2026
Merged

huangruiteng merged 30 commits into
loopx-project:mainfrom
LIHUA919:codex/app-nodejs-missing-9133

Conversation

@LIHUA919

@LIHUA919 LIHUA919 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Refs #9133 (the code fix for the reported case is #9184)

Goal / source

Issue #9133 (external report, LoopX 2.3.0 desktop App): first boot stops on the recovery panel with 「安装程序退出(1);App 的启动环境未找到 Node.js…」 and empty report diagnostics.

Characterization (posted on the issue): the installer runs scripts/install-local.sh, whose validate_release_candidate step executes loopx doctor --deep --installation-only; the required typescript_effect_runtime_ready check fails closed whenever the managed TypeScript runtime is not ready, including while node is missing or older than the required minimum. Doctor exits 1, the installer exits 1, and the boot page reports runtime_install_exit_1. The App deliberately does not bundle Node (Node.js 22.22.3+, 24 LTS recommended; docs/guides/installing-loopx.md).

The reporter's Node was nvm-managed, which the 2.3.0 App search could not see. #9184 (merged 2026-11-22) added nvm discovery to the App tool search, and the reporter closed the issue. This PR is the documentation half.

Current gap

The App README's Known Issues documents the fresh-Mac-without-Python analog (runtime_install_exit_2) with self-service steps, but has no entry for the Node analog, and its Prerequisites section lists only the dashboard-build Node floor (20.19+/22.12+), which understates the runtime requirement the installed App enforces.

Observable result

  • apps/desktop/loopx-control-plane/README.md Known Issues gains 「Fresh Mac without a usable Node.js stays on the boot screen」: cause, error code and diagnostics fields (environment.node_found / node_version), the bounded node search order as it stands on main, and self-service steps split by what Diagnostics report. node_found: false needs an installation. node_found: true with a version below 22.22.3 needs the entry that wins the search updated where it wins, because a later install does not displace it.
  • The Prerequisites Node bullet states the actual runtime requirement (22.22.3+, 24 LTS recommended) and keeps the dashboard-build floor as the secondary case.

Docs-only change; no runtime, packaging or UI behavior changes.

Owning boundary

apps/desktop/loopx-control-plane/README.md (desktop App distribution documentation). No protocol/RFC pair is touched, so the bilingual RFC gate is unaffected.

Validation

The branch is merged with current main (ddc2f687d) so the entry describes the search path as it now stands.

  • Search order and diagnostics, from source on this head: runtime_search_path_from, resolve_executable_path and node_environment (src-tauri/src/services.rs), the environment block (src-tauri/src/maintenance.rs), and the runtime_install_exit_1 branch in static/boot.js.
  • Core half, executed: probe_node() against a stand-in node reporting 22.22.2 gives unsupported / node_unavailable / ready=False; no node on PATH gives missing / node_unavailable; a stand-in reporting 24.11.0 gives ready. A too-old Node and a missing one therefore surface identically to the installer.
  • uv run --extra test loopx canary premerge --from-git-diff --git-diff-base ddc2f687d: risk-profile smokes 8/8 and the public-boundary scan passed (exit 0).
  • Not verified: no App was installed or launched, no Tauri repair or restart was exercised, and no local Node installation was changed. The App-side search order is established from source, not from a run.
  • DCO sign-off on every commit, including the merge.

Exact-head refresh on 2026-11-26:

  • Tested revision: 04d94a1d1d8450c9c20f29784c5b4dd9786a114c on current main at f0573ae1cb7f1b7058f12074efcca9359f9867bf.
  • Revalidated release-candidate, Node probe and installation-scope behavior: 62 passed.
  • Confirmed the documented bounded search order against current Rust source, including the leading ~/.local/bin, inherited NVM_BIN, Homebrew/keg paths, inherited PATH and discovered nvm locations.
  • Public-boundary scanning reported the changed README clean; its command-level exit reflected unrelated existing local registry migrations, not a README finding.
  • Standard premerge passed all direct checks, 8/8 catalog canaries, 8/8 risk-profile smokes and the public-boundary check with 0 holds.
  • Historical README threads describe iterative fixes already present at this exact head: guarded replacement, version qualification, backup/restore entry-type preservation, and one instance-aware lock shared by repair and restore.

The Known Issues section covers the fresh-Mac-without-Python failure
(runtime_install_exit_2) but not its Node analog: the bundled runtime
installer exits 1 when no usable Node.js is reachable, and the boot page
renders the install-and-repair guidance without a documented recovery
path. Add the parallel entry with the bounded search paths, the
Finder-versus-nvm visibility caveat and self-service steps, and align
the Prerequisites Node bullet with the runtime's actual 22.22.3+ (24 LTS
recommended) requirement instead of the dashboard-build-only floor.

Fixes loopx-project#9133

Signed-off-by: Lihua <1017343802@qq.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · Gemini · Google DeepMind · self_reported

动机 / Motivation

受影响群体为:在未安装 Node.js、仅安装低于 22.22.3 版本,或仅通过 nvm/fnm/volta 安装 Node.js 后从 Finder 启动 LoopX Desktop App 的 macOS 用户与排查启动失败的支持人员。更新前:README 仅说明缺少 Python 的退出码 2 排障,且前置条件仅写明 20.19+ / 22.12+,用户遇到 runtime_install_exit_1 时无从定位 Finder PATH 隔离与 22.22.3+ 要求;更新后:Known Issues 对齐既有 Python 条目结构,明确列出错误码、诊断字段、有界搜索路径、nvm/fnm/volta 不可见原因及安装后点击 Repair this version 的自救步骤,Prerequisites 也同步区分运行时与构建门槛。apps/desktop/loopx-control-plane/README.md 精准补充了与实际 Rust/Shell/Python 实现逐项吻合的 Node.js 缺失排障指引和前置条件说明,且不改变任何可执行代码。本 PR 不改变桌面端是否捆绑 Node.js 的产品策略,不修改 runtime_search_path、boot.js 错误提示文案、30 秒环境缓存 TTL 或任何打包构建流程。

改动思路 / Approach

本 PR 响应 Issue #9133 对全新 Mac 启动停在恢复页问题的定性与后续承诺,选择在现有 apps/desktop/loopx-control-plane/README.md 的 Known Issues(紧邻 Python 缺失条目 runtime_install_exit_2)与 Prerequisites 两处原位增补说明,而不改动桌面端不捆绑 Node.js 的既定架构或引导代码。文档改动精准落在桌面分发说明归属文件 apps/desktop/loopx-control-plane/README.md 内,复用既有 Known Issues 版块与 CLI 安装基准,零侵入生产控制面与桌面原生代码。当前 PR 边界为:仅更新 apps/desktop/loopx-control-plane/README.md 中的 Known Issues 与 Prerequisites 说明,不引入任何打包策略、Tauri 缓存清除或运行时行为调整。从长期维护看,新增条目在结构与术语上与既有 Python 排障段落及 docs/guides/installing-loopx.md 完全一致。

具体改动 / Changes

本次改动(exact head ffc582292548e1692f32287d039370875f114b62)仅编辑 apps/desktop/loopx-control-plane/README.md(+33/-1 行),严格对照需求来源 https://github.com/loopx-project/loopx/issues/9133(版本 issue-9133-comment-2026-11-20T10:07:30Z)完成了两项要求:ISSUE-9133-KNOWN-ISSUE(在 Known Issues 新增「Fresh Mac without a usable Node.js stays on the boot screen」)与 ISSUE-9133-PREREQ(在 Prerequisites 中区分运行受管 TypeScript 运行时所需的 22.22.3+ / 推荐 24 LTS 与仅覆盖 dashboard 构建的 20.19+ / 22.12+)。

关键代码讲解

虽本 PR 为纯文档变更,审查已逐行交叉核验其引用的桌面启动与 Node 探测核心符号:

  1. apps/desktop/loopx-control-plane/src-tauri/src/services.rs#L1091-L1124(runtime_search_path):确认在 macOS 下精确按 ~/.local/bin、/opt/homebrew/bin、/usr/local/bin、/opt/homebrew/opt/node@24/bin、/usr/local/opt/node@24/bin、/opt/homebrew/opt/node@22/bin、/usr/local/opt/node@22/bin 及继承进程 PATH 的顺序拼接,且 bundled_runtime.rs#L199 与所有受管服务均复用同一函数 configure_runtime_environment。
  2. apps/desktop/loopx-control-plane/src-tauri/src/bundled_runtime.rs#L171-L285(install_snapshot):确认内置运行时通过 scripts/install-local.sh(第 672、883-885 行)运行 loopx --format json doctor --deep --installation-only,非零退出映射为 runtime_install_exit_{code}。
  3. loopx/control_plane/runtime/node_probe.py#L15,L106-L137(probe_node):确认 MINIMUM_NODE_VERSION = (22, 22, 3),经 shutil.which("node") 找不到或版本不足时在 loopx/release_candidate.py#L325-L349 使必选检查 typescript_effect_runtime_ready 失败,进而由 loopx/cli_commands/doctor.py#L92 返回退出码 1(fail-closed)。
  4. apps/desktop/loopx-control-plane/src-tauri/src/maintenance.rs#L799-L876(reinstall_bundled_runtime)与 static/boot.js#L191-L255:确认 Recovery & updates -> Diagnostics 准确暴露 error_code 与 environment.node_found / node_version,且点击 Repair this version 后重置 runtime_retry 并由 lib.rs#L230-L312 实时监督线程重连同一窗口而无需第二次重启 App;同时 scripts/dashboard.sh#L12 证实 20.19+ or 22.12+ 确实仅用于 dashboard 构建。

对主干的风险 / Risks

未发现阻塞性缺陷(No blocking findings)。变更不涉及可执行逻辑、公共 API、默认配置或双语 RFC 成对文件,因此无功能回归风险。唯一可指出的非阻塞细节观察是:maintenance.rs#L580,L632-L639 对 desktop_update_status 返回的 environment 诊断块设置了 30 秒缓存(ENVIRONMENT_TTL),而 reinstall_bundled_runtime 本身并不清空该缓存;因此在点击 Repair this version 时安装程序会立即使用最新的 runtime_search_path 重试并重连工作区,但若在 30 秒内紧接着再次失败,Diagnostics 文本中的 environment.node_found / node_version 需等待 TTL 过期或重开 App 才会刷新。该细节不影响自救步骤的正确性,无需阻塞本 PR。

本地独立验证结果(均在 ffc582292548e1692f32287d039370875f114b62 隔离 worktree 完成):

  • 相对链接核验(apps/desktop/loopx-control-plane/README.md 内 7 处图片链接):PASS(全部 exists=True)。
  • 底层安装校验与 Node 探测单测(tests/test_release_candidate.py、tests/control_plane/test_effect_runtime_node_probe.py、tests/test_doctor_installation_scope.py):PASS(6 passed + 50 passed)。
  • loopx check --scan-path apps/desktop/loopx-control-plane/README.md、双语 RFC 门禁与 loopx canary premerge --tier quick(3/3 catalog canaries + 1/1 public boundary):PASS。

我的整体评价 / Verdict

仅修改 apps/desktop/loopx-control-plane/README.md Markdown 文档,未触及前端 HTML/CSS/JS 或任何渲染界面。无(未在全新裸机 macOS 上执行实机 .app 安装点击,已通过源码逐行交叉核验及单元测试替代)。本 PR 对主干长程语义无扰动(long_horizon: preserved),对桌面端首次启动遇阻用户的排障体验有清晰正向改善(user_experience: improved),全部文档陈述、路径、版本要求与错误码均已对照 exact-head 源码逐项核实准确,公私边界与门禁检查全部通过,建议合入。

English verdict: APPROVE — exact head ffc582292548e1692f32287d039370875f114b62 accurately documents runtime_install_exit_1, environment.node_found/node_version, the bounded runtime_search_path, Finder-vs-nvm visibility, self-service repair, and the 22.22.3+ runtime vs 20.19+/22.12+ dashboard-build Node floor (56 passed in underlying release-candidate/node-probe tests, boundary scan and quick premerge PASS; no blocking findings).

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

在 macOS 首次打开 LoopX App 的用户,遇到安装退出 1 后需要知道 App 实际找到了哪个 Node 版本。 当 ~/.local/bin/node 先命中且报 22.22.2 时,保留已安装的 Homebrew Node 24,Core 仍报 node_unavailable。把前置入口指向合格 Node 后,同一个探测才通过。 新版说明把 App 的 Node 22.22.3 下限、诊断入口及修复按钮连到真实失败路径。 本次改动补的是 App README 的恢复步骤,现有安装器、路径策略和诊断字段仍由原代码维护。 缺口在于说明只引导安装另一个版本,少了识别并处理优先命中的旧版本这一步。 问题 #9133

改动思路 / Approach

保留 App 的路径顺序和 Core 的资格校验。README 需要让读者根据 App 的探测结果修复它最先命中的入口。 补齐受支持启动配置的解释和手动恢复,沿用已有诊断与修复入口。 终端里执行 node --version 只能验证交互式 shell。App 诊断报告的版本才对应本次修复所用的路径。单独链接安装指南无法指明这个差别。

具体改动 / Changes

审查提交 ffc5822。README 单文件 +33/-1,新增已知问题和自助步骤,更新运行要求。按基线安装指南核查三点。运行版本下限与 Core 一致。App 路径与诊断列出了正确的候选位置和错误字段。旧版本遮蔽时的恢复仍缺少判断和操作。

关键代码讲解

  • runtime_search_path 先排 ~/.local/bin,再排系统与 Homebrew 通用位置,最后才到 keg 路径和继承的 PATH。路径顺序
  • node_environment 报告第一个命中的文件与可解析版本。probe_node 检查同一个启动环境里实际选中的可执行文件是否合格。App 诊断 Core 探测
  • README 的第 2 步把安装 node@24 列为可直接修复的操作,前序版本会影响这个结果。自助步骤

对主干的风险 / Risks

[P2] 补上旧 Node 排在新安装之前时的修复步骤。 我用准确头的两段 Rust 路径逻辑和 Core 探测复核了先后顺序。缺少 Node 与只找到 22.22.2 均触发 node_unavailable。真正命中 Node 24.21.0 时,原探测通过。 当 ~/.local/bin/node 先命中且报 22.22.2 时,保留已安装的 Homebrew Node 24,Core 仍报 node_unavailable。把前置入口指向合格 Node 后,同一个探测才通过。 仅安装后序的 Homebrew keg 会让已按说明操作的用户再次收到同一个启动错误。补一条分支:node_found 为 true 但 node_version 过旧或缺失时,先用 App 的路径顺序核对并更新优先命中的 Node。装入后序 keg 不会自动替换前序入口,确认 App 报告了受支持版本再修复。

原 Node 探测与安装诊断 50 项通过。Quick premerge 的 4 项直接和 4 项选定检查均通过。

语义与 CI 对齐

沿用 runtime_install_exit_1、node_found、node_version 和 Core 的 node_unavailable。App 找到文件和 Core 认可版本是两次判断。用前序旧 Node 加后序受支持 keg 检查 README 步骤,再只替换前序入口并验证诊断版本变化。

我的整体评价 / Verdict

求改。这份说明能帮助完全缺少 Node 的用户,补上先命中旧版本的分支后也能覆盖诊断发现不可用版本的用户。这个修复只需要改文档。这次只改 README,App 恢复面板的界面和行为没有 diff。 本轮用 macOS 上的 Rust 路径选择函数与真实 Core Node 探测做配对。未安装 App 或执行 Tauri 修复、重启与重连,也未改本机 Node 安装。

English verdict: REQUEST_CHANGES at ffc5822. Document how to replace the earlier unsupported Node that still wins after a supported keg is installed.

…nodejs-missing-9133

Signed-off-by: Lihua <1017343802@qq.com>
The missing-Node known-issue entry only told readers to install Node.js.
When an older `node` already sits earlier in the App's bounded search path
(for example `~/.local/bin/node` reporting 22.22.2), a later Homebrew or
keg-only install does not displace it, Core keeps reporting
`node_unavailable`, and the same `runtime_install_exit_1` returns.

Split self-service by what Diagnostics report: `node_found: false` needs an
installation; `node_found: true` with a version below 22.22.3 needs the
winning entry updated where it wins. Diagnostics report the version but not
the path, so the entry lists the search order and tells the reader to confirm
the reported version before repairing.

Also align the entry with the search path as it now stands on main, which
discovers nvm installations on disk (loopx-project#9184): the order gains the `NVM_BIN`
and nvm locations, and only fnm/volta remain invisible to a Finder launch.

Signed-off-by: Lihua <1017343802@qq.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

在 macOS 首次启动 LoopX App 的用户需要从恢复面板判断 Node 是否可用。旧 Node 位于 App 搜索路径前面,系统已有另一个受支持版本,固定示例所指的 Homebrew keg 尚不存在。用户应能确认 App 实际选中的版本,并安全更新入口后重试安装。本次交付为桌面 App README 的自助恢复说明,沿用现有安装器和界面。 上轮指出的版本遮蔽已经有说明。新增的命令在找不到示例目标时会改坏原入口。 问题 #9133 上轮评审

改动思路 / Approach

沿用 App 诊断与 Core 资格校验,先确认实际目标再操作旧入口。这份说明覆盖 macOS 缺少 Node、首个 Node 过旧及修复前的诊断读回。 新版说明用 App 诊断区分缺少 Node、旧版本排在前面和读不到版本,再引导使用现有修复按钮。先核对 App 的搜索顺序,确认实际目标存在并返回可用版本,也应保留已有的普通启动文件。 原生搜索 诊断入口

具体改动 / Changes

依据 ddc2f68 核对完整单文件改动 +53/−1。

  • 运行版本下限。README 写明运行时需要 Node 22.22.3+,推荐 24 LTS,并保留 Dashboard 构建的版本下限。真实 Core 探测显示缺失和 22.22.2 都不合格,24.21.0 可用。 安装指南 Core 探测
  • App 路径及诊断。补充优先目录、仍匹配继承 PATH 的 NVM_BIN、Homebrew、继承 PATH 与磁盘 nvm 位置。同源 Rust 函数实际选择前序 22.22.2。将已验证的可执行文件放在该入口后,Core 探测通过。 路径顺序 恢复面板
  • 安全恢复入口。README 用固定 node@24 路径强制重建链接。通过官方安装器或其他路径装有合格版本时,这个可选 keg 可能不存在。先验证实际目标并保留既有文件,再用 App 诊断读回决定是否重试。 恢复步骤

对主干的风险 / Risks

  • [P2] 改写入口前验证实际目标并保留原启动文件。 在隔离 macOS 目录中,原入口是普通可执行文件,示例目标不存在。BSD ln -sf 仍退出 0,把原文件换成悬空链接。后序 Node 可能让诊断继续通过,掩盖原文件被移除。对照先保留原文件,再链接已核验的 24.21.0,保留的文件内容未变,Core 也选择了正确入口。诊断读不到版本时,应先检查文件和探测结果。 可执行入口 示例命令
  • 56 项定向测试、4 项直接检查及 standard premerge 选出的 17 项检查均通过。本轮覆盖准确源码的路径解析、Core 实际子进程和 BSD 命令,正式安装及真实 App 重连待验。

我的整体评价 / Verdict

保留路径顺序和诊断读回这两处修正。请在替换启动器前验证用户实际安装路径与版本,已有普通文件时先保留或原位升级。用缺失的示例目标和存在的实际目标各验证一次。 README

English verdict: REQUEST_CHANGES at 5805c26. The old Node precedence guidance is verified. The unguarded force-link example removes an existing regular launcher even when the target is absent. Verify the actual binary and preserve the original before replacement.

@LIHUA919

Copy link
Copy Markdown
Contributor Author

Addressed on a new head 5805c2634: a merge of current main (ddc2f687d), then one DCO-signed commit.

Older Node that still wins. Self-service is now split by what Diagnostics report. node_found: true with a node_version below 22.22.3 is called out as the case an additional install does not fix: the App runs the node from the first search path entry that holds one, so the step tells the reader to check the documented order, update the winning entry in place or point it at the supported installation (ln -sf /opt/homebrew/opt/node@24/bin/node ~/.local/bin/node, /usr/local/opt/... with Intel Homebrew), then confirm Diagnostics reports 22.22.3 or newer before pressing Repair. node_found: true with no node_version is handled the same way. The entry also notes that Diagnostics report the version but not the path, that the boot screen names the missing Node.js only when node_found is false, the 30-second environment refresh, and that a terminal node --version answers for the interactive shell.

Aligned with the search path on current main. Merging main brought in #9184 (nvm discovery), so the entry no longer says nvm installations are invisible to the App. It lists the order as it now stands (~/.local/bin, an NVM_BIN the inherited PATH still selects, Homebrew, the keg-only prefixes, the inherited PATH, nvm locations found on disk) and limits the invisibility caveat to fnm/volta. The PR now references #9133 instead of closing it, since #9184 is the code fix.

Checked on this head

  • Source: runtime_search_path_from and resolve_executable_path (services.rs), the environment block (maintenance.rs) and the runtime_install_exit_1 branch (boot.js). ~/.local/bin still leads, so the shadowing case stands after fix(desktop): discover nvm-managed Node in the App tool search #9184.
  • Core, executed: probe_node() with a stand-in node reporting 22.22.2 gives unsupported / node_unavailable / ready=False; no node gives missing / node_unavailable; 24.11.0 gives ready. Missing and too-old are indistinguishable to the installer.
  • loopx canary premerge --from-git-diff --git-diff-base ddc2f687d: risk-profile smokes 8/8, public-boundary scan passed.

Not verified: the App-side order is established from source only. No App was installed or launched, no Tauri repair or restart was exercised, no local Node installation was changed, and the ln -sf remedy was not exercised against a running App.

…target

The recovery step pointed `~/.local/bin/node` at the keg-only `node@24`
path with a bare `ln -sf`. BSD `ln -sf` exits 0 when that target does not
exist, so a reader whose supported Node lives elsewhere would trade the
original launcher for a dangling link, and a later Node on the search path
could let diagnostics pass without the original file ever being restored.

The step now sends the reader to a binary they have confirmed, chains the
version check ahead of any move, and keeps the old file as
`node.before-loopx`. An entry that reports no version is to be inspected
before it is replaced.

Signed-off-by: Lihua <1017343802@qq.com>
@LIHUA919

Copy link
Copy Markdown
Contributor Author

Addressed on 1c1ebe5a3 (one DCO-signed commit on top of 5805c2634).

Guarded replacement. Step 3 no longer uses a bare ln -sf. It sends the reader to a supported binary they have confirmed (the keg path is an example, next to "the path your own supported Node is installed at"), chains "$node" --version ahead of the move, and keeps the old file as node.before-loopx. An entry that reports no version is now to be inspected with ls -l and the same --version call before it is replaced.

Checked both ways against the real Core probe on this head. In an isolated directory whose ~/.local/bin/node prints 22.22.2:

  • Target absent: probe_node() before is unsupported / node_unavailable; the sequence exits 127 at the version check; ~/.local/bin/node is still the original regular file; probe_node() after is unchanged.
  • Target present: the sequence exits 0 and prints v24.11.0; node is a resolving link, node.before-loopx holds the original; probe_node() after is ready, version 24.11.0.

The hazard as previously written was reproduced first: ln -sf <missing target> ~/.local/bin/node exits 0 and leaves a dangling link in place of the regular file.

loopx canary premerge --from-git-diff --git-diff-base ddc2f687d: 17 selected checks, 0 failures (catalog canaries 8/8, risk-profile smokes 8/8, public-boundary scan).

Not verified: the App-side search order is still established from source only; no App was installed, launched or repaired.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

用户在 macOS App 诊断发现首个 Node 过旧,尝试安全更换后重新运行 Repair。修复时已存在上次的 Node 备份,也可能选到仍报告 22.22.2 的可执行文件。App 首次安装恢复时,已备份的启动器可以找回,且新入口需要通过 Core 的版本资格。交付范围是桌面 App 的 Node 自助恢复说明,沿用现有安装器和界面。 #9133 的问题发生在首次启动。上轮指出的缺失目标场景已复测,通过 --version 前置检查后,目标缺失会中止,原启动器仍在。 原问题 上轮评审

改动思路 / Approach

本轮涉及 README 中 App 启动诊断、手动更换和修复读回。保留现有版本检查,先单独核验目标,再操作备份和链接。README 补齐 App 搜索顺序、诊断字段和手动修复路径。测试先让旧的 22.22.2 排在搜索路径最前,再以真实 24.21.0 作为成功对照。首次更换后原文件可从备份取回。 原生搜索 Core 版本探测

具体改动 / Changes

  • 运行版本下限。以 ddc2f687d1ea2cb1e4a7cac1fadee548aca54c80 为比较基线,完整 diff 是 README +67/−1。保留构建版本说明,运行时要求 22.22.3+,推荐 24 LTS。 安装指南
  • App 路径及诊断。修复说明覆盖缺少 Node、旧 Node 在 PATH 中优先,以及找到文件却无法获取版本。已确认这次提交与现行主干的 App 解析、恢复状态和 Core 探测实现一致。 诊断步骤 修复重试
  • 安全恢复入口。目标缺失时原文件保留。目标 24.21.0 且备份路径空闲时,链接和备份都按预期写入,真实 Core 探测返回 Ready。 示例命令

对主干的风险 / Risks

  • [P2] 重试恢复时保留旧的 Node 备份。 在临时 HOME 执行 README 命令,预先放入内容不同的 node.before-loopx。BSD mv 成功覆盖这份已有备份,旧内容随即丢失。若候选可执行文件报告 22.22.2,整串命令也会退出 0,Core 仍判定版本过旧。请把版本检查放到独立步骤,确认合格后再进行改动。已有备份时应保留它,或选取唯一的备份路径。 覆盖位置
  • 31 项 Core 探测测试及 standard premerge 通过。实测使用真实 macOS 文件操作、真实 Node 版本探测和隔离 HOME。已安装 App 中的 Repair 和重连仍待验证。

我的整体评价 / Verdict

路径优先级和缺失目标保护已验证。请补充已备份后重试及候选版本过旧的对照,使自助恢复保有可靠的回退路径。修复后的实际版本可由同一个 App 诊断入口读回。 恢复说明

English verdict: REQUEST_CHANGES at 1c1ebe5. A retry overwrites the previous Node backup, and a successful version command can still select 22.22.2. The isolated macOS checks verified both outcomes.

The recovery step had two gaps. The version check and the replacement were
separate blocks, so pasting both ran the move even when the candidate was
older than 22.22.3 (`--version` succeeds for any runnable node). And the
timestamped backup replaced a previous backup on retry, losing it.

The step is now one chained command: `--version` prints the candidate, a
numeric guard re-checks the same version against 22.22.3, and the move and
link only run when every earlier line succeeded. The backup name is
timestamped per attempt, so retries accumulate instead of overwriting.

Signed-off-by: Lihua <1017343802@qq.com>
@LIHUA919

Copy link
Copy Markdown
Contributor Author

Addressed on 6516e9fe2 (one DCO-signed commit on top of 1c1ebe5a3).

One chained command. The two-block layout was itself part of the problem: the second block began on a new line, so the guard's failure did not stop the move. The step is now a single && chain — --version prints the candidate, a numeric guard (-e comparing against 22.22.3) re-checks the same version, and the mv plus link only run when every earlier line succeeded.

Timestamped backup. node.before-loopx."$(date +%Y%m%d-%H%M%S)" — a retry accumulates backups instead of overwriting, and the entry says to restore by copying the newest one back.

Checked with real node binaries, all four outcomes (isolated HOME, the sequence run verbatim, probe_node() before and after with the scenario's PATH):

candidate chain ~/.local/bin after probe after
real 22.22.3 exit 0 link resolves + timestamped backup ready, v22.22.3 (was unsupported/22.22.2)
real 22.14.0 (prints fine, too old) exit 1 at the guard original regular file untouched unchanged
target absent exit 127 original regular file untouched unchanged
retry over an existing node.before-loopx.20261123-120000 exit 0 old backup intact, new timestamped backup beside it ready, v22.22.3

The guard's own sanity is separate: 22.22.3 exits 0, 22.14.0 exits 1.

loopx canary premerge --from-git-diff --git-diff-base ddc2f687d: 17 selected checks, 0 failures.

Not verified: no App installed or launched, no Tauri repair or restart; the App-side search order remains established from source.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

  • [P2] 同一秒重试会覆盖备份。 在隔离 HOME 用两个可用 Node 连续跑文档的命令,两次使用同一个秒级备份名并返回成功。BSD mv 把第一份保存旧启动器的普通文件替换为第一次安装的软链接,原字节随之丢失。请使用独占创建或可保证不碰撞的备份位置。无法保留原启动器时,先停在改动前。 备份命令
  • [P2] 按说明回退会改写当前 Node。 实际备份名是 node.before-loopx.<时间>,说明里的 node.before-loopx-* 无匹配。选中真实备份后直接复制到 ~/.local/bin/node,macOS 的 BSD cp 顺着安装时创建的软链接改写了候选 Node 文件,链接留在原处。请给出对应的备份路径和替换链接目录项的回退步骤,并验证候选文件保持原字节。 回退说明

动机 / Motivation

首次启动因 Node 缺失或过旧停在引导页的 macOS 用户,需要核对实际入口、替换启动器并在失败时恢复。当前提交能拒绝缺失或过旧的候选,并保留不同名称的备份。同秒重试和复制回退仍会破坏待保留的文件。验收要求每次保留可恢复的原启动器,并保持候选 Node 文件完好。本次范围是桌面 App 的 Node 自助恢复说明,现有安装器和探测器沿用原实现。 原缺陷 前次评审

改动思路 / Approach

本次范围是桌面 App 的 Node 自助恢复说明,现有安装器和探测器沿用原实现。先校验候选版本,再独占保留备份。回退应替换启动器目录项,避免跟随它当前的软链接。 测试用临时目录使真实文件系统操作可重复,也能逐字核对待保留的文件。 版本检查 Core 探测

具体改动 / Changes

  • 运行版本下限。相对 ddc2f687d1ea2cb1e4a7cac1fadee548aca54c80 的完整差异为一份 README,+73/−1。补充 Node 22.22.3 最低版本,保留 24 LTS 推荐及构建依赖说明。 安装规范
  • App 路径及诊断。说明 App 的首个可用路径与独立诊断。实测目标缺失退出 127,22.22.2 退出 1,两者保留原启动器。真实 24.21.0 在无名称冲突时成功创建链接和备份,既有不同名称的备份仍在。
  • 安全恢复入口。首次记录可读回,秒级命名冲突与回退复制使用实际 macOS 文件操作复现,涉及隔离目录内的文件。 新恢复步骤

对主干的风险 / Risks

准确提交的 31 项 Core 探测测试通过。标准预合并 4 项直接检查、17 项选定检查通过。实际安装 App 中的 Repair 和重连未验证。文档中的回退如果跟随软链接,影响可扩展到其他共用该 Node 文件的入口。两项反例均用本机文件系统,改写发生在显式选中的隔离候选,记录中同时核对了原文件和新链接的目标。

我的整体评价 / Verdict

请补齐可重复的备份与回退步骤,再用同秒重试和回退对照确认旧启动器与所选 Node 均可保留。候选版本资格的修复已通过复测,后续可沿现有诊断入口读回最终所选 Node。

English verdict: REQUEST_CHANGES at 6516e9f. Version validation works. Two same-second repairs lose the original timestamped backup, and the prescribed copy can overwrite the supported Node behind the launcher symlink.

The fifth review round verified the older-Node precedence guidance and the
missing-target protection, and confirmed the first repair keeps the original
bytes. Two gaps remained in the recovery half: two repairs inside the same
second chose the same timestamped backup name and the second `mv` replaced
the first backup, and the restore line copied through the launcher symlink,
which follows it and rewrites the supported Node binary other tools share.

The replacement now fails closed on an existing backup name (`[ ! -e ] &&
[ ! -L ]` ahead of the move), and the restore removes the launcher entry
before copying the newest backup in, so `cp` creates a fresh regular file
instead of writing through the link. `shasum` brackets the restore and no
longer depends on the repair-time variable.

Signed-off-by: Lihua <1017343802@qq.com>
@LIHUA919

Copy link
Copy Markdown
Contributor Author

Addressed on 89639195c (one DCO-signed commit on top of 6516e9fe2).

Same-second retry. The replacement chain now ends with an exclusive-creation check instead of a blind mv: backup=...$(date +%Y%m%d-%H%M%S) followed by [ ! -e "$backup" ] && [ ! -L "$backup" ] ahead of the move and link. Two repairs within the same second select the same name, the test fails, and the chain stops before anything is moved — the original launcher stays in place and the first backup keeps its bytes. Re-running a second later picks a fresh name.

Restore without touching the candidate. The restore now removes the launcher entry before copying: rm ~/.local/bin/node && cp "$newest" ~/.local/bin/node. With the link entry gone, cp creates a fresh regular file — it cannot follow the link into the supported Node binary other tools share. shasum brackets the copy ("$newest" before, "$newest" ~/.local/bin/node after) and the restore no longer depends on the repair-time variable, so it works from a fresh terminal days later.

Checked against the real Core probe on this head (isolated HOME, the documented commands verbatim):

  • Same-second retry: first repair exit 0 (backup created, original bytes inside), second repair exit 1 at the name check; the first backup still holds the original launcher bytes; ~/.local/bin ends with the link plus one backup, no overwrite.
  • Restore after a repair: exit 0; ~/.local/bin/node is a fresh regular file whose bytes match the backup; the supported candidate binary's checksum unchanged; probe_node() through the restored launcher reads the old version again.
  • The missing-target and too-old-candidate stops from the previous round still hold (--version prints the candidate, the numeric guard rejects 22.22.2, the original file is never moved).

loopx canary premerge --from-git-diff --git-diff-base ddc2f687d: 17 selected checks, 0 failures.

Not verified: no App installed or launched, no Tauri repair or restart; the App-side search order remains established from source.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

因 Node 缺失或过旧卡在桌面 App 引导页的 macOS 用户,需要更新实际命中的启动器,并能恢复原来的入口。 前一提交在同秒顺序重试时会覆盖备份,回退命令也会顺着当前软链改写已选的新 Node。 这版安全拒绝了单窗口内的同秒重试,也保护了新 Node 文件。两个窗口同时开始修复时仍可能丢失原备份,原启动器是软链时回退会把它变成普通文件。 自助流程应拒绝无效候选,完整保留旧入口,并让用户恢复原来的 Node 路由。 这次改动集中在桌面安装说明的版本、探测、备份与回退步骤,使用原有 App 和 Core 行为。 前次评审

改动思路 / Approach

保留 App 的入口诊断和现有 Node 版本门槛。在移动旧启动器前以原子的方式为每次修复保留备份位置。回退按备份的目录项类型恢复原入口,再验证链接目标与受保护候选。 这次改动集中在桌面安装说明的版本、探测、备份与回退步骤,使用原有 App 和 Core 行为。 这些步骤会改写真正的启动器,验证应覆盖文件内容和目录项类型。

具体改动 / Changes

关键代码讲解

  • runtime_search_path_from。按 App 的优先序查找已安装 Node。 精确提交
  • process.versions.node。在移动原入口前由所选 Node 执行最低版本校验。 精确提交
  • 备份存在检查与 mv。两次存在检查和移动之间没有排他保护。 精确提交
  • cp 回退命令。替换目的软链后仍会解引用备份源软链。 精确提交

按 2026-11-22T14:26:03Z 的问题范围,NODE_DIAGNOSTICS 已覆盖。用户恢复路径的 BACKUP_PRESERVATION 与 ROLLBACK_ROUTE 仍未满足。 原始问题

对主干的风险 / Risks

  • P2 并发同秒修复覆盖原启动器备份。 两个 Terminal 同秒启动都检查到同名备份不存在。放行第一个完整修复,再放行第二个,两个命令均退出 0,第二个 mv 用第一次的软链覆盖唯一备份,原启动器字节不再可恢复。 先用原子目录创建为一次修复保留独占备份位置,或锁定同一启动器后再检查和移动。用实际并发次序验证至少保留原入口。 备份检查
  • P2 回退消除原 Node 软链。 原启动器是指向版本管理器的软链时,备份保留了软链。回退 cp 会跟随备份源,把它变成一个普通文件。两个 shasum 相等、命令退出 0,之后版本管理器更新目标时,恢复后的入口继续运行旧副本。 让回退保留原目录项类型,例如在同目录暂存复制软链本身,再替换当前入口。检查 readlink 和候选文件的前后摘要,再测试版本管理器更新目标。 复制步骤

语义与 CI 对齐

缺失候选退出 127,22.22.2 候选退出 1,均保留原文件。顺序同秒重试由前一提交 0/0 改为当前 0/1。普通文件回退成功,受保护候选字节相同。 用真实 macOS Bash、BSD mv、cp、ln 和 Node 24,运行精确 README 代码块。只换测试路径和时钟值,在最后一次存在检查之后控制并发次序。Core Node 探测 31 项通过。 当前只改一份 README,+96/−1,差异检查通过。上面两项分别执行了两进程时序、软链回退。验证使用隔离文件夹和 Node 24。实际安装 App 的 Repair 按钮和重连尚未运行。

我的整体评价 / Verdict

当前版本保留了前次修改的版本检查,顺序冲突和普通文件回退已经过实际复测。要求保住并发下的原始备份,并恢复旧入口的类型与目标,才能让用户按该说明完整回退。

English verdict: REQUEST_CHANGES at 8963919. Concurrent same-second repairs can still replace the only original backup. Rolling back a backed-up symlink copies its target into a regular file and loses the original route.

…ry type

The recovery steps still had two holes. The existence check and the move
were separate lines, so two repairs started in the same second (from two
Terminal windows) both passed the check and the second move replaced the
only backup — a symlink by then — losing the original launcher bytes. And
the restore copied the backup through `cp` without regard to its entry
type: when the original launcher was itself a symlink into a version
manager, the copy turned the restored entry into a regular file pinned to
one version, losing the route.

The replacement reserves the backup slot with `mkdir`, which is atomic and
exclusive: the losing repair stops with the original launcher untouched.
The restore now preserves the backup's entry type — a symlink is recreated
with the same target so version-manager updates keep being followed, a
regular file is copied byte for byte — and removes the current entry
before the copy so nothing writes through the link into the supported
binary. The `shasum` bracket reads the backup's launcher and the restored
entry; the sequence no longer depends on the repair-time variable.

Signed-off-by: Lihua <1017343802@qq.com>
@LIHUA919

Copy link
Copy Markdown
Contributor Author

Addressed on c40472744 (one DCO-signed commit on top of 89639195c).

Concurrent same-second repairs. The backup is now reserved by mkdir "$backup" — an atomic, exclusive operation — ahead of the move, and the moved launcher lands inside that directory ($backup/node). A second repair in the same second from another window fails its mkdir and stops with the original launcher untouched; the winning repair's directory holds the only copy of the original bytes. The losing attempt owns nothing and overwrites nothing.

Restore preserves the entry type. The restore picks the newest backup directory and restores its node entry by type: a symlink backup is recreated as a symlink with the same target (readlink), so a later version-manager update of that target is still followed; a regular backup is copied byte for byte. The current entry is removed before either step, so nothing writes through the link into the supported binary other tools share. The shasum bracket reads the backup's launcher before and the restored entry after — both through their routes — and must match.

Checked with real binaries and real filesystem operations on this head, using Node 24 stand-ins and isolated HOMEs:

scenario result
two concurrent same-second repairs (real parallel processes) exactly one exit 0, the other stops; exactly one backup directory, holding the original bytes
sequential retry with a frozen timestamp second attempt stops; the backup still holds the original bytes
repair + restore, launcher was a symlink into a version manager backup keeps the symlink; restore recreates it with the same target (realpath matches); supported binary bytes unchanged; probe_node() still follows the route
repair + restore, launcher was a regular file restore recreates it byte for byte; candidate bytes unchanged; probe_node() reads the restored old version again
too-old candidate (real 22.14.0) guard stops, original untouched

loopx canary premerge --from-git-diff --git-diff-base ddc2f687d: 17 selected checks, 0 failures.

Not verified: no App installed or launched; the App-side search order remains established from source.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

macOS 用户首次打开 LoopX App,遇到缺少或过旧 Node,需要从引导页找出并安全更新实际命中的启动器。 前一版用存在检查保护备份,两个终端可能同秒覆盖原启动器。回退原 Node 软链时也会把它变成普通文件。 新版用目录独占避免同秒覆盖,绝对软链回退保持原类型。相对软链或换链中断时,README 的回退仍无法恢复旧入口。 备份应保留原启动器,回退应在有或没有新启动器时恢复原路由,并保护新的 Node 文件。 改动范围是桌面 App README 的 Node 自助排障,沿用现有引导、安装器和版本探测。 原问题 前次评审

改动思路 / Approach

维持 App 诊断和 Core 版本校验为运行依据。手动换链用独占目录留存,以用户选中的备份还原目录项。用 readlink 检查软链目标字符串,用文件摘要检查普通文件。恢复需要覆盖换链中断的状态。 改动范围是桌面 App README 的 Node 自助排障,沿用现有引导、安装器和版本探测。 文档给出实际执行的恢复命令。已观察到 App 与 Core 在准确头、合并基线和当前主干使用同一实现,恢复差异来自这些命令对目录项的处理。

具体改动 / Changes

审查准确头 c40472744ab9266f5589534784ec8d99f5074767,合并基线 ddc2f687d1ea2cb1e4a7cac1fadee548aca54c80。完整变更只涉及桌面 README,增加 105 行并删除 1 行。Node 运行门槛对齐已存在的 22.22.3+ 规范,推荐 24 LTS。受影响的用户沿原引导页诊断路径读回实际版本,再执行换链或回退。 安装指南

关键代码讲解

  • runtime_search_path_from。从 ~/.local/bin 起按有限顺序找到 Node,运行时及文档使用同一来源。 准确提交
  • probe_node。探测真实启动器版本,并区分缺失、过旧与可用。 准确提交
  • mkdir 与 mv。以原子目录锁定备份位置,并把旧启动器移入该目录。 准确提交
  • shasum 与 rm。回退先尝试解引用备份,再删除现有入口,两个命令都会决定是否进入恢复分支。 准确提交

以 2026-11-22T14:26:03Z 的 #9133 和这次给出的恢复承诺为准,NODE_DIAGNOSTICS 与同秒 BACKUP_PRESERVATION 已覆盖。前次指出的同秒覆盖和绝对软链退化均已用实际操作复核通过。相对软链与中断后找回入口仍属于 ROLLBACK_ROUTE 要求。 需求来源

对主干的风险 / Risks

  • P2 回退无法恢复相对 Node 软链。 旧的 ~/.local/bin/node 是指向 ../../toolchain/node 的有效相对软链。修复把它移进备份子目录后,同一相对值从不同目录解析。回退第一个 shasum 退出 1,修复后的链接仍在,原 Node 路由没有恢复。 在解引用前识别备份软链。用 readlink 保存和比较链接原值,并按原启动器所在目录验证相对目标。先建立待恢复入口,再替换现场。 回退入口
  • P2 换链失败后缺失的启动器阻断回退。 修复把旧入口移入备份后,模拟 ln 失败,真实目录中只剩完好的备份,启动器缺失。回退先成功校验备份,随后 rm 因目标不存在退出 1,恢复分支没有运行。 把启动器缺失视为可恢复状态。确认所选备份可用后,存在的普通文件或软链才需要移除,缺失时直接恢复。 删除前置条件

语义与 CI 对齐

缺失候选退出 127,22.22.2 候选退出 1,均保留旧入口。同秒两个终端返回 0/1,仅一个备份目录,原字节保存。普通文件和绝对软链回退成功,两个场景的新候选保持原字节。 在 macOS 用真实 Bash、BSD 文件操作和 Node 24.21.0 运行精确 README 代码块。同秒夹具只固定时钟和 mkdir 前的调度。中断夹具只注入换链失败。Core Node 探测 31 项通过,差异检查通过。 验证覆盖隔离目录内的文件系统和 Core 版本探测。已安装 App 上的 Repair 按钮与重连尚未运行。

我的整体评价 / Verdict

文档补齐了第一次启动时用户需要的诊断,并修复前次的同秒覆盖和绝对软链问题。要求补齐相对软链和换链中断的恢复,之后按相同的 macOS 文件系统对照复验。这样用户可以从可用备份真正找回原启动器。

English verdict: REQUEST_CHANGES at c404727. Rollback aborts when the backup contains a relative symlink or when link creation failed and the current launcher is absent.

The restore aborted in two real states. A backup whose launcher was a
relative symlink (../../toolchain/node) could not be qualified from the
backup subdirectory — the same raw value resolves elsewhere — so the first
checksum exited 1 and the repaired launcher stayed in place with the
original route lost. And an interrupted repair leaves no launcher at all,
so the unconditional `rm` exited 1 before the restore branch ran.

The restore no longer dereferences the backup: it reads the raw link value
and recreates it at the original location, where a relative link resolves
exactly as it did before the repair, and copies regular backups byte for
byte. The entry is removed with `rm -f` so a missing launcher restores
directly instead of aborting. The final `shasum` on the restored entry is
the readback that the original routing works again.

Signed-off-by: Lihua <1017343802@qq.com>
@LIHUA919

Copy link
Copy Markdown
Contributor Author

Addressed on 4ca152c64 (one DCO-signed commit on top of c40472744).

Relative-symlink backups. The restore no longer dereferences the backup entry. It reads the raw link value with readlink and recreates the link with that same value at the original location, so a relative target such as ../../toolchain/node resolves exactly as it did before the repair; the regular-file branch is unchanged. The final shasum ~/.local/bin/node reads the restored entry through its route and is the readback that the original routing works again (it fails loudly only if that route was already broken before the repair).

Missing launcher after an interrupted repair. The entry is removed with rm -f, so a launcher that is already absent (an ln failure after the mv left only the backup) no longer aborts the restore — the backup is qualified by type and restored directly.

Checked with real node binaries on this head (isolated HOMEs, the documented blocks verbatim):

scenario result
regular launcher, full cycle restore exit 0; original bytes restored; probe_node() reads the old version again
absolute-symlink launcher, full cycle restore exit 0; link recreated with the same target; probe reads 24.11.0 before and after
relative-symlink launcher (../../toolchain/node), full cycle pre-repair route works; repair exit 0; restore exit 0; the recreated link resolves again and probe_node() reads 24.11.0 through it
interrupted repair (launcher absent, backup present) + restore rm -f accepts the absent entry; restore exit 0; launcher restored as a regular file with the original bytes
too-old candidate (real 22.14.0) guard stops, original untouched

loopx canary premerge --from-git-diff --git-diff-base ddc2f687d: 17 selected checks, 0 failures.

Not verified: no App installed or launched; the App-side search order remains established from source.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

首次打开桌面 App 时遇到缺少或过旧 Node 的 macOS 用户需要从应用的 Diagnostics 确认实际使用的 Node。旧启动器优先时,安装另一个版本仍会沿原路径启动。验收目标是从引导页确认 App 实际命中的 Node,安全选用受支持版本,并能从备份恢复。 完整备份能恢复相对软链和缺失的入口。备份不可用时,当前回退会移除可用的启动器。 本次范围限于桌面 README,沿用现有引导、诊断、安装器和版本探测。 这个补充与 #9184 的 nvm 搜索修复互补,提供诊断、更新和恢复步骤。 原问题 运行时修复

改动思路 / Approach

本次范围限于桌面 README,沿用现有引导、诊断、安装器和版本探测。 手动步骤先验证候选版本,再用独占目录保留原入口。恢复沿用原文件或软链的类型,软链另保留目标字符串。备份不可用时,应允许用户退出并保留原入口。

具体改动 / Changes

准确头 4ca152c641466f438ab5b6669f742d52dcd026b9,合并基线 ddc2f687d1ea2cb1e4a7cac1fadee548aca54c80。完整差异只有桌面 README(+107/−1),覆盖首次启动、发现旧版本、验证候选、备份、回退和重新 Repair。启动门槛与原运行时的 Node 22.22.3 一致。准确头与基线、当前主干的诊断和安装调用无相关变动。 说明

关键代码讲解

  • runtime_search_path_from。保持应用的 Node 查找顺序,优先检查用户本地启动器。 源码
  • probe_node。区分缺失、过旧和可用的 Node。 源码
  • mkdir / mv。以独占目录留存原目录项,随后链接到已验证的 Node。 源码
  • rm -f / readlink。允许当前入口缺失并按原类型回退,但先删入口后才检查备份。 源码

以原问题在 2026-11-22T14:26:03Z 的记录及现有运行时行为为依据,NODE_DIAGNOSTICS 和 BACKUP_PRESERVATION 已验证。ROLLBACK_SOURCE 仍需覆盖无可用备份时保留原入口。前次两处求改已经修复。实际移动相对软链到备份子目录后,按原目标值在启动器目录恢复,原解析有效。建立新链接失败后,缺失的启动器也可由完整备份恢复。 前次评审

对主干的风险 / Risks

P2 验证备份后再删除当前 Node 启动器。 未找到备份,或者最新匹配项是空目录或旧式普通备份时,回退先移除当前启动器,随后复制失败。macOS Bash 和 zsh 共六次结果均为退出 1、原入口缺失。前一评审头在同样六个输入下保留了入口。 模拟修复在建立备份目录后被打断时,即使还有更早的完整备份,也会选中最新空目录。先确定可用备份及待恢复的文件类型。无可用备份时退出并保留当前入口。有可用备份时先在启动器同目录构造并验证恢复项,再替换入口。 回退步骤

语义与 CI 对齐

当前相对链接、绝对链接和普通文件都成功还原。换链中断后只剩完整备份时也能恢复。同秒修复仅一方成功,原备份保留。缺失或过旧候选在改动前停止。 Core Node 探测 31 项通过,差异检查通过。Premerge 17 项中 16 项通过,Issue Fix PR 生命周期 smoke 超时,原因尚未归因。 本轮执行文档命令和 Core 测试。已安装 App 的 Repair 按钮及重连尚未实测。 对照在隔离目录执行,使用真实 macOS 文件工具。版本与运行时的对照未使用远端 CI。

我的整体评价 / Verdict

诊断顺序、Node 门槛和有效备份的恢复路径已覆盖。合入前补齐备份资格检查和失败时保留现有入口的验证,范围仍在这一个文档块。复验时应同时保留相对软链的路由。

English verdict: REQUEST_CHANGES at 4ca152c. Valid backups now restore relative links and absent launchers. With no usable selected backup, the documented rollback removes the working launcher before it fails.

…ncher

The rollback removed the current launcher before knowing whether the
selected backup was restorable. An interrupted repair leaves an empty
backup directory, and the newest match could also be an older flat-file
backup — in both cases the old sequence removed the working launcher and
then failed, leaving nothing.

The restore now builds the restored entry beside the launcher first: a
backup symlink is recreated with its raw value where the original launcher
lived (so a relative link resolves exactly as it did before the repair),
a regular backup is copied byte for byte, and `--version` qualifies the
staged entry where it will live. Only then does the sequence remove the
current launcher and move the staged entry into place. Unusable backups
stop the chain with the working launcher intact.

Signed-off-by: Lihua <1017343802@qq.com>
@LIHUA919

Copy link
Copy Markdown
Contributor Author

Addressed on 45d124e00 (one DCO-signed commit on top of 4ca152c64).

Qualify before removing. The restore no longer removes the current launcher until the selected backup has been built and qualified beside it: the newest match is resolved to its source (a backup directory contributes its node entry, an older flat backup file is used directly), the entry is constructed in ~/.local/bin (cp for a regular backup, ln -s with the raw readlink value for a symlink backup — recreated where the original launcher lived, so a relative link resolves exactly as it did before the repair), and "$staged" --version qualifies it where it will live. Only then: rm -f the current launcher and mv the staged entry into place. An unusable newest backup — an interrupted repair's empty directory, or a missing entry — stops the chain with the working launcher intact.

Checked against the round's inputs with real binaries on this head (isolated HOMEs, the documented block verbatim):

input result
newest = empty dir (interrupted repair) restore exits 1 before rm; launcher intact
no backups at all restore exits 1 before rm; launcher intact
newest = older-style flat regular backup restore exit 0; launcher is a fresh regular file matching the backup's bytes; probe reads the restored version
newest = usable directory backup restore exit 0; same byte-identity
newest = empty dir + an older complete backup exists stops (newest-first); launcher intact — the older backup stays restorable by naming it
newest = dir backup whose node is a relative symlink staged link built at ~/.local/bin resolves the raw value as the original launcher did; qualifies (v24.11.0); after the swap the entry is a symlink with the identical raw value and the route works
repair guard with a too-old candidate (real 22.14.0) stops before any move; launcher intact

loopx canary premerge --from-git-diff --git-diff-base ddc2f687d: 17 selected checks, 0 failures.

Not verified: no App installed or launched; the App-side search order remains established from source.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

按 Desktop App 恢复面板指引为安装器修复 Node 的 macOS 用户。 主干已有同一套 Node 搜索和诊断,恢复文档缺少 Node 对应的自助步骤。 用户能按文档核对 App 看到的版本,安全放置已确认的 Node,并在需要时恢复原入口。 同一可执行 Node 用绝对路径或从 Terminal 当前目录可执行的相对路径填入文档命令,两者都应正确链接,或在移动旧入口前拒绝。 这次改动限定于 Desktop README,沿用 App 已有诊断、安装器和 Node 版本门槛。 验收依据

改动思路 / Approach

在 Known Issues 增加 Node 缺失、版本过旧、版本无法读取、候选验证、备份恢复和 App 核对。Prerequisites 分别写出 Core runtime 与 Dashboard 构建的版本下限。 由 README 指引操作系统已有 launcher,继续从恢复面板核对 App 实际选中的版本。 这次改动限定于 Desktop README,沿用 App 已有诊断、安装器和 Node 版本门槛。 对候选路径加一个明确前置条件即可修复,现有回退暂存和版本检查可以继续使用。

具体改动 / Changes

评审提交 45d124e009293c7433d9eec508e7521ed8bfec10,合并基线 ddc2f687d1ea2cb1e4a7cac1fadee548aca54c80,范围 1 个文件(+123/−1)。ACTUAL_NODE_FLOOR 诊断采用现有 runtime 的 22.22.3 版本门槛。 BACKUP_FAILURE 无可用备份时保留当前可用 launcher。 RUNNABLE_REPLACEMENT 候选成功校验后,实际放置的入口须能执行。

关键代码讲解

  • runtime_search_path_from。把用户入口排在 NVM 和 Homebrew 之前,与安装和服务共享搜索顺序。 源码
  • node_environment。在同一搜索路径读取 Node 的存在性和版本,输出给诊断面板。 源码
  • codeText。只有证实 Node 缺失才把该安装退出码解释为找不到 Node。 源码
  • README repair block。先验证候选版本,再保留旧入口并安装链接。链接使用了 Terminal 输入的原字符串。 源码
  • README restore block。在 launcher 旁建暂存文件,验证备份可执行后才替换当前入口。 源码

确切头在 Bash 和 zsh 上均拒绝缺失、空和不可执行备份并保留当前入口。绝对候选配普通文件、绝对链接及相对链接,六组都完成安装命令和原路由恢复。 本头新增暂存与可用性检查,已修复无可用备份先删除 launcher。候选配置分支仍使用原字符串,属于修复操作,和相对原备份保留是不同输入。 上一轮评审

对主干的风险 / Risks

P2 相对候选经过版本检查后仍会生成悬空入口。 在 Terminal 工作目录用一条可执行的相对路径指定受支持的 Node,再执行 README 原样命令。 同一 Node 用绝对路径时,两种 shell 都能运行新入口并完整恢复三种旧 launcher。 Bash 和 zsh 都打印受支持版本并返回 0,随后留下一条不可执行的悬空链接。ln 按链接所在目录解析相对目标,前置检查使用 Terminal 的当前目录。旧入口备份仍在。 在移动旧入口前规范化并验证候选绝对路径,或明确要求绝对路径并早期拒绝相对输入。再从即将放置 launcher 的目录验证链接可执行。 在隔离 HOME 用同一个真实 Node 分别运行绝对及相对路径用例,断言成功后能从 launcher 执行,或拒绝时原入口和备份目录保持原样。 触发位置

语义与 CI 对齐

当前头 Node runtime/doctor 56 项定向验证及 diff 检查通过。 本地 premerge 状态为 passed。 仅执行隔离 HOME 的文档命令和 Core 定向测试。安装态 App、真实 GUI Repair 和远端 CI 未复测。

我的整体评价 / Verdict

将首个可用恢复结果作为文档验收。入口对照已执行,真实 App 安装流程另有独立验证边界。 仅变更 README 可执行说明,App 面板渲染源码无改动。 请先修复 相对候选经过版本检查后仍会生成悬空入口,然后复跑上述配对场景。确切头在 Bash 和 zsh 上均拒绝缺失、空和不可执行备份并保留当前入口。绝对候选配普通文件、绝对链接及相对链接,六组都完成安装命令和原路由恢复。

English verdict: REQUEST_CHANGES at 45d124e. Staged rollback now preserves a working launcher for unusable backups. The repair still accepts a runnable relative candidate, reports success in Bash and zsh, and installs a dangling launcher.

…e the move

The repair verified the candidate with the Terminal's current directory in
scope, but the final `ln -s "$node" ~/.local/bin/node` resolved the same
relative value against `~/.local/bin` — a runnable relative candidate such
as `./toolchain/node` produced a dangling launcher while both version
checks passed.

The chain now rewrites `node` to its absolute path (`cd` + `pwd` over
`dirname`/`basename`) after the version guard and re-runs `--version` on
the normalized path before anything is moved, and the final line runs the
installed launcher link as its own readback. A candidate that only works
from the Terminal's current directory therefore fails before the original
launcher is touched.

Signed-off-by: Lihua <1017343802@qq.com>
@LIHUA919

Copy link
Copy Markdown
Contributor Author

@/tmp/r20reply.md

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, xhigh)

动机 / Motivation

首次打开 LoopX 桌面 App 因缺少可用 Node.js 停在恢复页的 macOS 用户,需要安全替换实际命中的 Node 入口。 主干没有 Node 启动故障的自助恢复。前一头已有诊断与换链说明,但首次安装终检失败会移除另一窗口成功建立的链接。 终端窗口 A 的候选在预检可运行,安装后终检失败。窗口 B 可在 A 之后成功安装另一个可用候选。 用文档完整 Bash 片段和真实 Node 24.21.0 复验。首次创建分支现会保留后来窗口成功安装的链接,前一头在同一时序删除了该链接。 两个窗口都从已有启动器进入修复时,A 的失败回退仍覆盖 B 已通过的入口。 当前仅变更桌面 README。App 的实际搜索实现从源码核对,未启动打包 App。

A 的终检返回 7 后,无条件将原入口移回覆盖 B 的链接。最后实际 launcher 从 B 已验证的 24.21.0 退回 22.22.2。

改动思路 / Approach

沿用 App 的查找顺序和 Core 的版本资格。让两个修复分支共用同一个本地文件操作边界。 保留 Node 诊断、候选验证和可读备份。让出现并发时的回退保留另一个窗口的成功。 替换和回退应使用同一 launcher 的互斥边界,覆盖确认当前目录项、写入、终检及回退。也可使用等效原子归属校验,避免较早失败的操作覆盖较新的成功结果。 现有入口依据

具体改动 / Changes

精确 head 23945f9d915279aac41349696be7d7a368d10f06,比较基线 ddc2f687d1ea2cb1e4a7cac1fadee548aca54c80。完整 diff 仅 README,新增 216 行、删除 1 行。上一头至当前为 +6/-3,无 App/Core 实现变化。 主干缺少 Node 自助处置;前一头已有两个分支,但首次创建的失败清理会丢失后来成功入口。

关键代码讲解

  • node_qualifies。用候选 stdout、退出码和既有版本下限作预检和装后判断。 源码

  • 已有入口的替换和回退。按日期建立独占备份,终检失败时直接恢复原条目。备份目录互斥范围限于同一个名称。 源码

  • 首次创建的 inode 检查。终检失败时先核对目录项 inode,保留已经换成另一 inode 的入口。 源码

  • 手动恢复。先在同目录暂存备份并运行,确认可用后才替换当前入口。 源码

  • RESTORE_PRESERVES_VALID_LAUNCHER 尚未满足。经过版本验证的 Node 入口应能用于后续 Repair,自助回退应保留其他已成功的更新。 定位

对主干的风险 / Risks

[P2] 已有入口的失败回退会覆盖其他窗口成功安装的 Node。 原入口已存在而且版本过旧。A 和 B 在不同秒进入已有入口分支。A 移动旧入口后终检未结束,B 此时成功安装 24.21.0 并退出 0。 A 的终检返回 7 后,无条件将原入口移回覆盖 B 的链接。最后实际 launcher 从 B 已验证的 24.21.0 退回 22.22.2。 替换和回退应使用同一 launcher 的互斥边界,覆盖确认当前目录项、写入、终检及回退。也可使用等效原子归属校验,避免较早失败的操作覆盖较新的成功结果。 问题行

git diff --check 通过。原样提取文档代码,比较前后提交的四组双窗口文件状态和 Node --version。 在上一头与精确头运行首次创建和已有入口两组确定性时序。新头仅前一组修好,已有入口仍回到过旧版本。 在隔离 HOME 运行文档片段,受控时序只用于协调两个真实 Bash 进程。候选 B 使用真实 Node。打包 App 和托管 CI 未运行。

我的整体评价 / Verdict

REQUEST_CHANGES。 保留 Node 诊断、候选验证和可读备份。让出现并发时的回退保留另一个窗口的成功。 替换和回退应使用同一 launcher 的互斥边界,覆盖确认当前目录项、写入、终检及回退。也可使用等效原子归属校验,避免较早失败的操作覆盖较新的成功结果。

English verdict: REQUEST_CHANGES. With an existing launcher, an earlier failed repair can still roll back over a later successful repair and restore the unsupported Node version.

The round's interleaving: with an old launcher present, window A moves it
into its exclusive backup and installs a candidate whose final check is
still pending; window B then replaces A's installed link with its own
qualifying candidate and exits 0. A's final check fails and the failure
branch moved the original back unconditionally, overwriting B's verified
launcher — the working Node regressed from B's 24.21.0 to the 22.22.2
original.

The replacement branch now records the installed link's inode and the
failure rollback moves the original back only while the entry is still
absent or still the failed attempt's own link. A later window's swap has
a different inode and stays in place, with the failed attempt's backup
kept for the documented manual restore; a vanished entry still restores.
Same atomic ownership proof as the first-creation branch, avoiding a
lockfile whose stale state from a killed window would block future
repairs. Step 4 routes the newer-kept message to Repair this version.

Signed-off-by: Lihua <1017343802@qq.com>
@LIHUA919

Copy link
Copy Markdown
Contributor Author

@/tmp/r21reply.md

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · reasoning_effort=xhigh

动机 / Motivation

首次打开 Mac App 时缺少可用 Node.js 的用户需要能安全尝试和撤销的终端恢复步骤。主干只有 Python 对应恢复说明,已有 Node 诊断和 Core 版本下限。新提交可在入口已被另一个窗口更换后保留新链接,前提是该更换先于比较。两个分支中,比较后仍可丢失已验证的替换。范围是实际 README 与仓库门禁,打包 App 的 Repair 与远端 CI 未运行。 issue-9133

改动思路 / Approach

当前范围是桌面 README 的终端自助恢复和已有入口备份。复用 App 的诊断、Core 的版本标准和原目录项备份。可在两个写入分支共用覆盖检查、写入、终检与回退的互斥边界,或实现等效的原子归属。备份目录按时间独占保护的是各自备份。

具体改动 / Changes

精确提交 76fbbd047cda98cbe9eccfc1ba2fe4634f39dc6d 对基线 ddc2f687d1ea2cb1e4a7cac1fadee548aca54c80 只改 README,+229/-1。新版给已有入口分支增加 inode 判断和保留另窗链接的提示,首次创建分支仍按 inode 判断决定是否删除。 恢复步骤

  • 诊断与版本下限。保留已有 App/Core 的实际版本标准和定位,支持用户找到生效入口。
  • 安全恢复。比较前完成的替换通过隔离对照。两个使用真实 Bash 和文件操作的比较后场景,分别有误删与回退覆盖。时间控制仅用于安排两个终端的先后。 上轮已有入口发现

对主干的风险 / Risks

[P2] 检查与回退分开执行,依然丢失成功的 Node 入口。 A 在已有入口分支终检失败,通过 inode 比较后停在恢复备份的文件操作前。B 随后走已有入口分支,安装不同 inode 的链接并退出 0。A 恢复后把 B 覆盖为原来不合格的 22.22.2。首次创建的对照也仍失败,B 在比较后成功替换,A 随即删除 B。两个测试的目标都是同一隔离目录中的真实链接。

请让两条写路径和回退采用同一互斥边界,或用等效的原子归属保护,保留比较前和比较后两组对照。 检查与回退处

  • PASS · 替换先于比较时,成功窗口的链接被保留。premerge 4 项直接及 17 项所选检查均通过。
  • FAIL · 替换晚于比较时,原失败窗口删除该链接,或覆盖成旧版本。
  • UNVERIFIED · 实装 App 的 Repair 与远端 CI。

我的整体评价 / Verdict

保留目前有用的诊断、版本资格和备份。恢复命令需要在另一个窗口成功之后仍保住可用 Node 入口,比较保留了较早的替换,后续文件动作仍能覆盖较晚成功的操作。

English verdict: REQUEST_CHANGES at 76fbbd0. A later success can still be deleted or rolled back if it replaces the launcher after the inode check.

The round's interleaving: the inode comparison and the file action are
separate steps, so a window whose final check fails could compare (still
the owner), then lose the compare-then-act race when another window swaps
its verified launcher in before the restore or delete fires — the inode
guard alone cannot close a check-then-act gap.

The whole repair now runs inside one exclusive lock: a fixed-name
`mkdir` at ~/.local/bin/.node-loopx-repair is taken before either branch
and released by an EXIT trap, so a second window stops with "Another
repair is in progress; nothing was changed." instead of interleaving its
move, install, final check or rollback between this window's steps. A
repair killed outright can leave the lock; after 15 minutes an attempt
removes and retakes it, and the prose says how to clear a persisting
lock by hand. The inode checks stay as the guard for the one overlap
the lock cannot close — a suspended window whose stale lock was retaken.

Signed-off-by: Lihua <1017343802@qq.com>
@LIHUA919

Copy link
Copy Markdown
Contributor Author

@/tmp/r22reply.md

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

[P2] 过期锁接管后仍能删除已验证的 launcher

第一窗口完成 inode 比较后暂挂。把锁的时间设为 901 秒前,第二窗口接管、安装并核验 24.2.0,退出 0。恢复第一窗口后,第一窗口删除新链接并报告未改动。 目录锁超时只检查 mtime,不能证明进程退出或禁止原持有者继续。 在整个替换和回退期间使用随持有进程退出而释放的互斥,或用经过核验的原子归属。取消只按目录时间强行接管的路径,并保留可验证的手工恢复。 接管 回退

动机 / Motivation

首次打开 Mac App 时找不到可用 Node.js 的用户,需要在终端恢复启动入口。 主干 README 只有缺少 Python 的对应恢复步骤。现有 App 会按自己的搜索路径查找 Node 并报告可见版本。 新说明补齐诊断和版本要求,普通并发受目录锁约束。触发文档规定的过期接管后,成功的新入口仍会丢失。 验证运行了文档里的 Bash 命令和本地门禁。未启动打包 App 或查询远端 CI。

改动思路 / Approach

本轮把两种安装和回退分支放进同一个目录锁。目录锁保持新鲜时,第二窗口返回 1 并报告修复正在进行。 把锁持有、旧入口备份和失败回退作为一次操作,符合多个终端编辑同一路径时的需求。只改 README 的可执行恢复路径。目录锁超时只检查 mtime,不能证明进程退出或禁止原持有者继续。用同一个真实持有者边界约束写入和回退,避免需要新用户手工推断哪个窗口拥有当前入口。

具体改动 / Changes

精确头 493846dc08760ccb972041435fdea1b778343cfc,目标基线 ddc2f687d1ea2cb1e4a7cac1fadee548aca54c80。一份 README 增 254 行,删 1 行。此前精确头的两处检查与回退分离,本轮新鲜锁能排斥别的正常修复。过期接管下,首次创建分支仍会删掉成功入口。公开报告 #9133 对应 issue-9133,本轮核对诊断与版本下限及安全恢复。版本说明与已有 Core 下限一致,安全恢复未满足。 上轮评审

关键代码讲解

mkdir 失败后,时间检查和删除目录可把锁从仍会恢复执行的进程手中取走。首次创建回退先读 inode,随后另一次命令无条件删除路径。两处共同形成了上面的失败序列。 脚本正文

对主干的风险 / Risks

PASS。目录锁保持新鲜时,第二窗口返回 1 并报告修复正在进行。 源码 premerge 的 4 项直接与 17 项所选检查通过。

FAIL。第一窗口完成 inode 比较后暂挂。把锁的时间设为 901 秒前,第二窗口接管、安装并核验 24.2.0,退出 0。恢复第一窗口后,第一窗口删除新链接并报告未改动。 两组从同一精确提交的未修改代码块提取真实 Bash 命令,在两个独立临时 HOME 运行。对照仅改变锁的时间及允许旧窗口恢复的顺序。

语义与 CI 对齐

新鲜锁保护普通并行修复。过期路径仍需要用独立持有者和新旧 launcher 的文件身份验证。未查询远端 CI。

我的整体评价 / Verdict

请求修改。App 诊断和最低版本说明补齐了真实用户的自助缺口。成功恢复的入口可能再次丢失,而且终端仍报告没有变化。本 PR 变更的是 README 中使用者复制执行的命令,没有改变 App 的渲染界面。 在整个替换和回退期间使用随持有进程退出而释放的互斥,或用经过核验的原子归属。取消只按目录时间强行接管的路径,并保留可验证的手工恢复。

English verdict: REQUEST_CHANGES at 493846d. A stale-lock takeover lets the resumed original repair delete the verified launcher installed by a second repair.

The round's interleaving: the takeover judged a lock stale by directory
mtime alone, so it could be stolen from a merely suspended window; that
window later completed its compare-then-act cleanup and deleted the
verified launcher the takeover window had installed, reporting that
nothing was changed.

The lock now records the holder's process id. A second window retakes it
only after checking that the recorded process no longer exists — a
suspended window is alive and keeps the lock, and a killed window's lock
is removed and retaken, so the mutex releases with the holder's exit in
both cases. The takeover also requires a numeric pid, and a missing or
non-numeric pid file stops the second window with the in-progress
message instead of touching the lock (the harness caught my first
version silently exiting on a missing pid file through the && chain).
The mtime-based takeover path is gone. The inode checks remain as the
guard for the manual-removal overlap the prose documents.

Signed-off-by: Lihua <1017343802@qq.com>
@LIHUA919

Copy link
Copy Markdown
Contributor Author

@/tmp/r23reply.md

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

[P2] 修复命令返回后,锁仍占用到终端退出

在交互 Bash 和 Zsh 分别执行精确头里的代码块。首次修复成功返回且 launcher 可用,锁目录仍存在,另一终端立即重试时返回 1 并报修复正在进行。退出第一终端后同一重试成功。预先注册的 EXIT hook 也被替换。 第 604 行的 EXIT trap 绑定整个交互 shell,PID 判活随后把空闲终端视作正在修复。 让整段修复在独立、具有明确退出边界的进程里执行,把互斥及清理绑到该次操作。回归要验证成功和失败返回后锁释放,调用方已有 trap 保留。 对应源码

动机 / Motivation

这份说明面向安装后找不到可用 Node.js 的 Mac App 用户。 主干 README 提供缺 Python 的自助流程,Node.js 的搜索顺序、诊断及回退方式散落在运行时和指南中。 原文没有 Node 自助命令。新命令能更新入口,但返回后锁仍在。 本轮在真实交互式终端验证文档命令。 问题报告

改动思路 / Approach

启动诊断和安装校验沿用现有 App 与 Core。文档命令在切换本地链接前重用同一版本判断,把备份、最终检查和回退放进一次修复。 本轮可执行变更限于 README 的自助恢复命令。 锁应随修复操作结束释放,交互终端会继续服务用户。 安全的恢复需要一起验证前置条件、最终版本与旧入口保留。最小修复在现有终端操作边界收束清理,无需引入 App 新接口。 把用户实际完成一次恢复的结果与下一次重试连起来验证。首次成功打印不足以证明流程可用。

具体改动 / Changes

本轮精确 head efca33f52c7cf3a8db4a7fb4ef35ae24e622530c。当前评审包基线 ddc2f687d1ea2cb1e4a7cac1fadee548aca54c80,完整差异与源码验证以实际共同祖先 ddc2f687d1ea2cb1e4a7cac1fadee548aca54c80 为准。相对 493846d,时间接管改为 PID 判活。原先过期仍在运行的进程这轮继续持锁。 上轮评审

  • 版本与诊断。新说明补齐最低版本、Finder 的搜索边界以及保留旧 launcher 的修复流程。以 PID 判活也消除了上轮按时间接管仍在运行的修复进程的问题。
  • 终端重试。用户在指导所述终端跑完修复后,可再次修复,不残留占锁或破坏终端已有退出行为。

关键代码讲解

整份变更为一份 README 增 260 行、删 1 行,包括前置条件、诊断、创建和替换分支、失败回退及手动恢复。 node_trim 和 node_qualifies 分别做边界空白处理及版本资格检查。取得目录锁后,若已有 launcher,先创建独有备份再替换。首次创建无需备份,最终检查不通过时回退。新 PID 检查保护仍在运行的修复,但 trap ... EXIT 的生命周期超出命令本身。

对主干的风险 / Risks

PASS。有活跃修复的情况下,Bash 下新鲜锁和超过旧 900 秒阈值的锁都拒绝第二窗口。 源码 premerge 4 项直接检查、17 项所选检查均通过。

FAIL。在交互 Bash 和 Zsh 分别执行精确头里的代码块。首次修复成功返回且 launcher 可用,锁目录仍存在,另一终端立即重试时返回 1 并报修复正在进行。退出第一终端后同一重试成功。预先注册的 EXIT hook 也被替换。 交互 Bash/Zsh 的对照在临时目录执行,覆盖成功返回后原终端仍运行、另一窗口重试,以及原终端退出后可重试。

语义与 CI 对齐

版本、诊断和 App 运行时默认路径没有变动。当前反例集中在用户主动复制命令后的终端状态及重试。 独立验证运行了 macOS 上的终端代码和源码门禁。未启动打包 App,未核实真实安装态,未查询远端 CI。

我的整体评价 / Verdict

请求修改。新说明补齐最低版本、Finder 的搜索边界以及保留旧 launcher 的修复流程。以 PID 判活也消除了上轮按时间接管仍在运行的修复进程的问题。 让整段修复在独立、具有明确退出边界的进程里执行,把互斥及清理绑到该次操作。回归要验证成功和失败返回后锁释放,调用方已有 trap 保留。

English verdict: REQUEST_CHANGES at efca33f. The interactive Bash and Zsh block returns success while holding the repair lock until terminal exit and replaces the caller’s EXIT hook.

The round's interleaving: pasted into an interactive Bash or Zsh, the
block's EXIT trap bound to the whole terminal — a successful repair
returned to the prompt still holding the lock (the idle terminal's pid
also blocks the holder-liveness takeover), a second terminal's immediate
retry failed until the first terminal exited, and the caller's own
pre-registered EXIT hook was replaced by ours.

The whole repair now runs inside one subshell. The exclusive mkdir, the
pid record and the EXIT cleanup belong to that subshell's lifetime: the
lock releases when the repair finishes, the failure exits never close
the user's terminal, and any EXIT hook the caller had registered stays
untouched. The recorded pid identifies the terminal session that started
the repair, so a terminal killed outright is still retaken once its
process is gone.

Signed-off-by: Lihua <1017343802@qq.com>
@LIHUA919

Copy link
Copy Markdown
Contributor Author

@/tmp/r24reply.md

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

[P2] 修复子进程结束后,锁仍将空闲终端视为持有者

在 Bash 和 Zsh 的隔离运行中,只中断修复子进程后该次命令以 137 返回。锁中仍记录活着的外层 shell,第二窗口退出 1 并报告修复正在进行。关闭空闲的第一个终端后,同一重试才成功。 子 shell 在正常退出时执行 trap,锁内保存的 PID 却属于外层终端。这两个生命周期在修复提前中断后分开,判活结果无法代表修复状态。 让互斥的拥有者和执行替换的工作边界一致。用一个独立执行进程或适合 Bash 与 Zsh 的同一锁机制验证正常退出、子进程中断和重试。 对应源码

动机 / Motivation

首次启动时找不到合格 Node.js 的 Mac App 用户,需要恢复自己的启动入口并能从中断重试。 主干 README 的自助恢复只对应缺少 Python。上轮 Node 命令直接用交互 shell 的 EXIT hook,成功完成后仍会留锁。 正常返回后可以立刻重试。修复子进程提前中断时,空闲终端仍会被当作在修复。 本轮核对已执行的终端命令、进程与本地入口。 适用依据

改动思路 / Approach

代码块分离出自己的子 shell,保留已存在终端状态和原前置检查。取得锁、验证 Node 版本和恢复备份继续是同一次操作。 修复应留在本地 launcher 的替换与恢复操作内。 锁的判活判定必须和实际修复进程生命周期一致。 无需改 App 启动或新增长期状态。把已有来路、版本检查和回退留在单次执行边界,同时使用该边界的实际持有者。 检查用户完成修复或遇到中断时的下一步,而非只根据一次成功输出推断恢复可用。

具体改动 / Changes

本轮精确 head f8f8447b5fac1ff8c0166877f2bc58df70d4209a。当前评审包基线 ddc2f687d1ea2cb1e4a7cac1fadee548aca54c80,完整差异与源码验证以实际共同祖先 ddc2f687d1ea2cb1e4a7cac1fadee548aca54c80 为准。相对 efca33f,新增子 shell,解决正常结束后仍留锁的问题。锁 PID 写入和检查规则没有随实际工作进程调整。 上轮评审

  • 正常修复重试。新版补齐 Node 查找路径和最低版本,正常退出后锁释放,外部 shell 的 EXIT hook 和下一次修复可用性都已验证。
  • 中断恢复。能按实际修复进程区分还在进行和已经中断,使正常、失败与再次修复结果可判断。

关键代码讲解

整个 PR 一份 README 增 264 行、删 1 行,说明安装要求、诊断和创建、替换、回退及恢复。没有改 App 二进制。 node_trim 与 node_qualifies 共享版本资格,备份和恢复保留原 launcher。新子 shell 使清理与终端的正常交互分开,但记录 PID 的语义没有随宿主范围改变。

对主干的风险 / Risks

PASS。Bash 与 Zsh 均正常返回 0,锁随子 shell 释放,第二窗口随即成功。外层已有 EXIT hook 仍会执行。 源码 premerge 4 项直接检查、17 项所选检查均通过。

FAIL。在 Bash 和 Zsh 的隔离运行中,只中断修复子进程后该次命令以 137 返回。锁中仍记录活着的外层 shell,第二窗口退出 1 并报告修复正在进行。关闭空闲的第一个终端后,同一重试才成功。 独立临时 HOME 中从原文执行代码块,分别验证正常结束和本地测试子进程中断后的退出码、锁、父 shell 存活与重试。

语义与 CI 对齐

正常路径和调用终端退出动作已修复。当前反例只涉及工作子进程提前终止后仍运行的调用终端。 本轮用实际 macOS Bash 与 Zsh 验证代码块、进程和文件。未安装或启动打包 App,未查询远端 CI。

我的整体评价 / Verdict

请求修改。新版补齐 Node 查找路径和最低版本,正常退出后锁释放,外部 shell 的 EXIT hook 和下一次修复可用性都已验证。 让互斥的拥有者和执行替换的工作边界一致。用一个独立执行进程或适合 Bash 与 Zsh 的同一锁机制验证正常退出、子进程中断和重试。

English verdict: REQUEST_CHANGES at f8f8447. The subshell fixes normal lock release, but an interrupted repair still leaves a lock owned by the idle outer shell and prevents a valid retry.

The round's interleaving: the lock recorded the terminal's process id,
but the work runs in the subshell. An interrupted repair — the subshell
killed outright, exit 137 — left the lock behind while the recorded
holder, the idle terminal, stayed alive, so the holder-liveness takeover
refused every retry until the terminal was closed.

The lock now records the repair subshell's own process id, looked up
through a child's parent pid (POSIX $$ keeps reporting the parent inside
a subshell, so $PPID of a spawned child is the portable way in both Bash
and Zsh). The mutex owner and the working boundary are the same process:
killing the repair kills the recorded holder and the next attempt
retakes the lock; a normal exit still releases it by trap; a suspended
repair is still alive and keeps holding it.

Signed-off-by: Lihua <1017343802@qq.com>
@LIHUA919

Copy link
Copy Markdown
Contributor Author

@/tmp/r25reply.md

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, xhigh)

[P2] 并发恢复会删除另一个修复正在持有的锁。 两个修复先后检查同一个已退出的 PID,第二个窗口在第一个窗口重获锁并进入最终版本检查后继续执行。 后到的窗口移除了先到窗口仍持有的锁,替换 launcher 并退出 0。此时先到窗口的最终检查尚未完成。两个流程随后都能返回成功。 相关行

动机 / Motivation

桌面 App 因 Node 版本过旧停在引导页时,用户按 README 在终端更新优先选中的 Node launcher,并需要在失败后安全重试。 主干缺少这个自助流程。上一头的子 shell 能正常清锁,但其中断后仍把空闲的外层终端记为持有人。 用户在两个窗口重试后可能收到两份成功结果,其中一个仍在检查已经被另一次修复替换的入口。 在隔离 Bash 和 zsh 执行 README 命令,核对正常释放与回滚。只中断实际修复进程,再分别测试单次重试与两个并发重试。 Bash 和 zsh 两组都确认锁记录的是修复进程。只杀掉修复子进程后,上一头第二窗口退出 1,本头退出 0,外层窗口一直存活。正常释放、原退出 hook 和失败回滚也通过。 两个窗口同时认定同一旧持有人已退出时,后到窗口仍能删除先到窗口接管后的锁。 验证使用 README 原命令、临时文件系统及实际 Bash、zsh 和 Node。

后到的窗口移除了先到窗口仍持有的锁,替换 launcher 并退出 0。此时先到窗口的最终检查尚未完成。两个流程随后都能返回成功。

改动思路 / Approach

文档复用 App 优先定位用户 launcher 的规则和现有 Core 版本校验。文件替换、回滚和锁都在同一次本地用户命令内,子 shell 管理正常清理。遗留锁接管的身份需要在锁机制自身保证。 单窗口中断后可以重试。教程仍需让并发恢复同一遗留锁时维持排他。 保留子 shell 释放机制。取消只凭先前读到的 PID 就递归删除当前锁的自动接管,或采用能在接管时确认原锁拥有者的互斥方式。保留确认没有其他修复运行时的人工恢复步骤。

具体改动 / Changes

精确头 39032e2f4660a42ec7500809ad1806a9e2179a1f,目标分支快照 ddc2f687d1ea2cb1e4a7cac1fadee548aca54c80。1 个 README 文件新增 267 行、删除 1 行。当前增量记录实际修复进程,并更新中断恢复说明。 上一头 f8f8447 中断子进程后,需要外层终端退出才能重试。本头修复单窗口中断重试。两个头都复现同一遗留锁的并发恢复重叠。

关键代码讲解

  • 修复子 shell。成功和失败均结束独立的操作作用域,终端及退出 hook 由原窗口持有。 源码

  • PID 判活。检查的是先前读取的进程身份,检查结果无法证明之后要删除的目录仍由该进程留下。 源码

  • 遗留锁删除。直接移除当前路径,因此另一个进程刚取得的锁也会被移除。 源码

  • launcher 备份与回滚。原文件及 inode 在最终检查失败时可恢复,操作互斥仍由入口锁负责。 源码

  • EXCLUSIVE_LAUNCHER_REPAIR 尚未满足。Node 自助恢复保留原版本门槛,并需在替换与最终检查期间只允许一个窗口操作同一入口。 现有依据

对主干的风险 / Risks

两个修复先后检查同一个已退出的 PID,第二个窗口在第一个窗口重获锁并进入最终版本检查后继续执行。 在第一个流程的最终版本检查停住时放行另一个已观察到原 PID 退出的流程。核对两者的进程状态、锁拥有者和最终 launcher。 后到的窗口移除了先到窗口仍持有的锁,替换 launcher 并退出 0。此时先到窗口的最终检查尚未完成。两个流程随后都能返回成功。 PID 文件和目录锁是教程内的本机互斥状态,App 与 Core 的外部诊断沿用原词汇。 用户运行教程时,命令负责排他替换,交互操作结束就释放锁。已证实的并行恢复仍违背前一项。

语义与 CI 对齐

PASS — macOS arm64 用真实 Bash、zsh 和 Node 22.22.3。两版各重放两个壳的修复进程中断,复验常规成功、失败回滚、挂起和两个窗口恢复。git diff --check 与标准本地 premerge 的 17 项通过。 FAIL — 两窗口并发接管遗留锁。 UNVERIFIED — 并发验证只控制时序,实际文件操作由本机命令执行。桌面 App 安装包和托管 CI 未复验。

我的整体评价 / Verdict

REQUEST_CHANGES。 现有版本诊断保持一致,交互重试恢复。遗留锁并发恢复仍未满足互斥。 单窗口中断后可以重试。教程仍需让并发恢复同一遗留锁时维持排他。 保留子 shell 释放机制。取消只凭先前读到的 PID 就递归删除当前锁的自动接管,或采用能在接管时确认原锁拥有者的互斥方式。保留确认没有其他修复运行时的人工恢复步骤。

English verdict: REQUEST_CHANGES. Retry after an interrupted repair works with the terminal still open. Two recovery attempts can still replace a lock held by a live repair.

The round's interleaving: two windows can both observe the same exited
holder pid; the first retakes the lock and enters its final check, and
the second — whose takeover decision was made before the first took
over — then rm -rf's the directory anyway, deleting the first window's
freshly held lock, replacing the launcher, and exiting 0 while the first
window's final check is still pending. Two successes, zero exclusivity.

Per the review's primary option, the automatic takeover is gone. The
lock is now exactly: an exclusive mkdir, the subshell's EXIT trap
release, and a manual-removal fallback — the stop message tells the user
to remove the directory by hand once ps confirms no repair shell
remains, and the prose keeps the ps check explicit. The pid file and
every liveness-based removal path are deleted, so no window can ever
remove a lock another window currently holds. An interrupted repair's
lock stops all later attempts until the user's confirmed cleanup.

Signed-off-by: Lihua <1017343802@qq.com>
@LIHUA919

Copy link
Copy Markdown
Contributor Author

@/tmp/r26reply.md

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

[P2] 旧终端退出会删除第二个仍在运行的修复锁

Bash 和 Zsh 按原文运行。第一个工作进程仍等待版号时,第二个窗口按预期被挡住。模拟人工回收旧目录并再次启动后,第二个进程持有新锁;此时旧进程退出 0,新锁随之消失,第二个进程却仍在检查安装结果。 文档认为手动删除和暂停修复重叠时仍由 launcher 的 inode 检查兜底,但无条件 EXIT cleanup 单独删除锁路径。它无法辨认同路径的新目录。 清理必须针对本次成功取得的锁实例。保留人工恢复时,给出可靠的活跃操作判定,并覆盖旧进程退出不删除新进程的锁。可在简单持有者边界中实现,无需新增自动接管。 对应源码

动机 / Motivation

首次启动时找不到合格 Node.js 的 Mac App 用户,需要恢复自己的启动入口并能从中断重试。 主干 README 的自助恢复只对应缺少 Python。上轮 Node 命令直接用交互 shell 的 EXIT hook,成功完成后仍会留锁。 正常窗口沿用锁串行修复。冷却判断失误或暂停进程后人工恢复时,旧窗口退出不应移除新锁。 本轮核对已执行的终端命令、进程与本地入口。 适用依据

改动思路 / Approach

代码块分离出自己的子 shell,保留已存在终端状态和原前置检查。取得锁、验证 Node 版本和恢复备份继续是同一次操作。 修复应留在本地 launcher 的替换与恢复操作内。 文档的恢复保证需要覆盖已描述的暂停窗口重叠。锁清理由取得该锁的同一主体负责。 继续使用现有 Core 版本判定,选择可描述与可验证的持有者边界。把锁身份和 launcher 的回滚检查保留各自职责。 检查用户完成修复或遇到中断时的下一步,而非只根据一次成功输出推断恢复可用。

具体改动 / Changes

本轮精确 head e57747ecfe47d070cb19e2ef2631340fe397ef85。当前评审包基线 ddc2f687d1ea2cb1e4a7cac1fadee548aca54c80,完整差异与源码验证以实际共同祖先 ddc2f687d1ea2cb1e4a7cac1fadee548aca54c80 为准。相对 f8f8447,通过中间提交移除 PID 写入和自动接管,保留 EXIT trap。加入人工判断后可删除陈旧锁的说明。 上轮评审

  • 正常修复重试。新说明取消不可靠的自动接管。Bash 和 Zsh 中,首个窗口有锁时,第二个窗口会正常停下;不受干扰的修复正常退出。
  • 中断恢复。人工恢复后,旧修复不得删除由第二个仍运行修复所持有的新锁。

关键代码讲解

一份 README +255/-1。保留最低 Node 版本、发现顺序、替换和备份。最新提交将异常后的接管改成手动回收。 node_trim 与 node_qualifies 共享版本资格,备份和恢复保留原 launcher。新子 shell 使清理与终端的正常交互分开,但记录 PID 的语义没有随宿主范围改变。

对主干的风险 / Risks

PASS。两种实际 shell 中,保持第一个修复占有原锁时,第二个窗口均正确退出 1;释放各自的模拟版本检查后,修复命令正常退出。 源码 premerge 4 项直接检查、17 项所选检查均通过。

FAIL。Bash 和 Zsh 按原文运行。第一个工作进程仍等待版号时,第二个窗口按预期被挡住。模拟人工回收旧目录并再次启动后,第二个进程持有新锁;此时旧进程退出 0,新锁随之消失,第二个进程却仍在检查安装结果。 隔离 Bash/Zsh 中验证正常排他、人工回收后重新取得锁以及原子收尾;第二个修复完成前其锁必须保留。

语义与 CI 对齐

正常互斥控制通过。最新反例针对人工恢复后的锁身份,launcher inode 对照无法保护另一处目录。 本轮在 macOS Bash 和 Zsh 使用原文与临时模拟 Node,未修改用户 launcher、未安装 App、未查询远端 CI。

我的整体评价 / Verdict

请求修改。新说明取消不可靠的自动接管。Bash 和 Zsh 中,首个窗口有锁时,第二个窗口会正常停下;不受干扰的修复正常退出。 清理必须针对本次成功取得的锁实例。保留人工恢复时,给出可靠的活跃操作判定,并覆盖旧进程退出不删除新进程的锁。可在简单持有者边界中实现,无需新增自动接管。

English verdict: REQUEST_CHANGES at e57747e. The new manual recovery can leave a later repair unprotected when an older subshell exits and deletes its replacement lock.

The round's interleaving: window A held the lock mid-repair; the user
performed the documented manual recovery (removed the lock, started a
new repair), and window C acquired a fresh lock and entered its final
check; then A's subshell exited 0 and its EXIT trap ran `rm -rf` on the
lock path unconditionally — deleting C's freshly acquired lock while C
was still checking its installed result.

The cleanup is now instance-targeted, using the same inode ownership
proof as the launcher rollback: at acquisition the lock records its own
directory inode, and the EXIT trap removes the directory only while the
current inode still matches. While the instance is the window's own, no
other window can acquire, so the check-then-act gap cannot swallow a
replacement; a later window's lock has a different inode and survives
this repair's exit, and its own trap removes it.

Signed-off-by: Lihua <1017343802@qq.com>
@LIHUA919

Copy link
Copy Markdown
Contributor Author

@/tmp/r27reply.md

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

[P2] 备份恢复会在另一个窗口仍在修复时替换 launcher

第一个窗口在核验已安装的 Node v24 时,第二个窗口执行同一节的备份恢复。恢复在锁仍存在时退出 0。第一个窗口随后也退出 0 并打印更新成功,实际 launcher 已退回 v22.22.2。Bash 和 Zsh 均复现。 恢复代码没有获取修复持有的锁。备份恢复与安装修复使用同一互斥边界,覆盖暂存、替换及各自读回。用两个窗口验收,并保留无并发时可恢复原文件或链接的对照。 恢复命令

动机 / Motivation

在 Mac App 启动面板遇到 Node 不可用的用户,需要查到 App 实际选用的 Node,并安全地升级或恢复启动入口。 旧版说明缺少 Node 错误的恢复入口。现在可以按版本诊断修复,两个普通修复之间也有互斥。 预期结果是 用户等待修复完成后,App 会经同一个 launcher 读到 CLI 报告的版本。 这项变更只交付文档内的本机恢复流程。App 原生 Node 搜索由已合入的修复负责。 原始报告

改动思路 / Approach

App 保持现有查找顺序,文档把用户自己的 Node 放到该顺序可见的路径。先核验候选、再备份和更换、最后读回实际路径是合理的。两个替换命令操作同一路径,独立互斥会让成功读回失真。这项变更只交付文档内的本机恢复流程。App 原生 Node 搜索由已合入的修复负责。验收从启动故障一直查到实际生效的 Node,避免把页面或 Shell 中的成功提示当成恢复结果。

具体改动 / Changes

精确提交 2b8c8022767e26a767bf8e3b2e7fc9a1eedb9814,实际共同祖先 ddc2f687d1ea2cb1e4a7cac1fadee548aca54c80。一个 README,增加 258 行,删除 1 行。最新差异对普通修复的 EXIT 清理加了实例判断。ordinary-repair-lock 对应旧进程退出保留新锁,repair-and-restore 对应恢复与修复的读回一致性。锁清理

关键代码讲解

普通修复先用 mkdir 取锁,再替换 launcher 并执行其版本检查。旧实例退出时以 inode 区分已经取得锁的新实例。后续的备份恢复另起一段,在暂存入口可运行后直接移除并替换 launcher。此时首个窗口可能仍持有锁,也可能正在读回它先前打开的二进制。恢复块

对主干的风险 / Risks

通过。在隔离目录执行精确 README 代码,Bash 和 Zsh 都拒绝第二次普通修复。以人工回收后的新一轮为对照,旧修复退出后新锁保留,旧提交在两种 Shell 都删掉新锁。

失败。第一个窗口在核验已安装的 Node v24 时,第二个窗口执行同一节的备份恢复。恢复在锁仍存在时退出 0。第一个窗口随后也退出 0 并打印更新成功,实际 launcher 已退回 v22.22.2。Bash 和 Zsh 均复现。

源码 premerge 执行 4 项直接检查和 17 项所选检查。均通过。 未查询远端 CI。真实 App 安装和 Finder 启动未运行。

我的整体评价 / Verdict

请求修改。当前提交修复了先前的锁实例清理反例。请让备份恢复使用相同互斥边界,复验两个操作并行与各自的成功读回,并确认无法覆盖仍处在验证中的入口。

English verdict: REQUEST_CHANGES at 2b8c802. Lock ownership on exit is fixed for the verified counterexample, but the documented restore can race an active repair and leave an unsupported launcher after both operations report success.

The round's interleaving: the manual restore section ran without the
repair lock, so while window A's repair held the lock with its final
version check pending, a restore in another window staged a backup
entry, removed the launcher, moved its restore into place and exited 0;
A's final check then passed on whatever entry it read, and both
operations reported success with the launcher actually regressed to the
unsupported 22.22.2 backup.

The restore block now runs inside the same boundary as the repair: one
subshell that takes the same exclusive lock with the instance-targeted
EXIT cleanup, stops with the in-progress message while a repair holds
it, and applies the same ps-confirmed manual-removal fallback. Both
operations' successful readbacks can no longer straddle a replacement.
The no-concurrency controls are unchanged: a regular-file backup
restores as a regular file, a symlink backup recreates its raw link
value at the original location.

Signed-off-by: Lihua <1017343802@qq.com>
@LIHUA919

Copy link
Copy Markdown
Contributor Author

@/tmp/r28reply.md

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

首次启动时找不到可用 Node 的 Mac App 用户,需要更新 App 实际选用的 launcher,也需要能安全恢复原入口。 前一个提交只锁住修复。两个窗口可以分别修复和恢复,均成功后 App 实际看到的 Node 却回到了旧版。 现在其中一个操作持锁时,另一个窗口在更换入口前退出。按顺序执行仍能更新和恢复。 这一项交付 README 的本机 Node 恢复操作。App 原生查找与运行时由既有实现负责。 原始故障

改动思路 / Approach

两个命令现在共用同一把锁。互斥范围包含暂存、替换与读回,恢复继续保留备份本身的文件类型。 这一项交付 README 的本机 Node 恢复操作。App 原生查找与运行时由既有实现负责。 修复和恢复都在各自的子 shell 内运行。取得锁者在退出时核对锁实例。复用已存在的互斥机制,使用户不需要安装或配置新工具,并保留原来的备份及诊断步骤。

具体改动 / Changes

精确提交 6c3397e9b27e91681a02536d2c155bf13d37c0ba,基线 ddc2f687d1ea2cb1e4a7cac1fadee548aca54c80,前轮提交 2b8c8022767e26a767bf8e3b2e7fc9a1eedb9814。评审基于完整 README 变更,共 +274/-1。最新修订在恢复命令加入原修复的互斥条件。synchronized-recovery 核对双向互斥,entry-preservation 核对普通文件和相对软链接。上一轮评审

关键代码讲解

两个入口都尝试创建同一个锁目录,并在未获得锁时先返回。恢复在持锁期间检查暂存的 Node、替换 launcher,并读取它指向的入口。正常退出只回收自己创建的锁实例。README 中 repair below 的方位词可顺手改为 repair above。恢复代码

对主干的风险 / Risks

Bash 和 Zsh 各用普通文件与相对符号链接完成四组配对。当前修复结束时实际 Node 为 v24.1.0,随后普通恢复退出 0,读回 v22.22.2,入口类型和链接目标保留。 恢复窗口在修复检查期间退出 1,当前 launcher 未被替换。反向阻塞也成立。前一个提交的并发恢复退出 0,并把实际 Node 退回旧版。 两个 Shell 也通过旧进程退出后保留后继锁的对照。源码 premerge 执行 4 项直接检查和 17 项所选检查。均通过。

在独立临时目录使用实际 Bash/Zsh 与文件系统,Node 版本由合成程序返回。未启动真实 Mac App。 未查询远端 CI。

我的整体评价 / Verdict

同意当前精确提交。先前两个退出成功却留下旧 launcher 的反例已解决。普通恢复在持锁操作结束后仍能回到原始入口。真实 App 引导与重启仍按现有运行时验证。

English verdict: APPROVE at 6c3397e. Both documented launcher operations now share a lock and pass the paired shell readbacks for normal and overlapping recovery.

Signed-off-by: huangruiteng <huangrt01@163.com>
@huangruiteng

Copy link
Copy Markdown
Collaborator

Exact-head consolidation after merging current main: the README now documents the search order in source, the 22.22.3 runtime floor, guarded replacement, atomic/timestamped backup, entry-type-preserving restore, instance-aware lock cleanup, and a shared lock across repair and restore. Revalidation at 04d94a1d1d8450c9c20f29784c5b4dd9786a114c: 62 Node/release/installation tests passed, public boundary scan clean, and standard premerge passed 17/17 selected checks. Historical threads below are obsolete against this head and are being resolved together.

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · GPT-5 · OpenAI · self_reported

动机 / Motivation

在全新 Mac 或 Finder 启动环境中没有可用 Node,或 ~/.local/bin/node 先命中旧版本的桌面 App 用户,会在安装阶段看到 recovery panel 而不知道应从哪个诊断字段判断问题。

修复前 README 只有 Python 退出码 2 的自助步骤和较低的 dashboard 构建 Node 门槛;当前 exact head 说明运行时要求 22.22.3+、App 的实际搜索顺序、按 Diagnostics 分支、受 guard 的替换与同锁恢复。

Guide now distinguishes node_found=false, unsupported/missing version and blank display version; repair validates the actual candidate and installed link, creates a timestamped backup, and rolls back unless this operation owns the current entry.

本 PR 不修改 App 搜索、安装器、Tauri 修复按钮或 Node 探测;不把 fnm/volta 自动发现加入产品,也不声称真机 App recovery 已在本轮执行。

改动思路 / Approach

The change stays within desktop distribution documentation and describes existing product owners without adding a parallel runtime implementation.

It documents supported recovery for current App search and qualification behavior; product-side bundling or automatic repair remains out of scope.

主路径是 Desktop App boot failure -> README Known Issues self-service。权威输入为 Boot diagnostics plus the App's bounded runtime search and Core's Node qualification,决定边界由 The desktop installer, Rust runtime path resolver and Core node_probe remain implementation owners; README only documents their contract. 持有,结果是 The user may replace or restore ~/.local/bin/node under an instance-aware local lock, after candidate and installed-entry qualification.,再由 Diagnostics fields, shell readback, backup directory and Repair this version environment refresh 消费。Shell chains fail before mutation or restore the owned entry; an interrupted lock requires a ps-confirmed manual reset.

具体改动 / Changes

按 apps/desktop/loopx-control-plane/README.md 的 revision f0573ae1cb7f1b7058f12074efcca9359f9867bf 核对,missing-node-diagnosis / search-order-and-floor / safe-repair-and-restore 分别对应下面的行为与验证。

关键代码讲解

  • Fresh Mac without a usable Node.js stays on the boot screen:Explain the failure, diagnostics and self-service branches. Before only the Python case was documented; now Node has an equivalent Known Issues entry and runtime prerequisite.
  • guarded launcher repair block:Validate a candidate, reserve a unique backup, replace the winning launcher and keep/rollback only owned entries. Before a bare ln -sf could create a dangling link; now candidate/link versions, entry ownership and one shared lock are checked.
  • backup restore block:Restore the newest usable backup while preserving entry type and respecting the repair lock. Before restore could race a repair or copy through a symlink; now it stages, qualifies, checks lock ownership and swaps atomically.

变更共 1 documentation file,274 additions、1 deletions。Document the desktop Node prerequisite, failure diagnosis, search ordering, safe launcher repair and reversible backup restore.

  • missing-node-diagnosis:Document runtime_install_exit_1, environment.node_found and node_version and route users by the observed state.,当前为 implemented。
  • search-order-and-floor:Describe the ordering that determines the winning Node and state the runtime floor separately from the dashboard-build floor.,当前为 implemented。
  • safe-repair-and-restore:Replacement and restore commands preserve the previous entry, qualify the selected binary and share an instance-aware lock.,当前为 implemented。

对主干的风险 / Risks

最强回归场景是 Following the guide destroys the only working launcher or leaves a dangling/old link while reporting success.。触发状态为 A missing candidate, old candidate, relative link, existing regular launcher, same-second retry or concurrent repair/restore.;The shell validates the candidate and installed entry, uses exclusive lock/backup ownership, and stages restore before replacement.。影响范围是 The user's local ~/.local/bin/node entry and nearby backup/lock artifacts; App binary and supported Node binary remain untouched.,可观察性来自 Exit status, printed candidate/installed version, backup path, lock contention message, staged restore and shasum readback.,恢复路径是 Repair rollback preserves owned entries; backup restore recreates regular files or symlinks; an interrupted stale lock is manually cleared only after ps confirmation.。

changed_invariant_positive=passed (62 passed.);material_negative_or_failure=passed (Historical threads are resolved by the documented candidate checks, backup ownership, entry-type restoration and shared instance-aware lock.);repository_required_checks=passed (Public boundary scan was clean; standard premerge passed direct checks, 8 catalog canaries, 8 risk profiles and the boundary check.);remote_ci_observation=pending (The new exact head has not yet completed hosted CI.)。

  • PASSED · Node floor, runtime search and installer fail-closed behavior.:62 passed.
  • PASSED · Unsafe launcher replacement, versions, restore and concurrency are guarded as described.:Historical threads are resolved by the documented candidate checks, backup ownership, entry-type restoration and shared instance-aware lock.
  • PASSED · Public-boundary, docs risk profiles, catalog checks and diff hygiene.:Public boundary scan was clean; standard premerge passed direct checks, 8 catalog canaries, 8 risk profiles and the boundary check.
  • PENDING · Remote CI for the new exact head.:The new exact head has not yet completed hosted CI.

我的整体评价 / Verdict

长程效果判断为 improved:Desktop bootstrap failures now have a documented diagnosis and reversible local recovery path instead of requiring source-level log archaeology.。用户体验判断为 improved:The Known Issues section provides concrete branch-specific steps and warns against unsafe link replacement.。视觉检查不适用,因为本次没有改变渲染界面或布局。

The documentation now closes the missing-Node recovery gap without changing product behavior. The detailed shell procedure preserves the launcher and supported binary across failures and concurrent windows, while live packaged-App recovery remains a disclosed gap.

English verdict: APPROVE at 04d94a1. The desktop guide now explains Node qualification, search shadowing, bounded repair, reversible restore and shared locking for runtime_install_exit_1.

@huangruiteng
huangruiteng merged commit 3c378ac into loopx-project:main Nov 26, 2026
11 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants