Skip to content

advance console promptCount on any new prompt, not just top-level - #18061

Merged
kevinushey merged 1 commit into
mainfrom
bugfix/promptcount-interactive-prompts
Jun 25, 2026
Merged

kevinushey merged 1 commit into
mainfrom
bugfix/promptcount-interactive-prompts

Conversation

@kevinushey

Copy link
Copy Markdown
Collaborator

Summary

executeInConsole({wait:true}) (e2e helper) waits for window.rstudio.console.promptCount to increase. The bump was gated on !prompt.getBusy(), so it only advanced at the top-level > prompt. A command that parks at an interactive sub-prompt -- browser()/Browse[N]>, readline(), menu(), scan() -- never returns to the top level on its own, so the wait hung until the 30s timeout.

This broke the debugger e2e tests: they submit a breakpoint-triggering call (e.g. brace_fn()) that enters Browse mode, then assert debug state. The submission never reaches a top-level prompt, so waitForConsoleCommandComplete timed out. The failures surfaced in #18059's CI (6 debugger specs, both retries) but were not caused by that PR -- its merge just includes the promptCount change from #18048, and it is the first PR exercising the debugger specs against that code.

Fix

Bump the counter on every ConsolePromptEvent (drop the busy gate in ApplicationAutomation.registerConsole()).

This is safe, and the key reason the original busy gate was unnecessary: a single submission's intermediate continuation (+) and inter-statement prompts never reach the client. The server splits multi-line/multi-statement console input into per-line entries (fixupPendingConsoleInput) and services them directly from its buffer in rConsoleRead via popConsoleInput() without firing a kConsolePrompt event -- a client event fires only once the buffer drains and R genuinely stops to wait for new input. So a new prompt event is always a real "R is waiting for us again" point, never a mid-expression state.

Behavior delta:

  • One-shot expressions (e.g. the writeLines(...) case fix readr Import Dataset preview on Windows (escape generated R path) + console-wait reliability #18048 fixed): still fire exactly one event at completion -> identical behavior; the race stays fixed because it keys off a prompt event, not the sampled busy CSS class.
  • Commands that park at an interactive sub-prompt: now resolve at the settle point instead of hanging. waitForConsoleCommandComplete now means "R stopped to ask for input again," not strictly "returned to top level" -- which is exactly what the debugger tests want.

Verification

  • Mechanism traced from the reduce background file operations for projects on remote filesystems #18059 CI artifacts: the failing specs time out in waitForConsoleCommandComplete, and the trace shows the debug toolbar visible in afterEach (the breakpoint did fire / R entered Browse). Server-side busy = !isAtTopLevel(), so a Browse[N]> prompt carries busy == true and was excluded by the old gate.
  • No NEWS.md entry: the promptCount bridge is unreleased e2e-test infrastructure, not user-facing.
  • Not run locally: ant javac (trivial block-lambda -> expression-lambda over an existing method). CI will compile and re-run the debugger specs.

Addresses the debugger e2e failures reported in #18059.

executeInConsole({wait:true}) waits for window.rstudio.console.promptCount
to increase. The bump was gated on !prompt.getBusy(), so it only fired at
the top-level prompt. A command that parks at an interactive sub-prompt
(browser()/Browse[N]>, readline(), menu()) never returns to top level on
its own, so the wait hung until timeout -- this broke the debugger e2e
tests, whose commands hit a breakpoint and enter Browse mode.

Bump on every ConsolePromptEvent instead. This is safe: a single
submission's intermediate continuation (+) and inter-statement prompts are
serviced from the server's buffered, line-split console input
(SessionConsoleInput.cpp rConsoleRead -> popConsoleInput) without firing a
client kConsolePrompt event, so a new prompt event is always a genuine "R
is waiting for input again" point, never a mid-expression state. One-shot
expressions still fire exactly one event at completion (the #18048 race
stays fixed); interactive/debugger commands now resolve at their settle
point instead of hanging.
@kevinushey kevinushey added this to the 2026.07 (Pacific Dogwood) milestone Jun 25, 2026
@github-actions

Copy link
Copy Markdown

🍎 macOS Desktop E2E · ARM64

✅ All tests passed!

████████████████████ 100% pass rate

✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
402 0 18 0
📥 Download Playwright report

⬇️ playwright-report.zip — extract and open index.html

Includes screenshots, traces, and step-by-step details for every test. Expires in 15 days.


2 shards · macos-26 ARM64 · commit 47c0f964e746e3126af44d77318c82c83791d8c2 · Run #171

@kevinushey
kevinushey merged commit 86d94eb into main Jun 25, 2026
13 of 14 checks passed
@kevinushey
kevinushey deleted the bugfix/promptcount-interactive-prompts branch June 25, 2026 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant