Commit d629948
fix(templates): restore all-or-nothing rollback on subtask apply failure
Per product decision: don't apply a template partially or fail silently. If any
subtask fails to create, roll back the parent task and throw, so the caller gets
a clear error instead of a half-populated task with silently-missing subtasks.
The concurrency batching from the earlier commit is retained and is what makes
this safe: it prevents the connection-pool exhaustion (P2024) that was causing
the failures — and would otherwise trigger this rollback and make the task
"disappear". The rollback now also covers a failed getAppliedTemplateDescription
(folded inside the try), so any failure rolls back consistently.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 2673cc9 commit d629948
1 file changed
Lines changed: 18 additions & 4 deletions
File tree
- src/app/api/tasks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
622 | 622 | | |
623 | 623 | | |
624 | 624 | | |
625 | | - | |
626 | | - | |
627 | | - | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
628 | 638 | | |
629 | 639 | | |
630 | 640 | | |
631 | 641 | | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
632 | 646 | | |
633 | 647 | | |
634 | 648 | | |
| |||
0 commit comments