From 74c4553a3f04c3cae17cf09298d2846ed1c641b3 Mon Sep 17 00:00:00 2001 From: Colin Adler Date: Wed, 26 Jul 2023 22:44:44 -0500 Subject: [PATCH] fix(codersdk): always dial agents with `WorkspaceAgentIP` (#8760) --- codersdk/workspaceagents.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/codersdk/workspaceagents.go b/codersdk/workspaceagents.go index 994f32026b..b250f3a98e 100644 --- a/codersdk/workspaceagents.go +++ b/codersdk/workspaceagents.go @@ -397,6 +397,11 @@ func (c *Client) DialWorkspaceAgent(ctx context.Context, agentID uuid.UUID, opti agentConn = NewWorkspaceAgentConn(conn, WorkspaceAgentConnOptions{ AgentID: agentID, + // Newer agents will listen on two IPs: WorkspaceAgentIP and an IP + // derived from the agents UUID. We need to use the legacy + // WorkspaceAgentIP here since we don't know if the agent is listening + // on the new IP. + AgentIP: WorkspaceAgentIP, CloseFunc: func() error { cancel() <-closedCoordinator