Skip to content

Agents Window shows terminal launch error when switching between remote Agent Host sessions #333079

Description

🤖 AI Assisted bug report

Description

Switching between remote Agent Host sessions in the Agents Window repeatedly shows an error notification:

The terminal process failed to launch: Connection disposed: tunnel:.

The selected chat session otherwise loads and remains usable.

Steps to Reproduce

  1. Connect to multiple remote Agent Host sessions through tunnels.
  2. Open a session containing historical terminal tool calls.
  3. Switch between remote sessions.
  4. Observe the terminal launch error notification.

Expected Behavior

Historical hidden terminal attachments should be restored or quietly discarded when their previous connection has been disposed. No error should be shown if the active chat session reconnects successfully.

Actual Behavior

Opening a session creates a hidden Agent Host Terminal. Its startup immediately fails against a disposed tunnel connection, producing a generic terminal launch notification.

Relevant redacted log sequence:

terminalInstance#ctor (...) [{"name":"Agent Host Terminal", ...}]
Terminal process exit [...]
terminalInstance#dispose (...)
[AgentHostPty] Failed to dispose host terminal:
Connection disposed: tunnel:<redacted>

This repeats when switching sessions, with different tunnel identifiers.

Additional Context

This may involve restoration of PTY-backed historical tool output using a stale IAgentConnection.

Possibly related:

The complete logs contain authentication and personal information, so they are not attached. Additional sanitized excerpts can be provided if needed.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions