fix(agents): cancel active runs before delete

This commit is contained in:
Dotta committed 2026-04-10 11:28:12 -05:00
1 parent d82963ce87
commit 783e9727c4
2 files changed
+2 -1

No files matched your search

+1
View File
@@ -2029,6 +2029,7 @@ export function agentRoutes(db: Db) {
router.delete("/agents/:id", async (req, res) => {
assertBoard(req);
const id = req.params.id as string;
await heartbeat.cancelActiveForAgent(id, "Cancelled because the agent was deleted");
const agent = await svc.remove(id);
if (!agent) {
res.status(404).json({ error: "Agent not found" });
+1 -1
View File
@@ -4585,7 +4585,7 @@ export function heartbeatService(db: Db) {
cancelRun: (runId: string) => cancelRunInternal(runId),
cancelActiveForAgent: (agentId: string) => cancelActiveForAgentInternal(agentId),
cancelActiveForAgent: (agentId: string, reason?: string) => cancelActiveForAgentInternal(agentId, reason),
cancelBudgetScopeWork,