Standalone breakpoint tools fail after the first debug session ends
Summary
In standalone CLI mode, breakpoint tools fail after the first debug session ends because the session's initialized flag is not reset.
Reproduction
- Start a fresh
debugmcp 0.1.0MCP server with any DAP adapter (reproduced withdebugpy 1.8.22). - Call
add_breakpoint, thenstart_debugging; the breakpoint works. - Let the program exit or call
stop_debugging. - Call
add_breakpointbefore starting the next session.
Actual result:
Error adding breakpoint: Error: No active standalone debug session.
Expected: the breakpoint is stored and synchronized when the next session starts, as it is before the first session.
remove_breakpoint and clear_all_breakpoints are affected by the same state leak.
Root cause
startDebugging() sets initialized = true. The terminated/exited handlers and stopDebugging() clear the client and mark the state terminated, but do not reset initialized.
The next breakpoint change therefore calls syncBreakpoints(), which calls requireClient() after the client is gone.
Resetting initialized = false whenever a session terminates or its client is closed fixes the lifecycle mismatch.
@Movoid Thanks for the clear reproduction and root-cause analysis. This is fixed in PR #162, now merged into main: https://github.com/microsoft/DebugMCP/pull/162
The standalone executor now clears its initialization flag when a session terminates or its adapter is closed, including explicit stop, disposal, and failed startup/disconnect cleanup. Adding, removing, and clearing breakpoints between sessions no longer attempts to contact an inactive adapter. Saved breakpoint changes are synchronized when the next session starts; active-session synchronization is preserved.
The PR also bumps the standalone npm package to 0.1.2. This confirms the fix is merged; it does not confirm that the new npm version has been published.
GitHub automatically closed this issue when #162 merged. If the problem persists after installing a published version containing this fix, please open a new issue with the installed package/adapter versions and reproduction steps.