microsoft / microsoft/vscode

Agents: Disconnecting tunnel leaves /agents stuck on "No Host" after reload

Open
#332,352 0 comments 0 reactions 1 assignee Claimed by @osortega View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Does this issue occur when all extensions are disabled?: Untested as it hits Agents UI

* VS Code Version: 1.134.0 (`110a328ea54b42367b803ec53ee0bf52ef26b419`); also reproduced on Insiders web build `0052619e71feb774a574b37f4f2ea20c36547373`
* OS Version: Linux remote host

Steps to Reproduce:

1. Start a dev tunnel and open `vscode.dev/agents` or `insiders.vscode.dev/agents`.
2. Connect to the remote Agent Host. The host is shown normally (for example, ``).
3. Click **Disconnect** using the host/remote control in the bottom-left.
4. Reload `/agents`.
5. Observe that the UI now shows **No Host**, even though the tunnel is still online.
6. The state persists across reloads.
7. Remove the affected tunnel ID from the persisted `tunnelAgentHost.autoConnectSuppressedTunnels` setting in `vscode-web-state-db-global`, then reload.
8. The host immediately connects normally again.

## Expected behavior

Disconnecting may reasonably suppress automatic reconnection, but the online tunnel should still be shown as an available host and there should be a visible/manual way to reconnect it.

Reloading `/agents` should not leave the UI stuck at **No Host** while the host is still online and discoverable.

## Actual behavior

After clicking **Disconnect**, the tunnel ID is persisted in:

`tunnelAgentHost.autoConnectSuppressedTunnels`

For example:

```text
[""]
```

After reloading, `/agents` displays **No Host** and does not attempt to connect.

The tunnel itself remains healthy.

While **No Host** is displayed, the Dev Tunnels API still returns the affected tunnel with an active host:

```json
{
"tunnelId": "",
"labels": [
"",
"protocolv6",
"vscode-server-launcher",
"_flag4"
],
"status": {
"hostConnectionCount": 1
}
}
```

The `/agents` console also confirms that the tunnel and active Agent Host were discovered:

```text
INFO [BrowserTunnelAgentHost] Found 1 tunnel(s) with agent host support

INFO [TunnelAgentHost] Silent status check (startup): totalFound=1, withActiveHost=1, cachedBefore=1, autoConnect=true
```

There is no subsequent connection attempt after tunnel enumeration.

The relevant code in the currently served Insiders bundle appears to skip `_connectTunnel()` when the tunnel is in the suppression list:

```js
if (
this._tunnelService.isAutoConnectSuppressed(v.tunnelId) ||
this._reconnectPauseReasons.has(b)
) continue;
```

This is consistent with the observed behavior:

```text
Tunnel is online and discovered

hostConnectionCount > 0

isAutoConnectSuppressed(tunnelId) === true

_connectTunnel() is skipped

UI remains "No Host"
```

Removing only the affected tunnel ID from `tunnelAgentHost.autoConnectSuppressedTunnels` and reloading makes the connection work immediately.

No tunnel restart, Agent Host restart, authentication change, or general browser-state reset is required.

The underlying dev tunnel remains connected throughout and is also directly reachable through `vscode.dev/tunnel/`.

Reproducibility: 100%.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.