Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/closed_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
from src import contrast_api
from src.config import get_config # Using get_config function instead of direct import
from src.utils import debug_log, extract_remediation_id_from_branch, extract_remediation_id_from_labels, log
from src.git_handler import extract_issue_number_from_branch, get_pr_changed_files_count
from src.smartfix.domains.scm.git_operations import GitOperations
from src.github.github_operations import GitHubOperations
import src.telemetry_handler as telemetry_handler


Expand Down Expand Up @@ -77,7 +78,8 @@ def _extract_remediation_info(pull_request: dict) -> tuple:
debug_log("Branch appears to be created by external agent. Extracting remediation ID from PR labels.")
remediation_id = extract_remediation_id_from_labels(labels)
# Extract GitHub issue number from branch name
issue_number = extract_issue_number_from_branch(branch_name)
git_ops = GitOperations()
issue_number = git_ops.extract_issue_number_from_branch(branch_name)
if issue_number:
telemetry_handler.update_telemetry("additionalAttributes.externalIssueNumber", issue_number)
debug_log(f"Extracted external issue number from branch name: {issue_number}")
Expand Down Expand Up @@ -130,7 +132,8 @@ def _notify_remediation_service(remediation_id: str, pr_number: int = None):

# Check if PR has no changed files (for external agents like Copilot)
if pr_number is not None:
changed_files_count = get_pr_changed_files_count(pr_number)
github_ops = GitHubOperations()
changed_files_count = github_ops.get_pr_changed_files_count(pr_number)
if changed_files_count == 0:
# PR has no changes - report as failed remediation
log(f"PR {pr_number} has no changed files. Reporting as failed remediation.")
Expand Down
Loading