Skip to content

Fix #345695: Browser remote indicator loses the host name after disconnecting (Dev Tunnels and WSL) - #345800

Open
Saurabh Sungh (genius-0963) wants to merge 2 commits into
microsoft:mainfrom
genius-0963:fix-issue-345695
Open

Saurabh Sungh (genius-0963) wants to merge 2 commits into
microsoft:mainfrom
genius-0963:fix-issue-345695

Conversation

@genius-0963

Copy link
Copy Markdown
Contributor

Fixes #345695

Description of Changes

When a remote agent host (such as Dev Tunnels or WSL) is disconnected (e.g., via "Agents: Manage Remote Environments"), IAgentHostConnectionsService.connections no longer contains the host connection entry. Previously, SessionBrowserNetworkContribution._getNetworkStatus fell back directly to network.authority as the label when resolving the network status. As a result, the integrated browser's remote indicator tooltip and accessible label displayed the internal authority identifier (e.g. tunnel__sneaky-ant-krdllm7 is disconnected... or hex-77736c3a5562756e74752d32342e3034 is disconnected...) instead of the friendly host name.

This change:

  1. Retains discovered/connected friendly host labels in a map within SessionBrowserNetworkContribution so that disconnecting a host preserves the human-readable display name in the browser remote indicator tooltip and accessible label.
  2. Checks session providers in ISessionsProvidersService to resolve host names for known remote hosts even when not actively connected.
  3. Records host labels when resolving session networks for active/agent sessions.
  4. Adds unit tests verifying that disconnecting an active host retains the friendly name and that offline hosts resolve their names from registered session providers.

Verification Steps

  1. Run unit tests covering SessionBrowserNetworkContribution:
    node test/unit/browser/index.js --browser chromium --grep "SessionBrowserNetworkContribution"
  2. Manual verification:
    • Connect to a named remote agent host (Dev Tunnel or WSL) and open a localhost app in the integrated browser.
    • Hover the remote indicator to verify it shows "Connected via <friendly_name>".
    • Disconnect the host via "Agents: Manage Remote Environments".
    • Hover the remote indicator again and inspect the tooltip / screen reader accessible label: verify it displays "<friendly_name> is disconnected. Reload the page after it reconnects." instead of the raw authority (such as tunnel__... or hex-...).

Copilot AI balanced review requested due to automatic review settings November 3, 2026 11:19
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Kyle Cutler (@kycutler)

Matched files:

  • src/vs/sessions/contrib/browserView/browser/sessionBrowserNetwork.ts
  • src/vs/sessions/contrib/browserView/test/browser/sessionBrowserNetwork.test.ts

Joaquín Ruales (@jruales)

Matched files:

  • src/vs/sessions/contrib/browserView/browser/sessionBrowserNetwork.ts
  • src/vs/sessions/contrib/browserView/test/browser/sessionBrowserNetwork.test.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The unimported Event causes a TypeScript compilation error, provider changes can leave labels stale, and the regression test does not exercise connection removal.

3 open issues
What changed in this PR

Addresses #345695 by preserving friendly remote host names in the Agents Window’s integrated browser indicator after Dev Tunnel or WSL hosts disconnect.

Changes:

  • Caches host labels from connections and session resolution.
  • Adds provider-based name lookup for offline hosts and observes provider changes.
  • Adds tests for label retention after disconnect and offline provider lookup.
File Description
src/​vs/​sessions/​contrib/​browserView/​test/​browser/​sessionBrowserNetwork.test.ts Updates provider stubs and adds disconnected-host label tests.
src/​vs/​sessions/​contrib/​browserView/​browser/​sessionBrowserNetwork.ts Retains friendly labels and resolves offline host names through session providers.

Review effort: Balanced

@genius-0963

Copy link
Copy Markdown
Contributor Author

Kyle Cutler (@kycutler) review, sir

This branch has not been deployed

No deployments
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.

Browser remote indicator loses the host name after disconnecting (Dev Tunnels and WSL)

3 participants