Skip to content

fix(cli-repl): account for Node.js main branch REPL changes#2690

Open
addaleax wants to merge 1 commit intomainfrom
update-for-node-repl-als
Open

fix(cli-repl): account for Node.js main branch REPL changes#2690
addaleax wants to merge 1 commit intomainfrom
update-for-node-repl-als

Conversation

@addaleax
Copy link
Collaborator

@addaleax addaleax commented Mar 9, 2026

nodejs/node@a9da9ff recently introduced a number of changes to the Node.js REPL that break mongosh's e2e test suite. This is mostly our own fault, since we were previously monkey-patching the Node.js REPL in a way that wouldn't typically be considered supported.

This change updates these patches for the new change. It also adds a small custom inspect function for the REPL instance, since otherwise now even small objects like Node.js timers could result in hundreds of lines of output being printed when fully inspected.

nodejs/node@a9da9ff
recently introduced a number of changes to the Node.js REPL
that break mongosh's e2e test suite. This is mostly our own fault,
since we were previously monkey-patching the Node.js REPL
in a way that wouldn't typically be considered supported.

This change updates these patches for the new change.
It also adds a small custom inspect function for the REPL
instance, since otherwise now even small objects like
Node.js timers could result in hundreds of lines of output
being printed when fully inspected.
@addaleax addaleax requested a review from a team as a code owner March 9, 2026 13:52
Copilot AI review requested due to automatic review settings March 9, 2026 13:52
@addaleax addaleax added the no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion) label Mar 9, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates mongosh’s CLI REPL integration to accommodate recent upstream Node.js REPL internal changes that impacted mongosh e2e tests, and reduces excessive output caused by deep inspection of REPL-linked async state.

Changes:

  • Add a custom util.inspect.custom handler on the REPL server to prevent extremely verbose inspection output (e.g., from timers retaining async context).
  • Update the REPL eval monkey-patching to hook into Node’s newer _handleError path (in addition to existing domain-related handling).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/cli-repl/src/mongosh-repl.ts Adds a custom inspect function to keep REPL-related inspection output compact under the new Node REPL async context behavior.
packages/cli-repl/src/async-repl.ts Adjusts synchronous-error interception to patch repl._handleError for newer Node.js REPL internals.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants