fix: avoid re-using `AuthInstanceID` for sub agents by DanielleMaywood · Pull Request #22196 · coder/coder
When creating child agents, we re-used `AuthInstanceID`. Unfortunately this causes an issue when the parent agents disconnect. Our `GetWorkspaceAgentByInstanceID` query is defined as follows: ```sql -- name: GetWorkspaceAgentByInstanceID :one SELECT * FROM workspace_agents WHERE auth_instance_id = @auth_instance_id :: TEXT -- Filter out deleted sub agents. AND deleted = FALSE ORDER BY created_at DESC; ``` When the parent agent attempts to refetch its manifest via its `auth_instance_id`, it will fetch the _last created agent with this instance ID_. This will be the last created sub agent, meaning the parent will fetch the manifest for a child, instead of itself.
DanielleMaywood
changed the title
fix(coderd/agentapi): do not re-use
fix: do not re-use AuthInstanceIDAuthInstanceID
DanielleMaywood
changed the title
fix: do not re-use
fix: do not re-use AuthInstanceIDAuthInstanceID for sub agents
DanielleMaywood
changed the title
fix: do not re-use
fix: avoid re-using AuthInstanceID for sub agentsAuthInstanceID for sub agents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters