You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PowerShell Extension Terminal should reappear automatically if shown and "Restart Session" command is applied and background setting is enabled #5562
If the PowerShell setting powershell.integratedConsole.startInBackground is specified, when the PowerShell: Restart Session vscode command is called, the PowerShell extension session restarts but the terminal window does not reappear. It should reappear similarly to when the background setting is disabled, but only if the terminal was shown prior to Restart Session being called. If the terminal was not already shown, it should stay hidden.
Bug confirmed: terminal visibility not restored after Restart Session when startInBackground is enabled.
For maintainers
Reproducibility: High confidence — the report is precise and the code path confirms it. Steps: set powershell.integratedConsole.startInBackground: true, show the terminal, run PowerShell: Restart Session, observe terminal does not reappear.
Root cause: In src/process.ts around line 194, terminal visibility is restored on startup only when !startInBackground:
When restarting with startInBackground: true, this block is skipped entirely — there is no path that checks whether the terminal was visible before the restart and re-shows it. The fix would involve tracking terminal visibility state before restart (e.g., in SessionManager.restartSession) and passing that through so PowerShellProcess can call consoleTerminal.show() when appropriate.
Copilot-fix suitability:Yes — well-scoped, localized change with clear expected behavior. The fix is contained to src/process.ts and/or src/session.ts, requires no design decisions beyond what the issue already specifies, and the expected behavior is unambiguous (re-show only if terminal was visible before restart).
Likely area:src/process.ts (PowerShellProcess — terminal creation/show logic) and src/session.ts (SessionManager.restartSession — needs to capture visibility state before tearing down the old process).
Suggested approach:
Before stopping the old session in restartSession, check whether the integrated console terminal is currently visible (e.g., vscode.window.activeTerminal === consoleTerminal or track a wasVisible flag via onDidChangeActiveTerminal).
Pass that flag to the new PowerShellProcess start so it can call consoleTerminal.show() after startup regardless of startInBackground.
Activity
github-actions commentedon Jul 31, 2026
Bug confirmed: terminal visibility not restored after
Restart SessionwhenstartInBackgroundis enabled.For maintainers
Reproducibility: High confidence — the report is precise and the code path confirms it. Steps: set
powershell.integratedConsole.startInBackground: true, show the terminal, runPowerShell: Restart Session, observe terminal does not reappear.Root cause: In
src/process.tsaround line 194, terminal visibility is restored on startup only when!startInBackground:When restarting with
startInBackground: true, this block is skipped entirely — there is no path that checks whether the terminal was visible before the restart and re-shows it. The fix would involve tracking terminal visibility state before restart (e.g., inSessionManager.restartSession) and passing that through soPowerShellProcesscan callconsoleTerminal.show()when appropriate.Copilot-fix suitability: Yes — well-scoped, localized change with clear expected behavior. The fix is contained to
src/process.tsand/orsrc/session.ts, requires no design decisions beyond what the issue already specifies, and the expected behavior is unambiguous (re-show only if terminal was visible before restart).Likely area:
src/process.ts(PowerShellProcess— terminal creation/show logic) andsrc/session.ts(SessionManager.restartSession— needs to capture visibility state before tearing down the old process).Suggested approach:
restartSession, check whether the integrated console terminal is currently visible (e.g.,vscode.window.activeTerminal === consoleTerminalor track awasVisibleflag viaonDidChangeActiveTerminal).PowerShellProcessstart so it can callconsoleTerminal.show()after startup regardless ofstartInBackground.Add this agentic workflows to your repo
To install this agentic workflow, run