Skip to content

PowerShell Extension Terminal should reappear automatically if shown and "Restart Session" command is applied and background setting is enabled #5562

Open

Description

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.

Activity

  1. github-actions commented on Jul 31, 2026

    @github-actions
    Contributor

    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:

    if (showOnStartup && !startInBackground) {
        this.consoleTerminal.show(true);
    }

    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:

    1. 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).
    2. Pass that flag to the new PowerShellProcess start so it can call consoleTerminal.show() after startup regardless of startInBackground.

    Generated by Agentic Issue Triage for issue #5562 · 77.9 AIC · ⌖ 11.8 AIC · ⊞ 24.2K · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@2f03fdaafb8c1ae62dfde7e0be762a822a201aeb
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions