Addresses CodeRabbit TOCTOU concern: querying live task IDs inside the transaction ensures the check and inserts are atomic under SQLite locking, preventing FK violations from concurrent deletes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>