fix(desktop): resolve agent CLIs via Windows registry PATH when process env is stale - #4464
Open
andrexibiza wants to merge 1 commit into
Open
fix(desktop): resolve agent CLIs via Windows registry PATH when process env is stale#4464andrexibiza wants to merge 1 commit into
andrexibiza wants to merge 1 commit into
Conversation
…ss env is stale The managed-agent resolver probes for CLI binaries only against the inherited process PATH. On Windows, apps relaunched by an updater, service, or long-lived parent keep the environment they were launched with, so PATH entries written to the registry later are invisible and installed runtimes report as NotInstalled even though a freshly spawned process resolves them. Hermes Agent is the concrete case: its hermes-acp launcher lives in the install's venv Scripts dir, which the 0.5.3 auto-updater relaunch no longer carried. The registry Environment\Path (HKLM + HKCU) still has the entry. Fall back to the machine and per-user registry Path values when the process PATH scan misses: read both hives, expand %VAR% references, and scan those dirs for the target basenames. Mirrors the existing git_bash_from_registry pattern. discovery.rs stays under its file-size ratchet by moving the shim scan into the new registry_path module. Signed-off-by: andrexibiza <84248988+andrexibiza@users.noreply.github.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
What
The managed-agent resolver (
resolve_command_uncached) probes for CLI binaries only against the inherited process PATH. On Windows, apps relaunched by an updater, service, or long-lived parent keep the environment they were launched with, so PATH entries written to the registry later stay invisible and installed runtimes reportNotInstalled— even though a freshly spawned process resolves them fine.Concrete case: Hermes Agent on Windows. Its
hermes-acplauncher lives in the install's venvScriptsdir. After Buzz 0.5.3 auto-updated and relaunched, the new process's environment no longer carried that PATH entry (the registryEnvironment\Pathstill had it), so the Hermes preset flipped from Ready toNotInstalledovernight with no change to the Hermes install itself.Fix
When the process-PATH scan misses, fall back to the machine and per-user registry
Environment\Pathvalues — the authoritative post-login PATH:HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\EnvironmentthenHKCU\Environment(matches the effective merge order).%VAR%references (registry values areREG_EXPAND_SZ) viaExpandEnvironmentStringsW..cmd/.batshims).New module
discovery/registry_path.rsmirrors the existinggit_bash_from_registrypattern.discovery.rsstays under its file-size ratchet (it actually shrinks: the.cmd/.batshim scan moved into the module).Verification
cargo check --libclean (only pre-existing warnings).cargo test --lib managed_agents::discovery: 86 passed, 0 failed — including a new testresolve_in_dirs_finds_binary_from_registry_style_dir_listthat resolves a binary present only in a registry-style dir list.cargo fmt --checkand the desktop file-size ratchet both pass.NotInstalled; relaunching with the registry PATH present makes the harness Ready.Related
Complementary to #3334 (which switches the Hermes preset to
hermes acpfor the macOS/Linux login-shell case). This change fixes the Windows updater-relaunch case regardless of which command name the preset uses.