fix: avoid re-using AuthInstanceID for sub agents (#22196)

Parent agents were re-using AuthInstanceID when spawning child agents.
This caused GetWorkspaceAgentByInstanceID to return the most recently
created sub agent instead of the parent when the parent tried to refetch
its own manifest.

Fix by not reusing AuthInstanceID for sub agents, and updating
GetWorkspaceAgentByInstanceID to filter them out entirely.
This commit is contained in:
Danielle Maywood
2026-02-19 16:56:29 +00:00
committed by GitHub
parent 0f6fbe7736
commit 911d734df9
7 changed files with 150 additions and 2 deletions
@@ -17,6 +17,8 @@ WHERE
auth_instance_id = @auth_instance_id :: TEXT
-- Filter out deleted sub agents.
AND deleted = FALSE
-- Filter out sub agents, they do not authenticate with auth_instance_id.
AND parent_id IS NULL
ORDER BY
created_at DESC;