|
1 | 1 | import asyncio
|
2 | 2 | import logging
|
3 | 3 | import os
|
| 4 | +from shutil import rmtree |
4 | 5 | import subprocess
|
5 | 6 | import sys
|
6 | 7 | import traceback
|
| 8 | + |
7 | 9 | from pathlib import Path
|
8 | 10 |
|
9 | 11 | from pydantic import BaseModel, Field
|
|
30 | 32 | from tools.text import CreateTool, InsertTool, StrReplaceTool, ViewTool
|
31 | 33 | from tools.wicked_git import GitLogSearchTool, GitPatchCreationTool
|
32 | 34 | from triage_agent import BackportData, ErrorData
|
33 |
| -from utils import check_subprocess, get_agent_execution_config, mcp_tools, redis_client |
| 35 | +from utils import check_subprocess, get_agent_execution_config, mcp_tools, redis_client, post_private_jira_comment |
34 | 36 |
|
35 | 37 | logger = logging.getLogger(__name__)
|
36 | 38 |
|
@@ -274,6 +276,19 @@ async def retry(task, error):
|
274 | 276 | logger.info(
|
275 | 277 | f"Backport processing completed for {backport_data.jira_issue}, " f"success: {state.backport_result.success}"
|
276 | 278 | )
|
| 279 | + |
| 280 | + agent_type = "Backport" |
| 281 | + if state.backport_result.success: |
| 282 | + logger.info(f"Updating JIRA {backport_data.jira_issue} with {state.backport_result.mr_url} ") |
| 283 | + |
| 284 | + await post_private_jira_comment(gateway_tools, backport_data.jira_issue, agent_type, state.backport_result.mr_url) |
| 285 | + else: |
| 286 | + logger.info(f"Agent failed to perform a backport for {backport_data.jira_issue}.") |
| 287 | + await post_private_jira_comment(gateway_tools, backport_data.jira_issue, agent_type, |
| 288 | + "Agent failed to perform a backport: {state.backport_result.error}") |
| 289 | + |
| 290 | + |
| 291 | + |
277 | 292 | except Exception as e:
|
278 | 293 | error = "".join(traceback.format_exception(e))
|
279 | 294 | logger.error(f"Exception during backport processing for {backport_data.jira_issue}: {error}")
|
|
0 commit comments