Repository navigation
Conversation
…es Its Holders (#3851) ## Summary A failed winget install or upgrade in `host-setup/windows/install-tools.ps1` names the processes holding the tool's files only where something says files were in use. Before this change the only signals were the package's own installer log (`<id>.*.log`) and a short list of exit codes. A portable or zip package, `astral-sh.uv` among them, has no installer, so it writes no such log. winget's refusal to delete a running executable is reported under the generic `0x8A150052`, so such an upgrade failed with no hint of what held the file. - `Get-InstallerFailureReason` now also reads winget's own `WinGet-<timestamp>.log` for the failed call. That is the latest one created at or after the attempt that names the package id, which winget logs among its arguments, and only its `<E>` lines are kept. The `list` and `show` probes that run before the attempt are passed over. - In winget's own log, an access denial naming a file (`Access is denied.: "<path>"`) counts as files in use, as does Windows' "used by another process". A denial naming no file does not. The installer-log wording is unchanged, since an installer's "Access is denied" can be a permission failure no running process causes. - `Select-FailureEntry` is the old in-function "last few entries, keep the in-use one" logic pulled out, so both logs share it. - `Write-InstallFailure` prints a `winget's own log says:` block and the log's path beside the installer-log block. This applies to every winget package rather than to uv alone. A package with an installer still reports through its installer log as before. The `comments` label is on this pull request because the change corrects the header comments of both functions, which the new behavior would otherwise leave false. ## Verification - `uv run --no-project --with pytest python -m pytest tests/test_install_tools.py -q`: 23 passed, 18 skipped. The new cases cover a portable package's reason read from winget's log, a longer id that only starts with the package id not being read as its log, an installer log's denial alone and a winget denial naming no file not counting as in use, and the report naming holders from winget's log. - The new `Get-InstallerFailureReason` run on a Windows 11 host against a real failed portable upgrade's DiagOutputDir selected the upgrade's own session log over the probes before it, set `InUse` to true, and returned the `remove: Access is denied.` entry. - Ruff, mypy, and PSScriptAnalyzer with the repository settings are clean. ## Findings from the local strict review Five recorded passes ran, the last over `10a272ba` with no findings. The two `introduced` findings this body listed after the opening push are both fixed in `8e5a0b6b`: - `host-setup/windows/install-tools.ps1:601` (`introduced`): the `Write-InstallFailure` header said a Git upgrade that failed on a download "leaves no log", which winget's own session log made false. **Fixed in `8e5a0b6b`.** - `host-setup/windows/install-tools.ps1:507` (`introduced`): the winget-log in-use pattern accepted "access is denied" on any `<E>` line. **Fixed in `8e5a0b6b`**, which counts only a denial naming a file. The fourth pass also raised a dead empty-entry guard in `Select-FailureEntry`, fixed in `10a272ba`. It raised one more, a denial naming a file outside the tool's install tree, such as winget's temp download folder under an antivirus lock, counting as in use. That one is declined under `GOVERNANCE.md` "Trust Boundaries and Hardening Effort". Its only effect is a printed suggestion naming processes running from the tool's own install tree, which is neither silent nor destructive nor one an outsider can trigger. winget logging such a denial is also unverified. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…3855) ## Summary Refs #1754. Both candidates the issue names reproduce on native Windows 11, and this fixes both. - **Every `claude` child runs the path `shutil.which` returned.** `CreateProcess` searches for a bare name with `.exe` alone, so it misses the `claude.cmd` an npm install puts on `PATH`. - **A report child's deadline holds on Windows.** `subprocess.run` kills only the direct child there, then waits with no bound for the pipes to close. `run_with_deadline` kills the tree with `taskkill /T` and bounds the final collection. - **Undecodable output now reaches the caller on Windows.** Text mode decodes on a reader thread there, so a decode failure printed a traceback and the caller got `stdout=None`. `git_in` re-raises that error on purpose, and its mocked test could not show that the error never arrived. The helper decodes on the calling thread. ## Measured on native Windows Each case used a stub, with `claude.cmd` and System32 alone on `PATH`, or the real Git for Windows launcher with a stalling alias. | Case | Before | After | | --- | --- | --- | | Listing through `claude.cmd` | `None`, read as unknown | `[]` | | `live_channel` | `registered: None` | `registered: False` | | `register_claude_marketplace` | `False` | `True` | | `install_claude_plugin` | raises `FileNotFoundError` | `True` | | 3-second deadline, stalled git behind the launcher | 20.1 seconds, the length of the stall | 3.2 seconds | A resolved `.cmd` path also runs without `shell=True` where the shim's directory and an argument hold a space. ## Tests - `ClaudeCmdShimCase` drives a real stub shim, and skips off Windows. - `RunWithDeadlineCase` drives a real process tree whose grandchild inherits the pipes. - Against the old `subprocess.run` form, the timing test fails at 30 seconds. - With the tree kill reduced to a direct kill, the tree test fails. - The full suite passes natively from Git Bash on this head: 3377 tests, 354 skipped. ## Left as they are A `.cmd` shim runs through `cmd.exe`, so two checkout path shapes behave differently there, measured with a stub. Both are declined under `GOVERNANCE.md` "Trust Boundaries and Hardening Effort", since the path is trusted input and the shape is rare. - An `&` in a path with no spaces cuts the argument there. The child exits non-zero, and registration prints that and returns `False`. - A `%NAME%` in a path expands to that variable's value. This one is not loud. A real directory name holding `%` around a defined variable name is what it takes to reach it. The maintainer confirmed this decline on this pull request. ## Pre-existing findings, filed - #3854 (`scripts/pr_review.py`, `scripts/pr_cleanup.py`, `scripts/local_review.py`, `scripts/host_gate.py`, `scripts/docker_lint.py`, class `pre-existing`). These run the same captured `subprocess.run` with a timeout, so they can outlast their deadline in the same way. They are unmeasured, and they move to one shared primitive in a change of their own. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
There was a problem hiding this comment.
🟡 Changes recommended
An active review finding remains because the comment in host-setup/windows/install-tools.ps1 has a grammatical error that should be corrected.
1 open issue
What changed in this PR
Promotes the latest develop changes to main, improving Windows winget failure diagnostics and making the skills installer more reliable with Claude CLI shims and stalled subprocesses.
Changes:
- Reads winget session logs and reports relevant failure details and file-holder processes.
- Resolves the Claude executable through
shutil.which, including Windows.cmdshims. - Adds deadline handling and process-tree cleanup for report subprocesses.
- Expands coverage for winget diagnostics, subprocess deadlines, decoding failures, and Windows shims.
| File | Summary | Findings |
|---|---|---|
tests/test_skills_install.py |
Tests process deadlines, decoding failures, and Windows Claude shims. | No findings. |
tests/test_install_tools.py |
Tests winget-log selection, failure classification, and report output. | No findings. |
scripts/skills_install.py |
Adds Claude path resolution and bounded subprocess execution. | P1: Catch UnicodeDecodeError when Claude output cannot be decoded. P1: Terminate the POSIX process group and reap descendants before returning from a deadline. |
host-setup/windows/install-tools.ps1 |
Reads winget logs and reports portable-package failure details and file holders. | P2: Treat hyphens as part of package IDs to avoid matching another package’s log. P2: Continue failure reporting when a winget log is unreadable. P3: Fix the grammar in the related comment. |
This pull request requires changes.
Review effort: Lite
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3856 +/- ##
==========================================
+ Coverage 83.30% 83.31% +0.01%
==========================================
Files 29 29
Lines 9937 9956 +19
==========================================
+ Hits 8278 8295 +17
- Misses 1659 1661 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
## Summary Answers the findings on promotion #3856, whose head is `develop`, so a code fix lands here first. Each test below failed before its fix, measured on native Windows 11. - **A locked winget log no longer aborts the failure report.** `Select-String` was the one log read with no `-ErrorAction`, so under the installer's `Stop` preference it threw. Measured under pwsh 7 and Windows PowerShell 5.1. A throw there would also skip the Docker maintenance exit that follows the report. - **A package id in winget's own log matches whole.** A hyphen counts as part of an id, so `Portable.Tool` does not take a log naming `Portable.Tool-Extra` or `Vendor-Portable.Tool`. - **An undecodable `claude` listing returns `None`**, as `claude_json` documents, where it raised before. `git_in` keeps raising on purpose, since `None` from it could read as a clean tree, and its docstring now says so. The full suite passes natively from Git Bash on this head. ## Findings from the local passes A pass raised that the installer-log filter `<id>.*.log` also takes a longer id, such as `OpenJS.NodeJS.LTS` for `OpenJS.NodeJS`. `c6a423be` added a name filter for it, and the next pass raised two findings against that filter. `87abc727` removes the filter, which answers both, and these are their outcomes. - `host-setup/windows/install-tools.ps1`, the longer-id match, class `introduced`. Declined under `GOVERNANCE.md` "Trust Boundaries and Hardening Effort". Packages install one at a time and the window opens just before each call, so a sibling's log falls inside it only where a second winget runs during the attempt. - `host-setup/windows/install-tools.ps1`, the filter as over-hardening, class `introduced`. Fixed in `87abc727`. - `host-setup/windows/install-tools.ps1`, the filter dropping an attempt's own log where its version starts with neither a digit nor `v`, class `introduced`. Fixed in `87abc727`. The hyphen boundary needs the same second winget to matter, and it stays because it costs nothing. It cannot drop the attempt's own log, where the name filter could. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
Answering the round at #3856 (review), whose file table names these findings with no thread. The digest counted (3), and the table lists the four below, so each is answered.
|
There was a problem hiding this comment.
🔵 Needs a closer look
Approval should be deferred because the platform-specific PowerShell and Windows process-tree changes require native Windows execution that was not performed in this review.
No open issues 🎉
1 resolved since last review
Review effort: Lite
|
Answering the round at #3856 (review), (1) item, its headline: "Approval should be deferred because the platform-specific PowerShell and Windows process-tree changes require native Windows execution that was not performed in this review." No change needed. That execution was performed outside the review. The required |
…e Variables (#3861) Promotes the change merged into `develop` since promotion #3856 to `main`. - [#3859](#3859) documents a Windows devcontainer launch with `HOME` and `USERPROFILE` both set, which `devcontainer.json` substitution cannot fix. It defines the supported route as opening the repo from inside a WSL2 distribution, and states a native launch's conditions and what Docker does with an absent mount source. That pull request's body holds the measurements and what was not measured. Docs only. The defects those measurements found stay open: #3858 for image tags that stop a snippet starting, and #3860 for read-only mounts that are writable. Closes #3852 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Promotes the changes merged into
developsince promotion #3849 tomain.host-setup/windows/install-tools.ps1, so a portable package whose files are in use names the processes holding them.claudechild inscripts/skills_install.pythrough the pathshutil.whichreturned, so an npmclaude.cmdshim is reached. It also makes a report child's deadline hold on Windows, where a 3-second deadline over a stalled git took 20.1 seconds and now takes 3.2. Measured on native Windows 11, with the full suite passing there.claudelisting reads as unknown.Fixes #1754
🤖 Generated with Claude Code