Agents Web: Active Agent Host omitted when Dev Tunnels account contains more than five tunnels
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
Does this issue occur when all extensions are disabled?: Not applicable. This involves the built-in Agents web UI, VS Code CLI, and Microsoft Dev Tunnels service.
## Environment
- VS Code Insiders CLI: `1.137.0-insider`
- Commit: `b6234bd71943c8a5caf5eef03bc4a8e49aef2698`
- Architecture: `x64`
- Host OS: Bluefin 42 / Fedora Silverblue
- Host kernel: `6.17.4-200.fc42.x86_64`
- Web client: `https://insiders.vscode.dev/agents`
- Agent Host name: `hawks-desktop`
- Active tunnel ID during diagnosis: `jolly-horse-93hm33s.use`
- Active Agent Host protocol label: `protocolv6`
## Summary
An active and healthy Agent Host was omitted by the Agents web app when the associated Dev Tunnels account contained six VS Code launcher tunnels.
Five tunnel records were stale and had zero host connections. The sixth tunnel, `jolly-horse-93hm33s.use` (`hawks-desktop`), had an active host connection and the expected Agent Host labels and port. Despite that, `insiders.vscode.dev/agents` showed `hawks-desktop` as offline or omitted it, while repeatedly attempting WebSocket connections to the stale tunnels.
After permanently deleting the five stale Dev Tunnel records, `hawks-desktop` appeared online and connected immediately on the next page reload. No change to the Agent Host process or systemd service was required.
This suggests that the Agents web discovery path may only be consuming the first page/subset of tunnel records (five in this case), without pagination or without prioritizing tunnels that have active host connections.
## Steps to reproduce
1. Use a GitHub account that owns at least six VS Code Dev Tunnel records.
2. Leave five of those tunnels offline, with `hostConnections: 0`.
3. Start an Agent Host tunnel for the sixth record:
```bash
code-insiders agent host \
--tunnel \
--name hawks-desktop \
--new-instance \
--foreground
```
4. Confirm that the CLI reports the Agent Host as ready:
```text
Visual Studio Code Agent Host v1.137.0 ready
Tunnel: https://insiders.vscode.dev/agents/tunnel/hawks-desktop
Server ready
```
5. Confirm the active tunnel through the Microsoft `devtunnel` CLI:
```bash
devtunnel show jolly-horse-93hm33s.use --json
```
Relevant fields:
```json
{
"tunnelId": "jolly-horse-93hm33s.use",
"labels": [
"hawks-desktop",
"protocolv6",
"vscode-server-launcher",
"_flag4"
],
"hostConnections": 1,
"clientConnections": 1,
"ports": [
{
"portNumber": 31546,
"protocol": "auto"
}
]
}
```
6. Open `https://insiders.vscode.dev/agents` using the same GitHub account.
7. Observe that the active `hawks-desktop` tunnel is offline or not discovered.
8. In browser DevTools, inspect Network activity. WebSocket requests repeatedly target the stale tunnel IDs, but no request is made for `jolly-horse-93hm33s`.
9. Permanently delete the five stale tunnel records from the Dev Tunnels account.
10. Reload `https://insiders.vscode.dev/agents`.
11. Observe that `hawks-desktop` now appears online and connects successfully.
## Tunnel inventory before cleanup
```text
tidy-book-gjd6pdm.use hostConnections=0
joyful-book-ttm4tpm.use hostConnections=0
silent-fog-77z5jtp.use hostConnections=0
new-shoe-gb936cf.usw2 hostConnections=0
fancy-chair-2mnk5zm.usw2 hostConnections=0
jolly-horse-93hm33s.use hostConnections=1 labels=[hawks-desktop, protocolv6, vscode-server-launcher, _flag4]
```
The web client attempted connections to the stale records, including `new-shoe-gb936cf`, but did not attempt a connection to the active `jolly-horse-93hm33s` record.
## Expected behavior
The Agents web app should enumerate all eligible Agent Host tunnels, following pagination if the Dev Tunnels API paginates results.
At minimum, a tunnel with:
- `hostConnections: 1`
- a supported `protocolvN` label
- the `vscode-server-launcher` label
- the Agent Host port (`31546`)
should be shown as online and should not be omitted in favor of stale tunnels with zero host connections.
## Actual behavior
The web app displayed or attempted connections to the five stale tunnel records while omitting the sixth, active tunnel.
Clearing browser site data, using a private browsing window, re-authenticating the VS Code tunnel CLI, restarting the Agent Host, and recreating the active `hawks-desktop` tunnel did not resolve the problem while all six tunnel records existed.
The issue reproduced with both:
```bash
code-insiders agent host --tunnel --name hawks-desktop
```
and the conventional:
```bash
code-insiders tunnel --name hawks-desktop
```
Deleting the five stale account-side tunnel records resolved the problem immediately.
## Additional observations
- The desktop VS Code Insiders app could show `hawks-desktop` as online through same-machine/local Agent Host discovery, while the web app still showed it as offline.
- The host process remained healthy throughout, with a live relay socket and no restarts.
- The tunnel had the same protocol version as the served Agents web build.
- The Dev Tunnels account and the Agents web app were authenticated with the same GitHub account.
## Related but distinct issue
This is separate from #332352, where disconnecting a tunnel persists its ID in `tunnelAgentHost.autoConnectSuppressedTunnels` and leaves the Agents UI stuck at "No Host."
That suppression issue was also encountered while diagnosing this problem, but it does not explain the original failure:
- The active tunnel was omitted in a private browsing profile.
- Clearing site data did not make the active sixth tunnel connect.
- The active tunnel appeared immediately only after the five stale account-side records were permanently deleted.
## Suspected area
Please treat this as a hypothesis rather than a confirmed implementation detail: the behavior is consistent with a tunnel-list query or intermediary API returning a maximum of five entries and the Agents web discovery path not following pagination.
It may also be worth ensuring that active tunnels (`hostConnectionCount > 0`) are prioritized over offline records if the upstream service intentionally limits the result count.
Contributor guide
Research direction
Start with the Agents web discovery flow and inspect its network requests while an account has more than five Dev Tunnels. Compare the tunnel-list response and connection attempts for stale versus active records, then verify that all eligible Agent Host tunnels are discovered and the active host appears online without deleting other records.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- developer-experience, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100