Skip to content

[BUG] js-debug sessions never surface the debuggee exit code (exitCode missing) #247

Description

@debugmcpdev

Bug

list_debug_sessions (and the session snapshot generally) never includes exitCode for JavaScript sessions. Python (debugpy) and the mock adapter surface it via the DAP exited event's exitCode (#220); js-debug launches leave it undefined even after the debuggee demonstrably exits non-zero.

Repro (verified on fix/242-js-launch-barrier-hang @ a8329d6, after #242 was fixed)

  1. create_debug_session (javascript)
  2. start_debugging tests/fixtures/debug-scripts/js-throws.js with dapLaunchArgs: { stopOnEntry: false } (no breakOnExceptions)
  3. Call returns promptly with state: 'stopped' ([BUG] start_debugging hangs past 60s for a fast-crashing JavaScript script #242 fixed), but list_debug_sessions shows no exitCode and no lastStop

Likely area

The debuggee runs in a js-debug child session; the child's exited event body (or the lack of one) doesn't reach SessionManagerCore.handleExited's exitCode capture the way the parent-session path does. Child events are re-emitted verbatim by MinimalDapClient/ChildSessionManager — worth checking whether js-debug even sends exitCode on the child exited event or whether it's dropped in forwarding.

Impact

An agent can't distinguish a crash (exit 1) from a clean exit (exit 0) for JavaScript — the exact contract #220 added for other adapters. This is why the #242 e2e regression guard (tests/e2e/mcp-server-break-on-exceptions.test.ts, js no-option test) asserts state/reason only, unlike its python twin which asserts exitCode non-zero. When this is fixed, strengthen that test to match.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions