Repository navigation
fix(skills): preserve workflow command arguments in PowerShell - #7232
Conversation
Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent | gpt-6.1-sol | OpenAI | runtime_reported | reasoning_effort=max
Exact head: 154ec10966f0796d9d3d0a7769295a25158a9e84
动机
在 PowerShell 中复制技能安装与回滚命令的用户。 技能目录含单引号、美元符号或中文时,原命令在 PowerShell 中拆错参数;修复后安装进入指定目录,回滚删除未修改文件并保留用户编辑。 本轮执行了打印出的真实 CLI 命令,8 组安装/回滚旅程成功:默认与显式宿主均落在指定目录,4 个干净回滚移除文件,4 个编辑回滚原字节保留。 范围限于已存在命令的宿主引号渲染;不修改安装权限、默认目录、宿主选择语义,也不认证 live App 已加载或全仓健康。
改动思路
复用现有 python_install_owner.interpreter_invocation,比复制一套 PowerShell 引号更小;安装器只把结构化 argv 交给渲染器,既有命令分派、文件写入、摘要和回滚判断保持各自原 owner。 当前边界仅替换预览安装和成功安装后回滚这两个输出点;相同目标、宿主参数和安装/卸载语义通过现有 CLI 消费。
Doing nothing retains reproduced broken argv. Reuse existing host renderer at both sites; escaping apostrophes alone or duplicating a shell formatter is narrower in bytes but wrong or redundant. 原权威输入和失败恢复边界保留:只读观察器不会成为宿主写者;打印安装指导不会成为自动安装授权。这里用文字说明前后行为即可,不引入未核实图示或新的用户确认步骤。
具体改动
接受的修改前规格为 docs/integrations/ego-source-reader.md,不可变版本 75f3787116760b019d3245bdff16b1d991ce2837。explicit-target-scope:implemented,8 actual printed-command installation/rollback journeys with default/explicit host selectors;rollback-preserves-local-edits:implemented,4 edited rollback cases preserve exact bytes, 4 clean remove cases, 69 original tests。新增文档和作者自定义清单不是独立验收来源;平台实现仍需符合原始只读、来源恢复或既有目录与回滚契约。
关键代码讲解
-
workflow_skill_install:Preview, explicit target install and rollback command;both command text sites delegate exact argv to existing host-aware renderer。输入由原调用者提供,错误/重试仍归原 owner;未把内部助手变成新执行能力。
-
interpreter_invocation:Shared shell literal owner;unchanged host switch: PowerShell call operator/literals or POSIX shlex.join。输入由原调用者提供,错误/重试仍归原 owner;未把内部助手变成新执行能力。
-
handle_workflow_skills_command:Existing actual CLI dispatch and exit;unchanged explicit operation, target, host, dry-run and exit handling。输入由原调用者提供,错误/重试仍归原 owner;未把内部助手变成新执行能力。
-
_uninstall_managed_skills:Digest-checked removal with edited content preservation;unchanged actual transaction; command now reaches it with exact argv。输入由原调用者提供,错误/重试仍归原 owner;未把内部助手变成新执行能力。
完整审查2个路径 +50/-4,包括全部生产分支、相邻未修改消费者、持久测试和文档/工作流影响。没有新增共享状态、枚举、CLI参数或第二策略owner;Python保留为现有平台IO或安装渲染适配层,不扩展无关迁移。
对主干的风险
原三个模块在本头 69 passed,无跳过,两个PowerShell用例实际使用临时隔离的官方PowerShell 7.6.8 Core/macOS。同一套仅恢复不可变基线的两处shlex.join输出,结果 2 failed/67 passed,失败精确对应默认与显式宿主的PowerShell参数被拆分。额外8组实际复制命令旅程执行了安装与回滚,未用伪loopx函数代替CLI:路径包含单引号、美元符号、中文和分号,默认与显式宿主都先经真实CLI生成文件,再独立读manifest/技能内容及宿主entry。4个干净回滚删除未修改文件,4个编辑回滚非零返回且原字节保持。4次旧PowerShell安装命令在写目标前失败;POSIX完整预览字典逐值相同。
首次基线测试命令曾因误写两个测试文件名而在收集前退出4,原结果已保留;修正为同一原测试路径后得到上述2红67绿,不是生产代码失败或通过。local quick premerge 6直接+3选中检查通过,包括实际本地安装、打包CLI安装及update smoke,未削弱门槛;本轮未查询或等待远程CI。新测试中函数loopx只证明参数保真,额外真实CLI/磁盘readback补上了它不能证明的安装与回滚效果。
没有改动默认目录、配置协议、能力开关、安装权限或Ego激活。shell文本由既有owner统一渲染,POSIX的shlex行为保持;Windows文件系统和Windows PowerShell5.1没有独立执行,不将Core/macOS解释器外推为全Windows产品验收。
我的整体评价
未发现阻塞问题,APPROVE。局部交付为 goal_achieved,长程语义 preserved、用户体验 improved,仅指已复现的参数与实际安装/回滚闭环;未以测试数量证明长期净收益。架构判断 retain,既有渲染owner已经足够,两处调用替换是有界简化,无需新能力或迁移。 复用现有 python_install_owner.interpreter_invocation,比复制一套 PowerShell 引号更小;安装器只把结构化 argv 交给渲染器,既有命令分派、文件写入、摘要和回滚判断保持各自原 owner。 当前边界仅替换预览安装和成功安装后回滚这两个输出点;相同目标、宿主参数和安装/卸载语义通过现有 CLI 消费。
检查了现有 CLI 的预览、安装、回滚与 Markdown 输出;仅命令文本引号改变,无页面、控件布局或视觉素材改动,视觉评审不适用。 PowerShell 为实际 Core 7.6.8/macOS;Windows 文件系统、Windows PowerShell 5.1、已安装 App 的技能加载、真实个人根目录和全仓套件未独立运行。 通过、失败与未测试范围分别保留;合并、安装采用和其他PR验收仍须单独满足其现有边界,本轮未合并或安装到个人宿主。
English verdict: APPROVE. Reusing the existing host renderer fixes the reproduced PowerShell argument split while preserving POSIX output and the original installation/rollback owner. Real PowerShell Core parsing, actual printed CLI journeys, local content readback and old-renderer sensitivity passed. Native Windows filesystem/PowerShell 5.1 and live loaded-skill adoption remain unverified.
Goal And Delivered Outcome
Workflow skill inspection prints install guidance using POSIX quoting on native Windows. A normal skills directory containing an apostrophe is split into multiple arguments by PowerShell, so copying the command fails. The rollback command has the same defect.
Reuse the existing host-aware command renderer for both outputs. PowerShell now preserves the exact target and host selection, while POSIX argv behavior stays unchanged. No installation authority or new CLI option is introduced.
Author Declaration
workflow_skill_install()install/rollback guidance andpython_install_owner.interpreter_invocation()at75f3787116760b019d3245bdff16b1d991ce2837; reproduced command failure is the outcome basis. Intended base:main.Validation
Tested revision:
154ec10966f0796d9d3d0a7769295a25158a9e84. Run state: finished. Inputs: synthetic. Native Windows, CPython 3.12.10 and PowerShell; disposable skills only.tests/test_workflow_skill_install.pyandtests/test_python_install_owner_platform.py: 45 passed. Four new cases cover PowerShell/POSIX argv and default/explicit host selection, with real temporary skill installation/readback and modified-file preservation. The two PowerShell cases failed before the repair; POSIX controls passed.tests/test_install_hint_platform.py: 24 passed.preserved_modifiedwhile retaining the edited bytes. No global or actual user skills were installed.Scope And Continuation
Complete within printed workflow install/recovery guidance. Reuse of the existing renderer removes the duplicate quoting decision without adding another helper or changing skill lifecycle rules. This stable Python installation adapter remains its nearest owner.
Frontend/Lark: no new surface, operation or configuration; existing CLI guidance is corrected. The full repository suite, actual POSIX subprocess execution, packaged frontend/Lark and pip installation were not run. Hosted CI and maintainer review remain pending; no approval or merge is claimed.