Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c98bc94
Auto-apply s/agent-ready-for-rerun from the PR Review Queue workflow
Copilot Jul 3, 2026
152406b
Grant pull-requests: write so the auto-label step can apply the label
Copilot Jul 3, 2026
a2fc3e9
Allow scanner to trigger reruns from autonomous queue labels
Copilot Jul 4, 2026
fb233b4
Harden auto-rerun labeler: per-PR error isolation, arg-passing, fetch…
Copilot Jul 7, 2026
9b0a5aa
Auto-rerun labeler: single-source label metadata, fail-loud label fet…
Copilot Jul 7, 2026
f2cd01e
auto-rerun labeler: fail loud on gh api errors in activity/commit fet…
Copilot Jul 7, 2026
b60eadf
Merge remote-tracking branch 'origin/main' into feature/auto-rerun-la…
Copilot Jul 8, 2026
5c53948
auto-rerun labeler: fix -Limit help default, fail-loud label re-read,…
Copilot Jul 10, 2026
5b4acfe
Address review: verify-read regression, label-desc drift, redundant l…
Copilot Jul 16, 2026
8d72e52
Fix autonomous-rerun daily flap on scanner skip (last-declined checkp…
Copilot Jul 16, 2026
fe99a54
Doc: note head-SHA-differs as qualifying rerun activity
Copilot Jul 16, 2026
6b46aac
Surface gh api stderr in Get-IssueLabels on failure
Copilot Jul 16, 2026
0fa7212
Make -ApplyLabel post-apply verification failure-tolerant
Copilot Jul 16, 2026
2637ec3
Merge origin/main into feature/auto-rerun-labeler
kubaflo Jul 26, 2026
620a7d9
Merge main into feature/auto-rerun-labeler
Copilot Aug 6, 2026
5886164
Harden autonomous rerun candidate scanning
Aug 10, 2026
d4ed6b3
Make rerun tests hermetic in full suite
Aug 10, 2026
3a3c1ab
Make rerun decline lifecycle race-safe
Aug 10, 2026
1967d88
Address auto-rerun review feedback
Aug 12, 2026
9657be3
Handle concurrent rerun label creation
Aug 12, 2026
e60d765
Harden autonomous rerun queue handling
Aug 15, 2026
fc4d474
Fix auto-rerun review activity checkpoints
Aug 18, 2026
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
26 changes: 22 additions & 4 deletions .github/scripts/Invoke-RerunReviewTrigger.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ BeforeAll {
[string]$HeadSha = 'abc123def',
[string]$Platform = 'android',
[string]$PipelineRef = 'main',
[Int64]$RerunCommentId = 9001
[Int64]$RerunCommentId = 9001,
[Int64]$ActivityCheckpoint = 1787000000000
)

[pscustomobject]@{
Expand All @@ -38,6 +39,7 @@ BeforeAll {
platform = $Platform
pipelineRef = $PipelineRef
rerunCommentId = $RerunCommentId
activityCheckpoint = $ActivityCheckpoint
}
}

Expand Down Expand Up @@ -243,6 +245,7 @@ Describe 'Get-RerunActions' {
$result.Actions[0].platform | Should -Be 'ios'
$result.Actions[0].pipelineRef | Should -Be 'main'
$result.Actions[0].rerunCommentId | Should -Be 4242
$result.Actions[0].activityCheckpoint | Should -Be 1787000000000
}

It 'produces an action for a valid skip decision even without a rerun comment id' {
Expand All @@ -255,6 +258,18 @@ Describe 'Get-RerunActions' {
$result.Actions.Count | Should -Be 1
$result.Actions[0].decision | Should -Be 'skip'
$result.Actions[0].rerunCommentId | Should -Be 0
$result.Actions[0].activityCheckpoint | Should -Be 1787000000000
}

It 'rejects a candidate without a scan-time activity checkpoint' {
$items = @(New-TestDecision -PRNumber '50' -Decision 'skip' -ExpectedHeadSha 'sha50')
$candidate = New-TestCandidate -PRNumber 50 -HeadSha 'sha50'
$candidate.activityCheckpoint = $null

$result = Get-RerunActions -Items $items -Candidates @($candidate)

$result.HadFailure | Should -BeTrue
$result.Actions.Count | Should -Be 0
}

It 'normalizes the pipeline ref and resolves an invalid candidate platform to android' {
Expand Down Expand Up @@ -333,14 +348,17 @@ Describe 'Get-RerunActions' {
$result.Actions.Count | Should -Be 0
}

It 'refuses to trigger when the candidate has no rerun comment id' {
It 'triggers when the candidate has no proven current-cycle rerun comment id' {
$items = @(New-TestDecision -PRNumber '5' -Decision 'trigger' -ExpectedHeadSha 'x')
$candidates = @(New-TestCandidate -PRNumber 5 -HeadSha 'x' -RerunCommentId 0)

$result = Get-RerunActions -Items $items -Candidates $candidates

$result.HadFailure | Should -BeTrue
$result.Actions.Count | Should -Be 0
$result.HadFailure | Should -BeFalse
$result.Actions.Count | Should -Be 1
$result.Actions[0].prNumber | Should -Be 5
$result.Actions[0].decision | Should -Be 'trigger'
$result.Actions[0].rerunCommentId | Should -Be 0
}

It 'continues processing valid decisions after a failed one' {
Expand Down
11 changes: 10 additions & 1 deletion .github/scripts/Invoke-RerunReviewTrigger.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,23 @@ function Get-RerunActions {
if ([string]$candidate.headSha -ne $expectedHeadSha) {
throw "PR #$prNumber decision head SHA does not match candidate head SHA."
}
$activityCheckpointRaw = ConvertTo-TrimmedString $candidate.activityCheckpoint
if ($activityCheckpointRaw -notmatch '^[1-9]\d*$') {
throw "Candidate for PR #$prNumber has no valid activity checkpoint."
}
$activityCheckpoint = [Int64]$activityCheckpointRaw

# Operational values come from the deterministic candidate set, not the
# agent's emission (its platform / pipeline_ref / rerun_comment_id are advisory).
$rerunCommentId = if ($candidate.rerunCommentId) { [Int64]$candidate.rerunCommentId } else { [Int64]0 }
$platform = Get-PlatformFromLabels -Labels @() -Fallback ([string]$candidate.platform)
$pipelineRef = Normalize-PipelineRef -Value ([string]$candidate.pipelineRef) -Fallback $DefaultPipelineRef

# The queue label does not prove which command created the current cycle,
# so source-ambiguous candidates intentionally carry no reaction target.
# review-trigger.yml does not need a comment to dispatch.
if ($decision -eq 'trigger' -and $rerunCommentId -le 0) {
throw "Candidate for PR #$prNumber has no rerun comment id; cannot trigger."
Write-Host "PR #$prNumber trigger has no proven current-cycle rerun comment; dispatching without a reaction target."
}

$actions.Add([pscustomobject]@{
Expand All @@ -222,6 +230,7 @@ function Get-RerunActions {
pipelineRef = $pipelineRef
rerunCommentId = $rerunCommentId
headSha = [string]$candidate.headSha
activityCheckpoint = $activityCheckpoint
})
Write-Host "Validated PR #$prNumber decision=$decision platform=$platform pipelineRef=$pipelineRef rerunCommentId=$rerunCommentId"
} catch {
Expand Down
Loading
Loading