feat: wire feishu notifications into workflows
This commit is contained in:
@@ -17,6 +17,8 @@ from review_agent.models import (
|
||||
Message,
|
||||
WorkflowNodeRun,
|
||||
)
|
||||
from review_agent.notifications.dispatcher import dispatch_workflow_notification
|
||||
from review_agent.notifications.workflow_adapters import build_file_summary_context
|
||||
|
||||
from .events import record_event
|
||||
from .services.archive import ARCHIVE_EXTENSIONS
|
||||
@@ -154,14 +156,25 @@ class WorkflowExecutor:
|
||||
self.batch.finished_at = timezone.now()
|
||||
self.batch.save(update_fields=["status", "error_message", "finished_at"])
|
||||
record_event(self.batch, "workflow_failed", {"message": str(exc)})
|
||||
self._dispatch_completion_notification()
|
||||
return
|
||||
|
||||
self.batch.status = FileSummaryBatch.Status.SUCCESS
|
||||
self.batch.finished_at = timezone.now()
|
||||
self.batch.save(update_fields=["status", "finished_at"])
|
||||
record_event(self.batch, "workflow_completed", {"batch_id": self.batch.pk})
|
||||
self._dispatch_completion_notification()
|
||||
logger.info("Workflow run completed", extra={"batch_id": self.batch.pk})
|
||||
|
||||
def _dispatch_completion_notification(self) -> None:
|
||||
try:
|
||||
dispatch_workflow_notification(build_file_summary_context(self.batch))
|
||||
except Exception as exc:
|
||||
logger.warning(
|
||||
"File summary notification failed without blocking workflow",
|
||||
extra={"batch_id": self.batch.pk, "error": str(exc)},
|
||||
)
|
||||
|
||||
def _run_node(self, node: WorkflowNodeRun) -> None:
|
||||
logger.info(
|
||||
"Workflow node started",
|
||||
|
||||
Reference in New Issue
Block a user