fix: eliminate visible console windows on Windows debug sessions (#215) - #219
Merged
Conversation
Three-part fix for console windows flashing/persisting on Windows:
1. windowsHide sweep: add windowsHide:true to ~30 probe/detection spawn
sites across all adapter packages and shared policies, defaulted
centrally in ProcessManagerImpl.spawn and the proxy processSpawner
binding. jdi-resolver's shell-based execSync('where javac') converted
to execFileSync so the flag can apply.
2. Honor user-supplied console mode: transformLaunchConfig previously
hard-coded console:'internalConsole', silently overriding
dapLaunchArgs.console (why the reporter saw identical behavior for
every value they tried).
3. Run the debugpy adapter under pythonw.exe when a sibling exists
(win32): the adapter is spawned detached (no console), so debugpy's
console-subsystem launcher grandchild got a fresh *visible* console
allocated by Windows — unreachable by any Node-side windowsHide. The
GUI-subsystem interpreter cascades to launcher and debuggee (launch
config pins no python), so no process in the chain gets a console.
Measured on Windows 11 with an EnumWindows/IsWindowVisible watcher
(positive+negative controls validated), full debug session each run:
published 0.22.0 = 1 visible console window per session; with this fix
= 0. Breakpoints, stack traces, and stepping verified working.
Fixes #215
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Fixes #215 — console windows appearing on screen for every Python debug session on Windows.
The three findings (building on the reporter's excellent follow-up analysis)
detached(no console at all), so its console-subsystem launcher grandchild gets a fresh visible console allocated by Windows — beyond the reach of any Node-sidewindowsHide, exactly as the reporter's process tree showed.consolewas being silently overridden.transformLaunchConfighard-codedconsole: 'internalConsole', which is why everyconsolevalue the reporter tried behaved identically.windowsHideacross the adapter packages (the original report undercounted at 4; the follow-up's "closer to a dozen" was also low).The fix
pythonw.exewhen a sibling of the resolved interpreter exists (win32 only). Same directory ⇒ same interpreter, version, site-packages, venv. Since the launch config pins nopython, the launcher and debuggee inherit it — no process in the chain ever gets a console. This is the reporter's verified workaround, promoted to the default.console(config.console ?? 'internalConsole').windowsHidesweep: all probe/detection sites in adapter-python/-ruby/-rust/-go/-java/-dotnet and the shared policies, plus central defaults inProcessManagerImpl.spawnand the proxyprocessSpawnerbinding (callers can still opt out).jdi-resolver's shell-basedexecSync('where javac')becameexecFileSyncso the flag can apply.Measurement (Windows 11, reporter's methodology)
EnumWindows+IsWindowVisiblewatcher filtered toConsoleWindowClass/CASCADIA_HOSTING_WINDOW_CLASS, 15 ms sampling, new-HWND-only; validated with a deliberately visible console (counts 1) and awindowsHidespawn (counts 0). One full debug session per run (create_debug_session→set_breakpoint→start_debugging→get_stack_trace→continue_execution→close_debug_session):Breakpoints, stack traces, and continue verified working under the
pythonwchain; full unit suite (2496) and python adapter tests pass.The reporter's remaining side-finding — debuggee stdout never reaching the MCP client — is now tracked in #218.
🤖 Generated with Claude Code