Repository: dotnet/runtime
File: .github/skills/vmr-codeflow-status/scripts/Get-CodeflowStatus.ps1 (PowerShell)

Code before:
        }
    }
}

# Extract conflicting files (used in History and Recommendations)
$conflictFiles = @()
if ($lastConflictComment) {
    $fileMatches = [regex]::Matches($lastConflictComment.body, '-\s+`([^`]+)`\s*\r?\n')
    foreach ($fm in $fileMatches) {
        $conflictFiles += $fm.Groups[1].Value
    }
}

# Cross-reference force push against conflict/staleness warnings (data only)
$conflictMayBeResolved = $false
$stalenessMayBeResolved = $false
if ($lastForcePushTime) {
    if ($conflictWarnings.Count -gt 0 -and $lastConflictComment) {
        $lastConflictTime = [DateTimeOffset]::Parse($lastConflictComment.createdAt).UtcDateTime
        if ($lastForcePushTime -gt $lastConflictTime) {
            $conflictMayBeResolved = $true
        }
    }
    if ($stalenessWarnings.Count -gt 0 -and $lastStalenessComment) {
        $lastWarnTime2 = [DateTimeOffset]::Parse($lastStalenessComment.createdAt).UtcDateTime
        if ($lastForcePushTime -gt $lastWarnTime2) {
            $stalenessMayBeResolved = $true
        }
    }
}

# --- Step 6: PR Branch Analysis ---
Write-Section "PR Branch Analysis"

if ($prCommits) {
    $maestroCommits = @()
    $manualCommits = @()
    $mergeCommits = @()

    foreach ($c in $prCommits) {
        $msg = $c.messageHeadline
        $authorLogin = if ($c.authors -and $c.authors.Count -gt 0) { $c.authors[0].login } else { $null }
        $authorName = if ($c.authors -and $c.authors.Count -gt 0) { $c.authors[0].name } else { "unknown" }
        $author = if ($authorLogin) { $authorLogin } else { $authorName }

        if ($msg -match "^Merge branch") {
            $mergeCommits += $c
        }
        elseif ($author -in @("dotnet-maestro[bot]", "dotnet-maestro") -or $msg -eq "Update dependencies") {
            $maestroCommits += $c
        }

Review comment (suggestion):
The variable name `$lastWarnTime2` is inconsistent with the naming pattern used for `$lastConflictTime` on line 1108. Consider renaming to `$lastStalenessTime` for clarity and consistency.
```suggestion
        $lastStalenessTime = [DateTimeOffset]::Parse($lastStalenessComment.createdAt).UtcDateTime
        if ($lastForcePushTime -gt $lastStalenessTime) {
```

Code after:
}

$conflictWarnings = @()
$lastConflictComment = $null

if ($pr.comments) {
    foreach ($comment in $pr.comments) {
        $commentAuthor = $comment.author.login
        if ($commentAuthor -eq "dotnet-maestro[bot]" -or $commentAuthor -eq "dotnet-maestro") {
            if ($comment.body -match "Conflict detected") {
                $conflictWarnings += $comment
                $lastConflictComment = $comment
            }
        }
    }
}

# Extract conflicting files (used in History and Recommendations)
$conflictFiles = @()
if ($lastConflictComment) {
    $fileMatches = [regex]::Matches($lastConflictComment.body, '-\s+`([^`]+)`\s*\r?\n')
    foreach ($fm in $fileMatches) {
        $conflictFiles += $fm.Groups[1].Value
    }
}

# Cross-reference force push against conflict/staleness warnings (data only)
$conflictMayBeResolved = $false
$stalenessMayBeResolved = $false
if ($lastForcePushTime) {
    if ($conflictWarnings.Count -gt 0 -and $lastConflictComment) {
        $lastConflictTime = [DateTimeOffset]::Parse($lastConflictComment.createdAt).UtcDateTime
        if ($lastForcePushTime -gt $lastConflictTime) {
            $conflictMayBeResolved = $true
        }
    }
    if ($stalenessWarnings.Count -gt 0 -and $lastStalenessComment) {
        $lastStalenessTime = [DateTimeOffset]::Parse($lastStalenessComment.createdAt).UtcDateTime
        if ($lastForcePushTime -gt $lastStalenessTime) {
            $stalenessMayBeResolved = $true
        }
    }
}

# --- Step 6: PR Branch Analysis ---
Write-Section "PR Branch Analysis"

if ($prCommits) {
    $maestroCommits = @()
    $manualCommits = @()
    $mergeCommits = @()