Skip to content

fix(session): make session-tree launches, warnings, and child releases truthful - #1256

Open
debugmcpdev wants to merge 1 commit into
mainfrom
fix/session-tree-truth-and-turns
Open

debugmcpdev wants to merge 1 commit into
mainfrom
fix/session-tree-truth-and-turns

Conversation

@debugmcpdev

Copy link
Copy Markdown
Collaborator

Summary

Makes multi-process session-tree launches, warnings, child-release reporting, and Vite/Vitest frame locals truthful while cutting multi-process launch-to-breakpoint inspection from 5 turns down to 3 turns.

Closes #1150
Closes #1221
Closes #1252

Related self-hosted RCA follow-ups filed during this work: #1253, #1254.

Changes

1. Subprocess Turn Reduction & Launch-Hold Truthfulness (#1150 item 1)

  • Tree-aware launch hold (src/session/launch/launch-readiness.ts): waitForLaunchHold now observes onSubtreeChange and settles with a 50 ms sibling-adoption grace window as soon as a child session pauses or errors during the hold (while ignoring ended helper children per selectSettledInTree rule 4), rather than always burning the full 2,000 ms root hold.
  • Strictly-paused pausedChild (src/session/launch/debug-launcher.ts, src/server/handlers/shared.ts, src/server/handlers/debuggee-tools.ts): When the launched root is still running and a descendant is genuinely in SessionState.PAUSED, start_debugging / restart_debugging surfaces top-level pausedChild (sessionId, name, state: 'paused', reason, location, context, note, snapshot) and a truthful message (ErrorMessages.launchRunningWithPausedChild) instead of falsely claiming "has not reached N breakpoint(s) yet". data.pausedChild omits snapshot to avoid payload duplication. Children in ERROR receive ErrorMessages.launchRunningWithErroredChild and never populate pausedChild.

2. Tree-Wide Breakpoint Bind Tracking (#1150 items 2 & 3)

  • Run.treeVerifiedBreakpointIds (src/session/run-facts.ts, src/session/breakpoints/hit-verification.ts, src/session/breakpoints/breakpoint-controller.ts, src/session/breakpoints/launch-warnings.ts): Records every logical breakpoint ID verified on the root or any adopted descendant during the run.
  • Suppresses false "could not bind at launch" warnings when a child-only file breakpoint binds on an adopted child during the launch hold (#1150 item 3), and marks unhit breakpoints that bound on a short-lived child verified: true in the root's end summary even after the child exits (#1150 item 2).

3. Explicit Child-Debugging Opt-Out Qualification (#1150 item 4)

  • detectChildDebuggingOptOut (src/session/launch/proxy-launcher.ts): Detects explicit Python (subProcess: false, subProcessConfig: false) and JavaScript (autoAttachChildProcesses: false) opt-outs and qualifies both unbound-at-launch warnings and zero-hit run-to-completion summaries so agents are never misled that child processes ran past breakpoints when child debugging was disabled.

4. Confirmed Child Release Outcomes & Ancestor Propagation (#1150 item 5 & #1221)

  • ChildConnections.releaseWithConfirmation (src/proxy/child-connections.ts, src/proxy/dap-proxy-worker.ts): Tracks in-flight child releases (inFlightReleases) and per-target outcomes (confirmed | unconfirmed | closed) across both reject-request (debugpy) and throwaway-attach (js-debug).
  • Lineage propagation & settle wait (src/session/session-manager-core.ts, src/session/execution/tree-settle.ts, src/session/execution/execution-controller.ts): Propagates confirmed and unconfirmed releases up the full ancestor chain (recordChildReleaseOnLineage) so grandchild releases under the session cap surface on the root's childrenReleased and note (#1150 item 5). Launch and wait_for_stop await settleInFlightChildReleases (bounded to 1,500 ms) and explicitly disclose any failed/timed-out release instead of claiming a stuck child "ran on undebugged" (#1221).

5. Vite SSR / Vitest Outer Block Scope Filtering (#1252)

  • JsDebugAdapterPolicy.extractLocalVariables (packages/shared/src/interfaces/adapter-policy-js.ts): V8 lists inner lexical Block scopes ahead of Local and enclosing outer lexical Block scopes (such as Vite SSR's module wrapper) after Local. Primary local collection now merges only Block scopes listed ahead of the first Local scope when Local is present, keeping outer Block scopes in the empty-Local fallback alongside Closure.

Verification

  • Dev-Loop Gate & CI PR checks (local):
    • pnpm run lint — 0 errors
    • pnpm run typecheck:all — 0 source errors, 0 test errors (baseline 0 across 0)
    • pnpm run check:all-personal-paths — 1,598 files checked, 0 findings
    • pnpm run check:docs — 199 markdown files checked, 0 inconsistencies
    • pnpm run changelog:check — valid fragments (1150, 1221, 1252)
    • npm run clean && npm run build — clean build succeeded
    • npm run test:unit — 440/440 files passed (9,709 tests)
    • npm run test:integration — 47/48 files passed (250 tests, 1 skipped), including new regression cases in python-subprocess-tree.test.ts and javascript-subprocess-tree.test.ts
  • Live self-hosted mcp-debugger verification:
    • Verified 3-turn Python subprocess tree debugging (create_debug_session -> set_breakpoint on child.py:12 -> start_debugging on parent.py): start_debugging returned pausedChild with sessionId, location, context, and snapshot.locals ({ i: "0", total: "0" }) directly on the launch response.
    • Verified self-hosted vitest --pool=forks debugging of src/session/launch/debug-launcher.ts: stop snapshot inside the forked Vitest worker returned DebugLauncher.launch's actual parameters and locals (sessionId, session, launchGate, scriptPath) with zero Vite outer Block module-level noise.

@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.44444% with 16 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/proxy/child-connections.ts 87.71% 7 Missing ⚠️
src/session/launch/launch-readiness.ts 92.45% 4 Missing ⚠️
src/session/breakpoints/launch-warnings.ts 85.00% 3 Missing ⚠️
src/session/session-manager-core.ts 95.91% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

…s truthful

Closes #1150, #1221, and #1252.

- Surface pausedChild (with location, context, and StopSnapshot) and a truthful message on start_debugging and restart_debugging when an adopted child pauses during the launch hold, saving a wait_for_stop turn.
- Track treeVerifiedBreakpointIds and childDebuggingOptedOut on the shared Run record, and propagate child releases up ancestor lineages.
- Confirm fallback child releases across ChildConnections and DapProxyWorker before counting childrenReleased or claiming undebugged execution.
- Keep outer lexical Block scopes listed after Local out of primary JavaScript local merges under Vite/Vitest.
@debugmcpdev
debugmcpdev force-pushed the fix/session-tree-truth-and-turns branch from 2f5bdfd to 55f51ad Compare November 24, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment