Files
multica/server/migrations/125_agent_task_queue_dispatched_prepare_index.up.sql
Bohan Jiang 5038c983c0 MUL-3281: Add daemon skill bundle refs (#4445)
* feat: add daemon skill bundle refs

Co-authored-by: multica-agent <github@multica.ai>

* fix: tighten skill bundle resolve safeguards

Co-authored-by: multica-agent <github@multica.ai>

* feat: add task prepare lease

Co-authored-by: multica-agent <github@multica.ai>

* fix: isolate prepare lease concurrent index migration

Co-authored-by: multica-agent <github@multica.ai>

* fix: keep prepare lease active through start

Co-authored-by: multica-agent <github@multica.ai>

---------

Co-authored-by: J <j@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
2026-06-23 16:19:16 +08:00

9 lines
519 B
SQL

-- Covers reclaim scans over dispatched tasks while allowing prepare lease checks.
--
-- agent_task_queue is hot, so this must stay in its own single-statement
-- migration and must use CONCURRENTLY. Keeping CONCURRENTLY isolated avoids
-- Postgres' implicit transaction block for multi-statement query strings.
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_agent_task_queue_dispatched_prepare
ON agent_task_queue (runtime_id, priority DESC, dispatched_at ASC)
WHERE status = 'dispatched' AND started_at IS NULL;