Skip to content

Retry the agent host IPC connect on a slow-boot channel-registration timeout - #328862

Open
vijayupadya wants to merge 2 commits into
mainfrom
vijayu/agenthost-ipc-channel-timeout
Open

Retry the agent host IPC connect on a slow-boot channel-registration timeout#328862
vijayupadya wants to merge 2 commits into
mainfrom
vijayu/agenthost-ipc-channel-timeout

Conversation

@vijayupadya

Copy link
Copy Markdown
Contributor

Summary

The local agent host is reached from each window over a MessagePort IPC channel named agentHostProtocol. On a slow host boot the process registers that channel only after the IPC ChannelServer's 1s unknown-channel timeout, so the renderer's connect() call is rejected with a transient "Channel name 'agentHostProtocol' timed out after 1000ms". The local transport has no reconnect, so it treats this as fatal and closes permanently — the connection's rootState never hydrates, no agents are advertised, and the agent host option goes missing from the session-target picker.

This change retries that one transient condition instead of giving up.

Fix

AgentHostIpcChannelTransport.connect() now retries the upstream connect while the agent host is still registering its channel:

  • Retries only the transient 'Unknown channel' timeout; any other error is surfaced unchanged.
  • Bounded backoff (250ms → 2s cap, ~20s total budget); on exhaustion it throws exactly as before, so a genuinely-broken host still surfaces an error.
  • The backoff is cancelled on dispose() (via a CancellationTokenSource), matching the file's convention that every delay timer is cancelled on teardown.
  • Frame/close listeners are subscribed once — the IPC ChannelServer buffers event-listens to a not-yet-registered channel and flushes them on registration, so no double-subscription across retries.

Tests

agentHostIpcChannelTransport.test.ts:

  • retries a transient 'Unknown channel' timeout until the host registers its channel (and subscribes listeners exactly once),
  • does not retry a non-transient connect error,
  • gives up once the retry budget is exhausted,
  • stops retrying once the transport is disposed.

Copilot AI review requested due to automatic review settings August 3, 2026 22:08

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.

Pull request overview

Adds bounded retry handling for transient agent-host IPC channel registration timeouts.

Changes:

  • Adds cancellable exponential-backoff connection retries.
  • Adds tests for success, failure, exhaustion, disposal, and listener counts.
Show a summary per file
File Description
agentHostIpcChannelTransport.ts Implements retry and cancellation logic.
agentHostIpcChannelTransport.test.ts Tests retry behavior and teardown.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread src/vs/platform/agentHost/browser/agentHostIpcChannelTransport.ts
@vijayupadya
vijayupadya requested a review from connor4312 August 3, 2026 22:29
@vijayupadya
vijayupadya marked this pull request as ready for review August 3, 2026 23:08
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.

2 participants