Skip to content

fix(shell): skip the shell config scan when the install offer can't prompt - #4522

Merged
max-sixty merged 2 commits into
mainfrom
fix/shell-hint-skip-pwsh-probe
Oct 20, 2026
Merged

max-sixty merged 2 commits into
mainfrom
fix/shell-hint-skip-pwsh-probe

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Since v0.80.0, every wt switch without an active shell wrapper spawns pwsh when PowerShell is installed, adding about 150-200 ms per call. That includes non-interactive calls such as wt switch -c x --format json from agents. #4422 made the shell config scan ask the installed pwsh for its profile path, and prompt_shell_integration ran that scan before checking whether it could prompt. When it can't prompt (no TTY, --execute, or a previously declined offer), both outcomes of the scan print the same install hint.

The can't-prompt check now runs before the scan, so those calls spawn neither pwsh nor nu.

Verified with logging pwsh/nu shims on PATH and the -vv trace: a non-TTY wt switch b1 and wt switch -c x1 --format json spawned nu and pwsh on main and neither on this branch, and printed the same hint. Under script (a TTY), the switch still runs both probes and shows the install prompt. test_switch_hint_skips_shell_config_scan asserts through mock call logs that neither probe runs, and fails without the fix. It replaces test_switch_offer_after_powershell_query, which tested cancelling the scan's pwsh query in a non-TTY switch, a query that no longer happens there. That cancellation coverage moves to a PTY test, test_offer_stops_on_cancelled_powershell_query: on a terminal, SIGINT or SIGTERM in the query stops the switch with no offer, and an ordinary exit 130 still falls back to the offer.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 2 commits October 19, 2026 22:29
…rompt

Since #4422 (6b0f8e2), scanning shell configs asks the installed
`pwsh` for its profile path. `prompt_shell_integration` ran that scan
before checking whether it could prompt at all, so every `wt switch`
without an active shell wrapper spawned `pwsh` (about 150-200 ms) when
PowerShell is installed, including non-interactive calls such as
`wt switch -c x --format json` from agents. When it can't prompt
(no TTY, `--execute`, or a declined offer), both outcomes of the scan
print the same install hint.

The can't-prompt check now runs before the scan, so those calls spawn
neither `pwsh` nor `nu`. Interactive switches still scan and prompt.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 54b6de1 into main Oct 20, 2026
38 checks passed
@max-sixty
max-sixty deleted the fix/shell-hint-skip-pwsh-probe branch October 20, 2026 15:39
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