Skip to content

debugger: await initialization after run and restart#63607

Open
trivikr wants to merge 2 commits into
nodejs:mainfrom
trivikr:test-debugger-run-after-quit-restart
Open

debugger: await initialization after run and restart#63607
trivikr wants to merge 2 commits into
nodejs:mainfrom
trivikr:test-debugger-run-after-quit-restart

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented May 28, 2026

Fix a debugger CLI synchronization race after run and restart.

Previously, these commands resolved once the inspector websocket connection
was established and ok was printed. The debugger initialization that enables
domains, restores breakpoints, and calls Runtime.runIfWaitingForDebugger()
was started from the ready event but not awaited.

That allowed the REPL prompt to be displayed before the restarted debuggee had
actually been released from --inspect-brk and reported the initial break. In
slow CI runs, this could make parallel/test-debugger-run-after-quit-restart
time out while waiting for the initial break message.

This changes run and restart to await the same post-connect initialization
path before resolving.

Observed in:
https://github.com/nodejs/node/actions/runs/26499357103/job/78035468302

Refs: #61762


Assisted-by: openai:gpt-5.5

Ensure the debugger CLI waits for post-connect initialization before
resolving the run and restart commands. This prevents tests and users
from observing a prompt before Runtime.runIfWaitingForDebugger() has
released the new debuggee.

Refs: nodejs#61762

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
@nodejs-github-bot nodejs-github-bot added debugger Issues and PRs related to the debugger subsystem. needs-ci PRs that need a full CI run. labels May 28, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.32%. Comparing base (4639dcb) to head (30e43c1).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #63607      +/-   ##
==========================================
+ Coverage   90.29%   90.32%   +0.02%     
==========================================
  Files         730      730              
  Lines      234695   234709      +14     
  Branches    43956    43963       +7     
==========================================
+ Hits       211927   211993      +66     
+ Misses      14494    14434      -60     
- Partials     8274     8282       +8     
Files with missing lines Coverage Δ
lib/internal/debugger/inspect_repl.js 91.78% <100.00%> (+0.01%) ⬆️

... and 53 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

debugger Issues and PRs related to the debugger subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants