mirror of
https://gh-proxy.org/https://github.com/klinsmaya/multica.git
synced 2026-11-08 09:26:50 +08:00
Comment owner routing loaded every task row on an issue, including context/result payloads, before selecting the current thread owners. Filter by issue and root comment in SQL and return one agent/squad pair per owner. Closes #8711
8 lines
412 B
SQL
8 lines
412 B
SQL
-- name: ListConversationRootOwners :many
|
|
-- Preserve the newest non-null squad per agent, including terminal tasks.
|
|
-- Routing does not need execution context, results, or other issue threads.
|
|
SELECT DISTINCT ON (agent_id) agent_id, squad_id
|
|
FROM agent_task_queue
|
|
WHERE issue_id = $1 AND trigger_comment_id = $2 AND agent_id IS NOT NULL
|
|
ORDER BY agent_id, (squad_id IS NOT NULL) DESC, created_at DESC, id DESC;
|