Repository navigation
fix(shell): skip the shell config scan when the install offer can't prompt - #4522
Merged
Merged
Conversation
…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]>
worktrunk-bot
approved these changes
Oct 20, 2026
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.
Since v0.80.0, every
wt switchwithout an active shell wrapper spawnspwshwhen PowerShell is installed, adding about 150-200 ms per call. That includes non-interactive calls such aswt switch -c x --format jsonfrom agents. #4422 made the shell config scan ask the installedpwshfor its profile path, andprompt_shell_integrationran 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
pwshnornu.Verified with logging
pwsh/nushims on PATH and the-vvtrace: a non-TTYwt switch b1andwt switch -c x1 --format jsonspawnednuandpwshon main and neither on this branch, and printed the same hint. Underscript(a TTY), the switch still runs both probes and shows the install prompt.test_switch_hint_skips_shell_config_scanasserts through mock call logs that neither probe runs, and fails without the fix. It replacestest_switch_offer_after_powershell_query, which tested cancelling the scan'spwshquery 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.