Repository navigation
fix(cli): print host-runnable install guidance in the connect hint - #6122
huangruiteng merged 4 commits into
Conversation
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent | gpt-6.1-sol | OpenAI | runtime_reported | reasoning_effort=xhigh
Exact reviewed head: 6122@3636f86d14e6bf48b155335cc30bef1f0d05a7b8. Immutable PR merge base: ecffa78cc68d1bb64724fd7c662eb89d04c6f1ad; current target main: ecffa78cc68d1bb64724fd7c662eb89d04c6f1ad. 使用完整 PR diff,未把新主干历史作为本 PR 改动。
动机
原生 Windows 上连接项目的操作者,需要能直接执行 CLI 打印的安装和修复命令。
此前 connect 总是打印 POSIX 命令,Windows 操作者无法照做;现在 connect 复用平台判断并显示当前解释器和 PowerShell 安装入口,但打印的解释器命令仍无法执行。
真实 connect 的 POSIX 输出保持不变,doctor 的十二组命令对照一致;真实 PowerShell 7.6.6 解析器则证明三类 Windows 解释器路径都使新修复命令报语法错误,新增平台测试也在 POSIX 本机失败。
本次不执行真实安装、不激活或改写正在运行的自动化,也不授予新的账户、仓库或合并权限。
修复命令必须采用 PowerShell 调用与转义语义;新增测试必须在 POSIX 上可靠验证 Windows 分支。
改动思路
把 connect 和 doctor 的命令生成收拢到现有 install_contract 是合理的;当前 PR 内修正 PowerShell 调用和测试隔离即可,无需新增安装通道或改写控制面。
保留这次命令生成合并,修复 Windows 执行语法和新增测试后再批准;不扩展为安装器或语言迁移。
Doing nothing retains the demonstrated defect. A new control-plane or installer framework is unnecessary; the nearest existing owner supports this bounded fix. doctor compatibility names remain imported at their original caller module; the moved helpers retain their real ref, skip-skills and agent-type inputs.
具体改动
独立规格依据 docs/guides/installing-loopx.md,固定改动前 revision ecffa78cc68d1bb64724fd7c662eb89d04c6f1ad。公开问题 #6121 的 Expected behavior 是“打印宿主可运行的修复/回退指引”,作者的输出断言不能替代执行语法。
Native Windows PowerShell 7: not_met — Native Windows uses PowerShell and a runnable Python/package installation entry, without Bash or POSIX shell syntax.Upgrade And Repair: implemented — Installation guidance preserves the installation-owner boundary and existing explicit validation steps.
关键代码讲解
install_repair_command(loopx/install_contract.py:90):POSIX 保持原常量;Windows 拼接当前解释器,但 shlex 引用不能在 PowerShell 执行。no_clone_upgrade_command(loopx/install_contract.py:50):从 doctor 移入现有安装契约,保留 ref、skip_skills、agent 参数;生成文本不执行安装。bootstrap_project(loopx/bootstrap.py:288):正常返回和全局不可写返回都使用同一平台命令生成器;CLI 渲染现有返回字段。
整个4文件diff覆盖bootstrap正常和全局不可写返回分支、doctor调用者和被移动的命令函数。POSIX命令逐字相同,现有doctor十二组选项结果相同;返回字符串不执行安装。Windows修复命令新的shlex引用仍采用POSIX语法,真实PowerShell反例直接否定“runs as printed”。
同一相关测试集合:基线56通过/4个原生Windows平台skip;当前58通过/1个新增失败/同4skip。真实POSIX connect配对和12组doctor helper配对通过。PowerShell7.6.6三类Windows路径解析均失败,真实无副作用替身未被生成命令调用,而正确调用语法能调用。当前风险canary5项直接检查和6项选中执行通过,不能覆盖掉这些实际失败。
对主干的风险
[P2] Generate an executable PowerShell interpreter invocation (loopx/install_contract.py:95):shlex.quote emits a quoted string expression, not a PowerShell command invocation. Real PowerShell7.6.6 rejects ordinary and space paths at -m/pip; apostrophe escaping also uses POSIX concatenation. Thus the replacement repair command still cannot run as printed. 最小修复:Use & plus _powershell_literal(sys.executable), or an equivalent shell-specific owner; validate actual parsing/invocation instead of shlex equality.
[P2] Keep the platform test from switching pathlib into unsupported Windows paths (tests/test_install_hint_platform.py:58):Changing global os.name precedes no_clone_upgrade_command -> Path(file).resolve(), which constructs a concrete WindowsPath and raises pathlib.UnsupportedOperation on macOS Python3.14.8. This head has58 passed/1 failed/4 skips; the unchanged baseline56 neighbors pass/4 skips. 最小修复:Separate the platform discriminator or use a supported concrete path seam so the Windows branch is exercised on POSIX, preserving runnable-command assertions.
语义与验证边界
既有字段和命令owner复用,没有新增共享闭集、并行权威源、授权或机器义务。平台选择只决定打印文本,没有自动执行/配额/状态效果。开发期advisory先于full-tree canary,未发现支持的词汇载体;真实调用决定命令意义。四个native-Windows安装测试在两侧都是平台skip,不声称已经验证Windows安装或promotion。
PowerShell parser and harmless executable witness were real; Windows paths were synthetic, and four unchanged native-Windows installer tests were platform-skipped. No real Windows install, package promotion or model adoption was claimed. 未读取、查询、轮询或等待GitHub CI。基线到当前main在4个改动文件无差异;其他旧Python安装owner中的引用问题未由这次合并自动修复,也未作为本次新增缺陷归因。
我的整体评价
REQUEST_CHANGES。保留这次命令生成合并,修复 Windows 执行语法和新增测试后再批准;不扩展为安装器或语言迁移。 实际局部修复有价值,但操作者的恢复/执行路径尚未成立;通用canary绿灯和作者验证不能抹去当前反例。
未来相关重构检查:已应用有界合并:保留doctor实际导入名字,把生成逻辑集中到现有install_contract。进一步修复应复用现有PowerShell literal,避免再加平台规则owner。 修复后重新核验完整exact head和上述反例,再决定批准。
English verdict: REQUEST_CHANGES — 6122@3636f86d14e6bf48b155335cc30bef1f0d05a7b8. The shared install text owner and POSIX parity are sound, but the native Windows repair command still cannot execute: real PowerShell7.6.6 rejects the generated quoted interpreter expression at -m/pip, including ordinary Windows paths. Use shell-correct invocation and escaping. The new nt test also fails on POSIX because global os.name switches pathlib to an unsupported WindowsPath.58 local cases pass,1 introduced case fails,4 native-Windows cases remain platform-skipped;5 direct/6 selected canaries pass. Preserve those failures and validate actual parsing/invocation plus portable tests before approval.
已修复评审中的两个 P2新 head: [P2] 用 PowerShell 调用语义生成解释器命令 — Windows 分支不再使用 真实 PowerShell 解析证据(本机 PowerShell 7.6.6, [P2] 测试不再把 pathlib 切到不可用的 Windows 路径类 — 测试改为 monkeypatch
验证: 未纳入本次修复的相邻缺口(与评审一致,不归因于本 PR): English verdict: both P2 findings addressed at |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; xhigh
Exact head: 97f5169050a1bc919a0626bd2d07b2c4d344b2e0; baseline: ecffa78cc68d1bb64724fd7c662eb89d04c6f1ad. Whole PR: 4 files +303/-63. Re-review includes the earlier call-operator and global-os.name test findings.
动机
首次连接或修复 LoopX、照提示在原生 Windows PowerShell 中执行命令的操作者。 原提示含 python3、Bash 或只有引号的解释器路径,复制执行会失败;新版使用当前解释器和 Windows 安装脚本,并用 PowerShell 调用运算符启动解释器。 真实 PowerShell 解析与无安装副作用的解释器调用通过;实际 connect 输出和十二组 doctor 的 POSIX 提示与基线逐字一致。 本 PR 修复打印出来的安装与修复命令,并统一其生成规则;不执行用户安装,不新增权限、Goal 状态或调度规则,也不宣称完成原生 Windows 安装资格。
依据 #6121 与变更前的 installation guide;spec_revision ecffa78cc68d1bb64724fd7c662eb89d04c6f1ad。逐项核验 Native Windows PowerShell 7 的当前解释器/Windows installer,以及 Upgrade And Repair 的修复后 doctor 读回顺序。两项在本 PR 的打印命令边界内满足;未把文档中的完整 Windows 安装资格当成本机已完成的验收。
改动思路
将 bootstrap/connect 与 doctor 的命令生成集中到已有 install_contract;保留实际 caller 的导入接口,平台语法不再由两个 owner 分别维护。
最小有效修复是把同一平台规则放回最近的现有命令 owner。只改 bootstrap 字符串会继续让 doctor 与 connect 分别维护引号、路径和安装顺序;新增安装框架没有必要。相邻有界重构已应用:移除 doctor 的重复函数定义,保留其真实调用/导入接口;Python 在这里承接主机命令文本,没有新增平行的控制面决策源。
具体改动
install_repair_command在 Windows 返回& '解释器路径' -m pip ...。&才会调用引号内的路径;单引号中的 apostrophe 加倍。后续 workflow-skills 和 doctor 顺序保留。no_clone_upgrade_command复用 local installer,Windows 使用install-windows.ps1和当前解释器;POSIX 的 ref/skip/agent、PATH 与 doctor 完整文本保持原样。bootstrap_project的正常和 global-sync 不可写响应都调用共享 helpers;doctor freshness 通过原导入接口使用同一实现。- 测试只替换局部 host 判定 seam,避免改全局
os.name使 macOS 的Path被当成 WindowsPath;普通、空格和 apostrophe 路径另用真实 PowerShell parser 验证。
对主干的风险
本轮 immutable base 的邻接测试 56 passed / 4 skipped;当前 head 62 passed / 8 initial skipped。其中四个新增 PowerShell case 最初因本机缺 pwsh 跳过,随后用官方 PowerShell 7.6.6 独立工具跑完,focused suite 10 passed:三种 Windows 路径的 repair/fallback 真实解析与实际解释器 witness 均通过。witness 只打印标记,不执行 pip 安装。另作反向敏感性验证:去掉 & 后,真实 parser 报 Unexpected token '-m' 和 pip;原样无解析错误。
实际 source connect --dry-run --no-global-sync 在隔离临时 registry 的 base/head 完整 repair/fallback 输出逐字一致;doctor 的 12 组 ref × skip × agent 命令也完全一致。没有通过压缩、normalization 或仅比字段来声称语义等价。平台语法修复是公开的默认行为变化;没有新开关、自动执行、额度、持久化或权限变化。
当前 exact-base risk-based premerge:5 direct + 6 selected 全过,涵盖安装、更新、first connect、semantic vocabulary 和 maintainability;四个改动文件 ruff 通过。先运行 diff advisory,再运行 full semantic 检查。无失败、警告或 manual hold;未读取、轮询或等待 CI。
四个原生 Windows 平台安装 case 仍未在 macOS 执行。真实 pwsh 在 macOS 的 parser/witness 证明命令语法与调用,不能证明 Windows OS 安装成功。另有未改动的 python_install_owner.python_distribution_upgrade_command 路径归属独立,不把它误称为此 PR 已修复,也不据此无限扩大 connect-hint 修复。
我的整体评价
APPROVE。 两个前次发现均在当前 head 逐项核验解决。将 bootstrap/connect 与 doctor 的命令生成集中到已有 install_contract;保留实际 caller 的导入接口,平台语法不再由两个 owner 分别维护。 本 PR 修复打印出来的安装与修复命令,并统一其生成规则;不执行用户安装,不新增权限、Goal 状态或调度规则,也不宣称完成原生 Windows 安装资格。
体验和长期效果方向正向:操作者复制提示即可正确调用解释器,减少“照修复提示做仍失败”的重复诊断;下一次改平台规则只需改一个 owner。当前 POSIX 用户没有额外操作,打印 helper 不引入持久化或后台执行成本。证据支持这项有界改善,不支持长期吞吐、全平台安装或效率百分比。
English verdict: APPROVE - 97f5169. Shared install-contract helpers fix host-runnable connect/repair guidance, including the PowerShell call operator and apostrophe quoting. Real PowerShell parsing and a no-install interpreter witness pass; complete POSIX connect hints and twelve doctor commands match the immutable base. Risk-based premerge and lint pass. Actual Windows OS installation and the separate unchanged distribution-upgrade owner remain outside this bounded qualification.
97f5169 to
b6a820a
Compare
|
Rebased onto |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; reasoning_effort=xhigh.
详细中文评审 · 6122@b6a820a0039d789eb6346a70c6bba375f0b8e71f · REQUEST_CHANGES
动机
原生 Windows 上使用 LoopX 的操作者会在 connect 的安装提示里看到修复和 fallback 命令。
原来这两个块固定打印 python3、Bash 和 export PATH;现在修复块使用当前解释器及 PowerShell 调用符,但 wheel 安装的 fallback 又指向未打包的本地脚本,恢复仍然走不通。
已验证 PowerShell 修复命令能真实调用普通、含空格和含撇号的解释器见证,POSIX 完整输出保持一致;已复现 wheel fallback 找不到脚本而退出。
本 PR 的边界是输出可执行的安装提示及复用现有安装命令 owner,不自动安装、不切换安装归属、不扩大权限,也不修改 Goal 状态规则。
评审依据:问题 #6121 的“两个块在当前宿主可执行”要求,以及 docs/guides/installing-loopx.md,spec_revision f1a0290bbfe837956694313d0b94a62ed2fb67ed。对应验收:C-HOST-REPAIR(当前解释器和 PowerShell 调用,已满足)、C-FALLBACK-AVAILABLE(恢复目标真实存在且符合安装归属,未满足)、C-POSIX-PARITY(原有 POSIX 默认及 doctor 选项保持,已满足)。指南明确 PyPI 为普通安装默认,Windows snapshot 需要受信 checkout;不能把 checkout 文件布局假定为 wheel 文件布局。
改动思路
把 doctor 已有的命令生成器移入 install_contract,供 connect 和 doctor 共用,能减少重复平台判断;这是有实际调用方的 Python 安装文本适配层,不需要另建 TypeScript 决策 owner。
当前 PR 必须一起交付修复和 fallback 两个可用提示;仅 source checkout 路径存在不能证明默认 PyPI 安装的恢复路径可用。
完整四文件差异为 +303/-63:bootstrap 两个返回分支改用函数;doctor 删除本地重复实现并保留导入符号;install_contract 接管已有生成器,增加 repair/fallback 入口;新增 193 行平台测试。没有新增安装执行器、持久化字段或 capability。
路径是 connect → handle_bootstrap_connect_command → bootstrap_project → install_contract;Markdown 和 project_prompt 消费相同 payload。doctor 的 freshness、修复提示继续调用原有签名。_is_windows_host 只读取实际宿主,测试通过模块内 seam 切换分支,没有再改变全局 os.name。
具体改动
[P2] C-FALLBACK-AVAILABLE:默认 wheel 安装打印了不存在的 Windows installer。 archive_fallback_install_command() 第 112 行无条件委托 no_clone_upgrade_command(),后者以模块 __file__ 推导根目录,再拼 scripts/install-windows.ps1。在本 head 构建并安装的隔离 wheel 中,根目录是 site-packages,wheel 不含该脚本;真实 connect --dry-run --no-global-sync 的 Windows 分支因此打印 pwsh ... -File '<site-packages>/scripts/install-windows.ps1' ...。PowerShell 7.6.6 执行这一行退出 1,明确报该参数不是脚本文件。CLI 本身返回成功,操作者到恢复时才发现命令无效。在默认 PyPI/wheel 安装没有 checkout 脚本时,给出真实可达的 Windows 恢复步骤,或明确检测并引导取得受信 checkout;仅在目标脚本存在且属于正确安装 owner 时打印 -File 路径,并增加安装 wheel 后的入口测试。
这是新增 connect fallback 调用方继承了 source-only 布局假设;同类 doctor 局限在 baseline 已存在,不要求这个 PR 修复全部安装历史,但新接入的默认安装入口不能继续承诺这条路径可执行。基线 wheel 的 connect 仍打印旧 POSIX 常量;当前 wheel 已改变到不存在的文件路径,未关闭原问题的 fallback 验收。
两条旧 finding 均已逐项复核解决:install_repair_command 使用 & 加 PowerShell 单引号转义;普通、空格、撇号三类真实无副作用可执行文件均收到完整 -m pip install --upgrade loopx 参数。移除 & 的故意变异经真实 connect 输出交给解析器后失败。平台测试通过 _is_windows_host seam 运行 nt 分支,53 项 head 测试全过,未再触发不支持的 WindowsPath。
旧批准记录的 API commit 是本 head,但正文及链接仍写旧 97f5169050a1bc919a0626bd2d07b2c4d344b2e0。我独立读取全部当前差异、评论和两个旧 finding;四个文件与旧修复 head 逐字相同,但重新验证了当前 base/head 及新发现的安装边界,不把旧正文当作当前批准。
对主干的风险
- 同一 CPython 3.14.8、同一命令的相邻安装/doctor 测试:base 43 passed;head 53 passed,含新增 10 项和真实 PowerShell 解析/调用测试,无平台 skip。
- 真实 connect 的 POSIX 正常 dry-run 和不可写共享目录拒绝路径,base/head 完整 payload 一致(只归一化临时根目录、checkout 根目录和写入探针 PID);拒绝路径退出 1,保留原诊断和修复指导,未写项目 registry 或 Goal。共八个 source 入口执行回执,Windows 分支由模块 seam 模拟。
- doctor 十二组 ref/agent/skip-skills 组合及 local installer 输出逐字保持。语义 advisory 未发现受支持的新词汇载体;base/head 的 semantic-vocabulary-drift smoke 均通过。
ruff check loopx/install_contract.py tests/test_install_hint_platform.py通过。 - base/head wheel 均在验证 Chat bundle 后成功构建并隔离安装;当前 wheel 的真实 CLI 输出和 PowerShell 缺文件失败构成新的反例。首次未准备 Chat bundle 的打包失败在完成仓库规定构建后消除,未放宽打包 gate。
上述证明解析、参数调用、源代码和 wheel 文件布局;本机是 macOS,Windows 分支通过 owner seam 执行,未把它写成原生 Windows 完整安装/升级资格。没有执行 pip 升级或 snapshot 安装。CI 未查询、轮询或等待。Python distribution 的 doctor pip 引用等未改路径仍是相邻现存缺口,不将其归为此次引入。
我的整体评价
REQUEST_CHANGES:共享 owner 和两个旧修复方向正确,成本与原问题相称;当前新增 fallback 入口仍不能服务默认安装,C-FALLBACK-AVAILABLE 需要先补齐。把 doctor 已有的命令生成器移入 install_contract,供 connect 和 doctor 共用,能减少重复平台判断;这是有实际调用方的 Python 安装文本适配层,不需要另建 TypeScript 决策 owner。 当前 PR 必须一起交付修复和 fallback 两个可用提示;仅 source checkout 路径存在不能证明默认 PyPI 安装的恢复路径可用。
未来维护检查已经落实到这次集中命令 owner 的小范围重构;下一处应在同一 owner 区分 checkout 可用性与安装归属,并以安装后的 CLI 输出验证,而不是继续增加另一套平台字符串或只判断是否含 Bash。修复后请重跑现有十项测试、安装 wheel 的真实 connect 反例及相同 POSIX/doctor 对照,再对新 head 重审。此结论不代表 merge 授权。
English verdict: REQUEST_CHANGES — 6122@b6a820a0039d789eb6346a70c6bba375f0b8e71f. Both earlier findings are resolved, and the current source suite passes (base 43/head 53, including all 10 new cases with real PowerShell). However, installed-wheel connect guidance advertises an absent site-packages/scripts/install-windows.ps1; real PowerShell exits 1 on that printed fallback. Qualify the fallback against the actual installation owner and add an installed-wheel entrypoint regression. Native Windows installation was not performed.
| """Archive fallback guidance that runs as printed on this host.""" | ||
|
|
||
| if _is_windows_host(): | ||
| return no_clone_upgrade_command() |
There was a problem hiding this comment.
[P2] Qualify the Windows fallback against the installed layout
From a clean wheel installation, real connect output reaches this new Windows branch and delegates to no_clone_upgrade_command, which derives /scripts/install-windows.ps1 from its module path. The wheel contains no such script, so real PowerShell 7.6.6 rejects the printed -File argument and exits 1 before any installer runs. All 10 new source tests pass because their checkout contains the script and parser acceptance does not prove file availability. The existing doctor helper has this source-only assumption already, but this PR newly exposes it through ordinary installed connect guidance. Detect the actual installation/checkout owner and provide reachable Windows recovery steps when the script is absent; add an installed-wheel real-entrypoint test instead of only checking that POSIX tokens are absent.
There was a problem hiding this comment.
已在 head 6122@8ea7c4d36455acdc91ce0e5509189986415eb7a6 修复(rebase 到 main @ 5bf53ec6e;git range-diff 确认前三笔提交内容未变)。
同一个 owner 现在区分 checkout 可用性与安装归属:_checkout_snapshot_installer 仅在运行模块所属的 LoopX checkout 同时具备 pyproject.toml 与 scripts/install-windows.ps1 时返回该脚本;no_clone_upgrade_command 否则改走 & '<interpreter>' -m pip install --upgrade loopx + 打包技能安装 + loopx doctor,并保留 doctor_agent_type、skip_skills 输入。local_install_command 与 POSIX 分支未改。
原生 Windows 证据(本 head):从本 head 构建 wheel 并隔离安装后,真实 connect --dry-run --no-global-sync 的两个块都打印 pip 恢复命令,不再出现 site-packages 下不存在的 -File 路径;该 fallback 经真实 PowerShell 7.6.5 解析 0 错误,其解释器行真实启动并打印见证标记;同一 wheel 中 loopx doctor 的 no_clone_upgrade_command 也返回同一 pip 恢复命令。source checkout 仍打印本 checkout 中真实存在的 scripts/install-windows.ps1。测试 tests/test_install_hint_platform.py 21 passed(checkout / site-packages 两套真实临时布局、安装布局子进程装载、真实解析器与解释器见证);相邻 install/doctor 套件 70 passed;ruff 通过;mypy 仅剩基线既有的 Windows-only WNOHANG 错误。
独立归属的 python_install_owner.python_distribution_upgrade_command pip 引用未改动,仍是相邻缺口。
`loopx connect` (bootstrap) prints fixed POSIX repair text: `python3 -m pip install --upgrade loopx` and `curl ... install.sh | bash` plus `export PATH="$HOME/.local/bin:$PATH"`. Native Windows has neither a `python3` launcher nor Bash, so the first repair instruction the CLI prints cannot run there, while `loopx doctor` on the same host already names the interpreter and the `install-windows.ps1` snapshot installer. Move the platform rule into `install_contract.py` as the single owner and route the bootstrap hint through it. `local_install_command` and `no_clone_upgrade_command` move there from `doctor.py` unchanged; new `install_repair_command` and `archive_fallback_install_command` select the Windows or POSIX form. On POSIX they return the previously shipped constants byte-for-byte, so only the Windows surface changes. The bootstrap message now matches the repair guidance `doctor` already prints. Refs loopx-project#6121 Signed-off-by: JasonBuildAI <jasonbuildai@gmail.com>
Add `tests/test_install_hint_platform.py`: a platform-parameterized rule test on `install_contract` (POSIX keeps the shipped constants; Windows names the current interpreter and `install-windows.ps1` and excludes the POSIX-only tokens), plus a real `bootstrap_project(dry_run=True)` payload test asserting the connect hint contains no POSIX-only command on this host. Refs loopx-project#6121 Signed-off-by: JasonBuildAI <jasonbuildai@gmail.com>
…operator The native Windows repair hint quoted the interpreter with `shlex.quote`, which PowerShell parses as a bare string expression and rejects at `-m`/`pip`, so the printed repair command still could not be followed as printed. Invoke the interpreter with the `&` call operator and the existing `_powershell_literal`, which survives ordinary, spaced and apostrophe paths. Give the host-platform tests a discriminator seam (`_is_windows_host`) so both branches are exercised on any host, and assert the generated Windows command text against the real PowerShell parser and a real interpreter witness instead of `shlex` equality. The previous test switched global `os.name`, which made `pathlib` construct an unsupported `WindowsPath` on POSIX. Refs loopx-project#6121 Signed-off-by: JasonBuildAI <jasonbuildai@gmail.com>
The native Windows fallback delegated to the checkout installer derived from this module's own location, so an installed wheel printed `pwsh -File <site-packages>/scripts/install-windows.ps1`, a file the wheel does not ship; real PowerShell rejects that line before any installer runs. Print the checkout installer only while the checkout that owns this module actually ships `scripts/install-windows.ps1` (project marker plus script), and otherwise recover through the interpreter that owns the installation: `& '<python>' -m pip install --upgrade loopx`, the packaged skill install and `loopx doctor`. The repair hint and the no-clone upgrade command share that helper, so `loopx doctor` stops advertising the absent file for wheel installs too. Cover both layouts with real temp files: a checkout ships its installer, an installed module keeps its pip recovery, a subprocess loads the package from a site-packages-style root, and the real PowerShell parser plus an interpreter witness run over the generated fallback. Refs loopx-project#6121 Signed-off-by: JasonBuildAI <jasonbuildai@gmail.com>
b6a820a to
8ea7c4d
Compare
已修复评审的 P2(installed-layout fallback)新 head: [P2] installed-wheel fallback 指向不存在的安装脚本 —
测试与证据(本 head,原生 Windows):
未纳入:真实 English verdict: addressed at |
loopx-agent
left a comment
There was a problem hiding this comment.
动机
首次连接或修复 LoopX、照提示在 Windows PowerShell 中执行命令的操作者。
旧提示会要求 Windows 用户运行 python3/Bash;此前修复还会让 wheel 安装指向包中不存在的脚本。当前版本使用当前解释器,只有真实 checkout 带有安装脚本时才提供脚本路径。
本轮新构建并安装的 wheel 实际 CLI 输出已改为解释器 pip 命令,PowerShell 调用见证通过;真实 checkout 保留脚本路径,POSIX 完整提示和权限拒绝保持基线行为。
本 PR 修复打印的安装与修复提示,并统一命令生成;不自动执行用户安装,不新增权限或 Goal/调度规则,不宣称完成原生 Windows 安装验收。
改动思路
复用已有 install_contract 命令 owner,移除 doctor 中的重复平台规则,保留现有调用名称;真实布局检查属于该命令生成边界,不需要第二个安装框架。
依据是 issue #6121,以及不可变基线 5bf53ec6e4019670bf1c47aa508968bf1b3e6f39 的 安装指南:逐项核验现有 “Native Windows PowerShell 7” 的解释器/安装方式和 “Upgrade And Repair” 的修复、后续 doctor 顺序。文件存在只决定提示选择,不授予执行或升级权限。本次范围是既有 CLI 安装提示的语法和布局,不自动安装或改变 Goal/调度规则。
具体改动
完整审查 head 8ea7c4d36455acdc91ce0e5509189986415eb7a6 的四文件 +497/-63,包括相对上次 b6a820 的布局修复;没有继承旧批准。
bootstrap.py的普通返回和全局写权限拒绝返回都使用共享提示生成函数。doctor.py移除重复函数并继续导入同名调用接口;install_contract.py负责平台、PowerShell 单引号转义、&调用运算符及模块所属布局判断。_checkout_snapshot_installer同时要求脚本与pyproject.toml存在;不使用当前工作目录猜测 wheel 拥有脚本。no_clone_upgrade_command保留 ref/skip-skills/agent 参数的现有含义;缺少所属脚本时生成当前解释器 pip、workflow-skills、doctor 序列。local_install_command保留 checkout 安装入口。test_install_hint_platform.py覆盖平台、空格/单引号路径、部分/非所属布局以及真实 PowerShell 解析和调用,未全局改写os.name。
本轮在 macOS 使用 CPython 3.14.8、真实 PowerShell 7.6.6:head 相关测试 87 passed / 4 skipped,相同已有测试在基线 66 passed / 4 skipped;新增 21 个用例均运行。4 条跳过是原生 Windows 安装用例,不能记作通过。实际新 wheel 安装后运行 CLI,确实输出解释器 pip 路径;通过真实 CLI 恢复旧布局逻辑会打印不存在的脚本,独立 oracle 拒绝且 PowerShell 退出 1;当前解释器调用见证退出 0。该见证用无副作用参数代替 pip 升级,不声称执行了 Windows 安装。
真实 POSIX CLI 提示、12 组 doctor ref/skip/agent 字符串逐字保持。用只读全局目录测试 bootstrap 前置拒绝,完整诊断、后续动作和无 registry/state 写入与基线一致,只归一化临时目录及探针 PID。另一个 canonical connect 的“registry 路径为目录”错误仍在基线/head 创建隔离本地 Goal 后退出;没有把该路径误称为无副作用权限拒绝。
本轮先跑 changed-diff 语义 advisory,再跑完整 semantic-vocabulary smoke;两项改动文件 Ruff 通过。原生 premerge 初次 5 个直接检查通过、6 项中两项安装检查失败;同时 npm 准备曾有 ENOTEMPTY,后续 packaged smoke 在安装和 doctor 完成后因临时目录清理 ENOTEMPTY 退出。这些失败均保留,没有宣称其根因已修复。对照未准备的基线 archive,还重现了缺少打包资源的安装失败。
在分别准备好源码打包资源、隔离安装目录并设 LOOPX_USAGE_PING=0 后,基线两项原生安装检查通过;当前 exact head 重新执行同断言的原生 premerge,5 个直接检查 + 6 个选定检查全部通过,0 failure / warning / manual hold,包括 install-local、packaged install、update、maintainability、semantic vocabulary 和 first-connect。关闭测试统计不改变安装断言或限额,也不是声称默认统计清理不稳定性已解决。这里批准的是已由实际 wheel、CLI 和故障反例独立覆盖的提示修复;完整平台安装及长期运行仍未资格化。未读取、轮询或等待 GitHub CI。
对主干的风险
改动触及所有调用共享构造器的 CLI 提示,风险主要是平台选择、引号、布局假设和修复顺序。已有调用名称、POSIX 完整文本和拒绝权限边界都保留;没有新增配置开关、状态词汇、调度/额度或自动安装效果。该 Python 代码是既有宿主文本适配边界,不复制 TypeScript 决策 authority。
本机不是 Windows;完整原生安装、snapshot promotion、用户升级和模型遵循提示未测。独立的 python_install_owner 分发升级分支没有被此 PR 修改,不宣称一起修复。权威目录拒绝要求由其宿主恢复权限,提示正确不构成权限授予。
我的整体评价
当前修复交付了真实安装布局上的可用提示,解决此前 wheel 缺脚本的反例;不增加用户导航、重复填写或确认。对体验的正向证据是复制命令能启动所属解释器;对长期维护的正向证据是平台规则收敛到一个 owner。未测跨 Goal/领域 Agent 的长期节约时间或净效果,因此不报收益百分比。
本次未来变更成本检查已应用同域、可回退的 owner 合并和布局小 helper;没有需要当前再拆出的框架。批准仅覆盖上述打印提示边界,历史讨论保留,merge readiness 和实际权限另行读回,不代表完成全产品安装资格。
Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; xhigh.
English verdict: APPROVE - exact head 8ea7c4d. The installed-wheel CLI now uses its owning interpreter instead of a nonexistent checkout script; POSIX guidance and permission refusal retain baseline semantics. Real PowerShell grammar/invocation and wheel-layout counterexample were exercised on macOS; full native Windows installation and long-run savings remain untested.
Goal And Delivered Outcome
Outcome basis / optional anchor: reproduced defect, tracked as [Bug]: loopx connect prints POSIX-only install/repair commands on native Windows #6121.
Goal/source and gap:
loopx connect(bootstrap) prints a hardcoded POSIX repair hint (python3 -m pip install --upgrade loopx;curl … install.sh | bash;export PATH="$HOME/.local/bin:$PATH"). On native Windows those commands do not run, whileloopx doctoron the same host already prints the platform-correct form. The two agent-facing surfaces disagree. The first Windows shape that reused the doctor generator also kept a checkout-only assumption: an installed wheel printedpwsh -File <site-packages>/scripts/install-windows.ps1, a file the wheel does not ship, so PowerShell exited 1 on the printed fallback.Observable before → after, with the validation row that proves it:
loopx connect --project <dir> --dry-run --no-global-syncprinted the POSIXpython3/curl | bash/export PATHblocks; on Windows it now prints the running interpreter for the repair hint, and for the fallback the checkout installer only while the checkout that owns the running module actually shipsscripts/install-windows.ps1; an installed distribution instead recovers through& '<interpreter>' -m pip install --upgrade loopx. POSIX stays byte-identical to the shipped constants. Proven bytests/test_install_hint_platform.pyplus an installed-wheel entrypoint readback.Issue/task and intended base: Closes [Bug]: loopx connect prints POSIX-only install/repair commands on native Windows #6121; intended base
main.Author Declaration
AI disclosure: this change was drafted with AI assistance at my request, under my direction and review.
Implemented against
loopx/install_contract.pyinstall_repair_commandtests/test_install_hint_platform.pyloopx/install_contract.pyarchive_fallback_install_command,_checkout_snapshot_installer,no_clone_upgrade_commandtests/test_install_hint_platform.pytests/test_install_hint_platform.py::test_install_hint_commands_follow_the_host_platform[posix]<site-packages>/scripts/install-windows.ps1, which does not exist; real PowerShell 7.6.5 exits 1), then verified the fix at the pushed head with the same wheel readback, a 0-error PowerShell parse and a real interpreter witness. Ranruffandpython -m mypy(one pre-existing Windows-only error) plus the focused install/doctor suites; read the full diff. Deliberately left out: reworded POSIX text,examples/fresh-clone-quickstart-smoke.py(POSIX-onlyinstall-local.shpath), andpython_install_owner.python_distribution_upgrade_command(separately owned pip-quoting gap).Scope And Continuation
Validation
unitpassedtests/test_install_hint_platform.py(21 passed on native Windows): checkout vs installed layouts from real temp files, installed-module subprocess load, real PowerShell 7.6.5 parsing of the generated fallback in both layouts, and a real interpreter witness.unitpassedtests/test_doctor_install_freshness.py,tests/test_doctor_installation_scope.py,tests/test_windows_install.py,tests/test_agent_onboarding_unconnected_project.py,tests/test_workflow_skill_install.py,tests/test_desktop_installation.py,tests/test_project_organization_identity.py(70 passed together with the new file).real_entrypointpassed& '<interpreter>' -m pip install --upgrade loopxfor both hint blocks; that fallback parses with 0 PowerShell errors and its interpreter line really runs (witness). The source checkout still prints this checkout's existingscripts/install-windows.ps1.regression_paritypassedstaticpassedpython -m ruff check loopx/install_contract.py tests/test_install_hint_platform.py;ruff format --checkon the test file.staticfailedpython -m mypyreports one pre-existing Windows-only error (loopx/control_plane/effect_runtime.py:Module has no attribute "WNOHANG"), which reproduces on the untouched base.pip install --upgradeor snapshot installation, and the native POSIX differential run (host limitation, pre-existing).Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
N/A, this PR does not progress the TypeScript control-plane migration or the shared Goal Authority RFC.
Boundary Checklist
none.Signed-off-bytrailer.