Repository navigation
DWSH-49: fix false success when installer skills are missing - #1547
Merged
dingtalk-dws-reviewer-router[bot] merged 1 commit intoOct 22, 2026
Merged
dingtalk-dws-reviewer-router[bot] merged 1 commit into
dingtalk-dws-reviewer-router[bot] merged 1 commit into
Conversation
Stop both installers from reporting success when release skills are unusable and local fallback is unavailable. Add isolated regression coverage for the failure branches. Refs #779
typefield
reviewed
Oct 22, 2026
typefield
left a comment
Collaborator
There was a problem hiding this comment.
CR 结论:改动正确,建议合并(等 CI 全绿)
重点核对
1. 失败时能否中断成功提示 —— 能,两端都成立
- shell:
err()是printf + exit 1(install.sh:52),在install_skills缺失分支直接终止进程,main 里的🎉 Installation complete!不会执行;trap EXIT仍会清理 tmpdir。 - PowerShell:顶层 main 无 try/catch,
throw作为脚本终止性错误直接跳过 banner。Install-Skills内新增的 throw 位于 try/finally 中,finally 的$tmpDir清理保留完好;Install-SkillsLocal的 throw 无论被 main 直接调用还是经Install-Skills的 try/finally,都不会被吞。
2. PowerShell 用 throw 而非 Write-Err —— 理由成立
Write-Err 里是 exit 1,irm | iex 场景会杀掉用户的交互会话;throw 只终止脚本块。同函数内下载失败分支仍用 Write-Err(irm|iex 下会关会话),属于已知不一致,PR notes 已声明范围外,可接受,建议后续统一。
3. 测试覆盖 —— 有效且真实(已代跑)
PR 自述"测试未在本地运行",我实际执行了目标测试命令:
PR 分支: 5/5 PASS(shell mono/multi + ps1 mono/multi/local-missing;本机有 pwsh,PS 测试真实执行)
main 分支: 如预期 FAIL —— 复现了 "Skipping skills installation" 后仍打印 "🎉 Installation complete!" 的假成功
反向验证通过,说明是真回归测试。fixture 设计到位:SHA256 校验通过后才进入内容检查(断言输出含 "SHA256 checksum verified"),排除的是"内容缺失"而非网络/校验失败;同时断言失败后不创建 ~/.agents/skills/dws。mono 用 multi-only 包、multi 用无 skills 包,两个方向都覆盖到了。
建议(非阻塞)
- shell 本地目录缺失分支与 ps1 不对称:ps1 的
Install-SkillsLocal缺目录已改为带 "Skills were NOT installed." 的 throw,但 shell 的install_skills_local(install.sh 约 959 行)仍是say "Skipping skills installation." + return 1。set -e下确实也会 fail-closed、不会打印成功 banner,但用户看到的最后信息是 "Skipping" 而退出码是失败,信息有误导。建议顺手对齐成err "...Skills were NOT installed."。 - 小脆性提示:shell 测试
envWithSkillMode先 append 默认值(DWS_SKILLS_ONLY=0),靠 extras 后追加覆盖,依赖 sh 后者覆盖前者的语义——现有测试已这么用且通过,仅提示。 - ps1 throw 会带 script position 堆栈噪声,纯美观问题。
其他
.changes/779-installer-skills-fail-closed.md符合目录既有约定(category: Fixed)。- 覆盖缺口提醒:未测"release 包无可用 skills 但本地 source 可用"的 fallback 成功路径,但已有 source-mode 测试覆盖本地安装,可接受。
- Windows PowerShell 5.1 原生验证依赖 CI Windows job(目前 Test (Windows) 已 SUCCESS)。
typefield
approved these changes
Oct 22, 2026
typefield
left a comment
Collaborator
There was a problem hiding this comment.
CI 已全绿。结合上面的 CR(失败分支确实中断成功提示、throw/finally 清理正确、回归测试本地代跑通过且在 main 上反向验证可复现假成功),Approve。剩余 3 条均为非阻塞建议,可后续跟进。
dingtalk-dws-reviewer-router
Bot
merged commit Oct 22, 2026
52f38a4
into
main
63 of 64 checks passed
dingtalk-dws-reviewer-router
Bot
deleted the
codex/dwsh-49-installer-skills-fail-closed
branch
October 22, 2026 13:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a checksummed release archive contains no usable skills for the selected mode and no local checkout is available, both installers currently return from skills installation and still print
Installation complete!.finallycleanup.errhelper for the equivalent release-archive branch.The download-failure branch already fails; this change addresses the separate missing-skill-content branch described in #779. PowerShell uses
throwrather than theWrite-Errhelper'sexit, to avoid closing an interactiveirm | iexsession.Closes #779.
Risk tier
The implementation change is limited to three failure branches. Automation that previously accepted these false-success results will now receive failures. A full install may already have installed the CLI binary before skills installation fails.
Verification
Release fragment added:
.changes/779-installer-skills-fail-closed.md.Static comparison against
main@87d23e5cf1b181e33aa302b0502d1af2922cea79: both original installer blobs retain the affected branches.Regression tests added and formatted with
gofmt; tests have not been run locally.Targeted test command:
Native Windows PowerShell 5.1 execution and the existing successful-install tests remain required verification. The PowerShell regression test prefers Windows PowerShell on Windows and skips when no supported PowerShell executable is installed.
Full suite, packaging verification, builds and policy checks have not been run.
No CLI command paths, flags, generated artifacts or workflows change.
Notes
Proxy routing, README expansion and broader interactive
exitbehavior are outside this patch.