Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Dec 30, 2025

Related GitHub Issue

Closes: #10391

Description

This PR attempts to address Issue #10391 by adding a navigator shim in the esbuild configuration to fix the PendingMigrationError that occurs on code-server with Node.js 22+.

The Problem:
In Node.js 22+, navigator is now a global object. Several bundled dependencies (debug, axios, pdf-parse) check typeof navigator !== "undefined" and then try to access properties like navigator.userAgent. VS Code's extension host intercepts these accesses and throws PendingMigrationError to help extensions migrate.

The Solution:
Added a JavaScript banner in the esbuild configuration that creates a safe navigator stub before any bundled code runs. The stub provides empty/default values for commonly accessed navigator properties:

  • userAgent, platform, appName, appVersion, product: empty strings
  • userLanguage: undefined
  • languages: empty array
  • hardwareConcurrency: 1
  • standalone: false
  • onLine: true

This shim is applied to both the extension and worker bundles via the shared buildOptions configuration.

Test Procedure

  1. The lint checks pass successfully
  2. JavaScript syntax validation passes with node --check src/esbuild.mjs
  3. Full testing requires code-server v4.105.0 on RHEL 9.6 environment (as described in the issue)
  4. Manual testing by the issue reporter would validate the fix

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Documentation Updates

  • No documentation updates are required.

Additional Notes

@roomote
Copy link
Contributor Author

roomote bot commented Dec 30, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete. All previously identified issues have been addressed.

  • The || logic on line 36 prevents the navigator stub from being applied in Node.js 22+ where navigator already exists
Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Dec 30, 2025
Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>
@hannesrudolph hannesrudolph moved this from Triage to PR [Draft / In Progress] in Roo Code Roadmap Jan 8, 2026
@hannesrudolph hannesrudolph added PR - Draft / In Progress and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: PR [Draft / In Progress]

Development

Successfully merging this pull request may close these issues.

[BUG] PendingMigrationError: navigator is now a global in nodejs on code-server (RHEL 9.6, Offline Environment)

3 participants