Skip to content

Conversation

@smoreinis
Copy link
Collaborator

@smoreinis smoreinis commented Feb 9, 2026

Summary

  • Fix message indexes to sort created_at descending, matching the typical newest-first query pattern
  • Remove redundant standalone task_id_idx from both messages and task_states collections — the compound indexes with task_id as leftmost prefix already cover task_id-only queries
  • Add unique: true to task_agent_compound_idx on task_states to enforce the (task_id, agent_id) uniqueness invariant at the database level

Test plan

  • Verify indexes are recreated on startup with the new sort direction
  • Confirm message list queries return results in expected order
  • Repository unit tests pass (15/15)
  • Confirm index creation logs on startup show 3 indexes for messages, 2 for task_states
  • Verify unique constraint rejects duplicate (task_id, agent_id) inserts

@smoreinis smoreinis requested a review from a team as a code owner February 9, 2026 20:30
…k states

Drop standalone task_id_idx from both messages and task_states collections
since the compound indexes with task_id as leftmost prefix already cover
task_id-only queries. Add unique: true to task_agent_compound_idx to
enforce the (task_id, agent_id) uniqueness invariant at the database level.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant