Repository navigation
fix(profile): re-append the registry PATH so psmux panes see env_add_path tools - #299
Merged
Merged
Conversation
…path tools psmux's __warm__ pool re-spawns itself from its own environment, so every pane inherited the PATH of whichever shell first started the pool. starship 1.27 moved from a scoop shim to env_add_path (a User PATH entry), so it went missing in every pane and 10-tools silently skipped its init: panes showed a plain PS> prompt while the outer Windows Terminal shell had starship. profile.ps1 now appends any Machine/User registry PATH entry the process lacks (Merge-DotPathList, core/05-lib.ps1) before the layers load, ahead of the command-cache fingerprint. Append-only, so process-local prepends keep their priority and reload is a no-op. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the PATH recovery changes.
No open issues 🎉
What changed in this PR
This PR restores tool discovery in PowerShell shells that inherit a stale PATH from psmux’s warm pool, addressing missing starship initialization while preserving process-local PATH precedence.
Changes:
- Adds and exports
Merge-DotPathListto append missing PATH entries with normalized duplicate detection. - Merges registry Machine and User PATH entries before profile layers initialize.
- Adds six helper tests and documents the warm pool’s environment behavior.
| File | Description |
|---|---|
tests/Lib.Tests.ps1 |
Tests PATH merging, normalization, ordering, idempotence, and null handling. |
psmux/psmux.conf |
Documents stale environments and the profile’s PATH recovery. |
powershell/profile.ps1 |
Appends missing registry PATH entries before loading layers. |
powershell/Dotfiles/Dotfiles.psd1 |
Exports Merge-DotPathList. |
powershell/core/05-lib.ps1 |
Implements the PATH merge helper and declares it in the load contract. |
Review effort: Balanced
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.
Problem
Opening a pwsh tab auto-attaches psmux, and the pane shells inside it came up with the stock
PS>prompt instead of starship.exitback to the outer Windows Terminal shell showed starship again.Root cause
mainbucket manifest switched frombintoenv_add_path: ".". scoop no longer writesscoop\shims\starship.exe; it addsscoop\apps\starship\currentto the User PATH in the registry.warm on, each__warm__server spawns the next one from its own environment (the--spawnerlineage). So panes inherit the PATH of whichever shell first started the pool.psmux show-environment -gshowed a PATH from before the upgrade: no starship dir, plus the deleted pwsh 7.6.5/7.6.6 dirs.Test-Cmd starshipis false, so10-tools.ps1skips the init. zoxide still loads because it has a shim, sopromptended up as zoxide's wrapper around the default prompt.Fix
Merge-DotPathList(new,core/05-lib.ps1, exported by the Dotfiles module): appends the entries from-Addthat the PATH string doesn't already have. Matching ignores case and a trailing\, and%VAR%entries are expanded before comparing. It never reorders or removes anything, so process-local prepends like mise shims keep their priority and a second run is a no-op.profile.ps1calls it with the registry's Machine + User PATH right after the module import and before the layers load. That ordering matters because00-aliasesfingerprints PATH for the command cache. The cost is two registry reads and no spawn. A degraded load (module import failed) skips it.psmux.conf: added a note underwarm onthat the pool also freezes the environment, and that only PATH is now healed by the profile.Verification
psmux show-environment -g, with the mux markers set. The parent shell couldn't resolve starship; the child resolvedscoop\apps\starship\current\starship.exe,DotfilesInit.StarshipwasTrue, and zoxide'spromptwraps starship's again.Merge-DotPathListcases.task.ps1 lintpasses. A live pane still needsreloador a pool recycle (psmux kill-server -t __warm__) to pick up the new profile.🤖 Generated with Claude Code