Issue #18508: Flaky test with input() and MAX_OUTPUTS in JupyterLab

Hi all,

I’m working on issue #18508 regarding the interaction between output limiting and input widgets in JupyterLab.
I’ve investigated the flaky test “Don’t limit cell outputs if input is requested” and found that the root cause seems to be a race condition: some Markdown outputs may not be fully rendered when input() is called. This occasionally causes fewer outputs to be counted than MAX_OUTPUTS.

To fix this, I plan to:

  • Update OutputArea logic to ensure input prompts always appear and displayed outputs never exceed MAX_OUTPUTS.
  • Adjust the test to verify only that the input prompt is visible, removing flakiness without changing user-facing behavior.

Would love to hear your feedback or suggestions on this approach before I prepare a PR.

Thanks,
Sakshi