feat: add BoardWebhook updates on agent deletion

This commit is contained in:
Abhimanyu Saharan
2026-02-16 00:21:21 +05:30
parent b702ade0cc
commit cd68446c42
3 changed files with 24 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ from app.db import crud
from app.models.activity_events import ActivityEvent
from app.models.agents import Agent
from app.models.approvals import Approval
from app.models.board_webhooks import BoardWebhook
from app.models.gateways import Gateway
from app.models.tasks import Task
from app.schemas.gateways import GatewayTemplatesSyncResult
@@ -340,6 +341,14 @@ class GatewayAdminLifecycleService(OpenClawDBService):
agent_id=None,
commit=False,
)
await crud.update_where(
self.session,
BoardWebhook,
col(BoardWebhook.agent_id) == agent_id,
agent_id=None,
updated_at=now,
commit=False,
)
async def sync_templates(
self,

View File

@@ -31,6 +31,7 @@ from app.models.activity_events import ActivityEvent
from app.models.agents import Agent
from app.models.approvals import Approval
from app.models.board_memory import BoardMemory
from app.models.board_webhooks import BoardWebhook
from app.models.boards import Board
from app.models.gateways import Gateway
from app.models.organizations import Organization
@@ -1849,6 +1850,14 @@ class AgentLifecycleService(OpenClawDBService):
agent_id=None,
commit=False,
)
await crud.update_where(
self.session,
BoardWebhook,
col(BoardWebhook.agent_id) == agent.id,
agent_id=None,
updated_at=now,
commit=False,
)
await self.session.delete(agent)
await self.session.commit()