Skip to content

refactor(proxy): drop the in-session manager's own throwaway release — unreachable since #1094 — and refuse a second pending target by name (#1082) - #1102

Open
debugmcpdev wants to merge 2 commits into
mainfrom
chore/501-release-cleanup
Open

debugmcpdev wants to merge 2 commits into
mainfrom
chore/501-release-cleanup

Conversation

@debugmcpdev

Copy link
Copy Markdown
Collaborator

What

Removes ChildSessionManager's own "cannot adopt → release undebugged" branch — #501's original lever — and the bookkeeping that existed only for it: releasedTargets, releaseUndebugged, waitForReadySignal, the 'released'/'release-failed' outcomes, and MinimalDapClient's rollback on those outcomes (−426/+73 over 6 files). Pure refactor: no reachable path changes behaviour.

Why it is unreachable

Since #1094 every js-debug startDebugging report after the program's own is relayed as a child report before it can reach ChildSessionManager.createChildSession:

  • on the root connection, adapter-policy-js.ts handleReverseRequest returns childReport for every report once context.adoptedTargets.size > 0 (the id is added before the first adoption runs);
  • on every other connection, createChildSafePolicy returns childReport for every report.

The worker's holder then adopts or releases the report (throwaway-release.ts). createChildSession is called from minimal-dap.ts only (two sites), and only for the program's own first target. The manager's second copy of the release therefore had no caller left.

What replaces it

An invariant: a second pending target reaching the manager while a child is active or being adopted is a routing bug, so the manager logs it and throws by name instead of acking it with nothing attached — the ack-with-nothing is exactly what parks the process forever (#501). MinimalDapClient's existing catch rolls the id back.

Tests

Gates run locally: the two unit files (178/178), npm run lint, npm run typecheck:all, and the JS tree/attach/cascade/launch-config integration suites (32/32) against build:ci; the pre-push hook ran the full unit and integration projects on push.

No changelog fragment: pure refactor (no-changelog).

Refs #1082, #1094, #501.

🤖 Generated with Claude Code

…— unreachable since #1094 — and refuse a second pending target by name (#1082)

Since #1094 every js-debug report after the program's own is relayed as a
child report before it can reach ChildSessionManager.createChildSession:
the js policy does it on the root connection once a target is adopted
(adapter-policy-js.ts, `context.adoptedTargets.size > 0`), and
createChildSafePolicy does it on every other connection. The worker's
holder adopts or releases the report (throwaway-release.ts). The
manager's "cannot adopt, release undebugged" branch — #501's original
lever, its `releasedTargets`, `releaseUndebugged`, `waitForReadySignal`
and the 'released'/'release-failed' outcomes — therefore had no caller
left: 110 lines of a second copy of the release.

Removed, with its #501 unit cases (five in the manager suite, two in the
client suite that pinned the client's bookkeeping on those outcomes).
In its place the gate is an invariant: a second pending target reaching
the manager while a child is active or being adopted is a routing bug,
so the manager logs it and throws by name instead of acking it with
nothing attached (which would park the process forever, the #501
failure) — MinimalDapClient's existing catch rolls the id back. Two
cases pin that, and the #518 trace case keeps its adoption half. The
#1082 relay cases assert that no connection is opened for a fork.

No behaviour change for any reachable path; the spike notes now point
at throwaway-release.ts for the lever.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015BDrn6AsHQ4rmTXFHzQkn8
@debugmcpdev debugmcpdev added the no-changelog PR needs no CHANGELOG fragment (refactor, CI-internal, or otherwise not user-visible) label Nov 7, 2026
@codecov

codecov Bot commented Nov 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/proxy/minimal-dap.ts 50.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog PR needs no CHANGELOG fragment (refactor, CI-internal, or otherwise not user-visible)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants