Repository navigation
fix(java): one stopped event per JDI event set - #1393
Merged
Merged
Conversation
A step that lands on a line with a breakpoint arrives from JDI as a StepEvent and a BreakpointEvent in one event set. The bridge sent a DAP stopped event for each, so one suspension became two stops in the core (measured: 49 of 300 step_over calls on a loop with one breakpoint line). The event loop now collects one stop per set and sends it after every event of the set has been handled. A stopping breakpoint takes precedence over a step, as debugpy and js-debug report that step; an exception takes precedence over both. Conditions, the one-shot step request, class-prepare handling and the resume decision are unchanged. Test: an integration case steps onto a breakpoint line and asserts one stopped event with reason breakpoint. It fails on the previous bridge with [step, breakpoint]. The change and the test were written by a GPT worker. The manager session verified the failing-first run and wrote the changelog entry. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015BDrn82vMcRzWFDD9aUbZs
Review finding on the previous commit. A step request suspends all threads; a line breakpoint with suspendPolicy "thread" suspends one. When a step lands on such a breakpoint JDI suspends by the set's most restrictive policy, so every thread is suspended, but the bridge took allThreadsStopped from the breakpoint request alone and reported false. The next continue then resumed that one thread and left every other thread suspended. With the order HotSpot delivers the two events this predates the previous commit. The one stopped event of a set, and lastStopAllThreads, now take the value from eventSet.suspendPolicy(). Tests: the integration file grows from one case to four. A second plain step (the step branch must stop by itself), a false-condition breakpoint together with a step (reason step), stepIn onto a function breakpoint (reason function breakpoint), and a two-thread program stepped onto a thread-policy breakpoint and continued to its end. The last fails on the previous commit. The test also retries the bridge's start when its reserved port is lost, keeps draining the bridge's pipes, and ends its two children independently. Found by a Gemini review with a mutation pass; written by the GPT worker that wrote the previous commit; verified by the manager session, which also extended the changelog entry. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015BDrn82vMcRzWFDD9aUbZs
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
debugmcpdev
marked this pull request as ready for review
November 29, 2026 22:47
debugmcpdev
pushed a commit
that referenced
this pull request
Nov 29, 2026
Brings in the two Java bridge fixes (#1387, #1393). No conflicts; no file of this change is touched by them. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015BDrn82vMcRzWFDD9aUbZs
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.
Closes #1383.
What changes
When a step lands on a line that has a breakpoint, JDI delivers the step's completion and the breakpoint hit as two events in one event set. The bridge sent a DAP
stoppedevent for each:step, thenbreakpointa millisecond later, for one suspension. Measured through the server: 49 of 300step_overcalls on a loop with one breakpoint line.allThreadsStopped, and the valuecontinuelater acts on, now come from the event set's own suspend policy. Before, a step onto a breakpoint withsuspendPolicy: "thread"reported that one thread had stopped while the JVM had suspended all of them, and the nextcontinueleft every other thread suspended. With the order HotSpot delivers the two events, that was already so before this change; the review found it.Tests
tests/adapters/java/integration/java-event-set-stop.test.ts, four cases against the real bridge and a real JVM:stopped, reasonbreakpoint; then onestopped, reasonstep[step, breakpoint]stopped, reasonstepstepInonto a function breakpointstopped, reasonfunction breakpointallThreadsStopped: true, and the program runs to its endfalse, and the program never ends)Review
A Gemini review with a mutation pass, two rounds. Round one found the
allThreadsStoppeddefect (major) and that the first version of the test could pass without the step branch stopping at all. Round two: nothing above a note. Nine mutants in all; seven are killed. Two cannot be produced with a real JVM and survive by construction: a breakpoint event delivered before the step event in a set, and an exception event sharing a set with a step.One pre-existing thing the reviewer noted and this change leaves alone: a
pausefor one named thread while every thread is already suspended records "not all threads stopped". The server does not send a pause while paused.Verified
Rebased on
mainafter the launch-port fix, headf70ff96e.Who wrote what
The change and its tests were written by a GPT worker, in two commits (the second answers the review). The manager session (Claude) verified each failing-first run and wrote the changelog entry and this description.
🤖 Generated with Claude Code
https://claude.ai/code/session_015BDrn82vMcRzWFDD9aUbZs