Skip to content

fix(profile): re-append the registry PATH so psmux panes see env_add_path tools - #299

Merged
Gerrrt merged 1 commit into
mainfrom
fix/pane-stale-path
Oct 29, 2026
Merged

Gerrrt merged 1 commit into
mainfrom
fix/pane-stale-path

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Problem

Opening a pwsh tab auto-attaches psmux, and the pane shells inside it came up with the stock PS> prompt instead of starship. exit back to the outer Windows Terminal shell showed starship again.

Root cause

  • starship lost its scoop shim. In starship 1.27.0, the main bucket manifest switched from bin to env_add_path: ".". scoop no longer writes scoop\shims\starship.exe; it adds scoop\apps\starship\current to the User PATH in the registry.
  • psmux panes run on a stale environment. With warm on, each __warm__ server spawns the next one from its own environment (the --spawner lineage). So panes inherit the PATH of whichever shell first started the pool. psmux show-environment -g showed a PATH from before the upgrade: no starship dir, plus the deleted pwsh 7.6.5/7.6.6 dirs.
  • The profile skipped starship without a warning. In a pane, Test-Cmd starship is false, so 10-tools.ps1 skips the init. zoxide still loads because it has a shim, so prompt ended 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 -Add that 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.ps1 calls it with the registry's Machine + User PATH right after the module import and before the layers load. That ordering matters because 00-aliases fingerprints 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 under warm on that the pool also freezes the environment, and that only PATH is now healed by the profile.

Verification

  • Loaded the profile in a child pwsh using the exact stale PATH from psmux show-environment -g, with the mux markers set. The parent shell couldn't resolve starship; the child resolved scoop\apps\starship\current\starship.exe, DotfilesInit.Starship was True, and zoxide's prompt wraps starship's again.
  • Pester: Lib, Module and LoadContract suites pass (268), including six new Merge-DotPathList cases.
  • task.ps1 lint passes. A live pane still needs reload or a pool recycle (psmux kill-server -t __warm__) to pick up the new profile.

🤖 Generated with Claude Code

…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>
Copilot AI balanced review requested due to automatic review settings October 29, 2026 22:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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-DotPathList to 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

@Gerrrt
Gerrrt merged commit 3405e58 into main Oct 29, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants