From 1956b3cc343ab6ee5288c11249b7c6444bb5c9c1 Mon Sep 17 00:00:00 2001 From: Jakub Florkowski Date: Wed, 7 Oct 2026 21:04:42 +0200 Subject: [PATCH 1/4] Resolve successfully handled issue triage commands Gate exact command minimization on trusted validation receipts and complete native safe-output success while keeping reports artifact-only. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/docs/issue-triage.md | 9 +++ .github/scripts/IssueTriage.ps1 | 99 ++++++++++++++++++++++--- .github/workflows/issue-triage.lock.yml | 53 ++++++++++++- .github/workflows/issue-triage.md | 57 ++++++++++++++ 4 files changed, 208 insertions(+), 10 deletions(-) diff --git a/.github/docs/issue-triage.md b/.github/docs/issue-triage.md index 9aee378b0266..f4a5b65e88b0 100644 --- a/.github/docs/issue-triage.md +++ b/.github/docs/issue-triage.md @@ -5,6 +5,15 @@ Post exactly `/issue triage` as a new comment on an **open issue** in The command proposes and applies evidence-backed manual issue labels and retains its explanation only in Actions artifacts, without posting a public triage report. Separate Policy Service replies triggered by feedback labels are unchanged. +After successful validation and native safe-output processing, the exact +authorized triggering slash-command comment collapses as **resolved**, including +successful no-change and withheld-only results. A separate trusted completion job +rechecks the open issue, unchanged human command and caller's current write access. +Failed, cancelled, deferred, skipped, warning, partial or incomplete outcomes leave +the command visible. Manual dispatches (including staged runs), edited/replayed +commands, bot comments and unrelated comments are never minimized. A minimization +API error is reported in Actions without rolling back successful labels or posting +a report; explanations remain artifact-only. It does not reproduce bugs, run samples, change milestones or assignees, close/reopen issues, modify product code or create pull requests. diff --git a/.github/scripts/IssueTriage.ps1 b/.github/scripts/IssueTriage.ps1 index 2fb657bc5dbb..273873272e57 100644 --- a/.github/scripts/IssueTriage.ps1 +++ b/.github/scripts/IssueTriage.ps1 @@ -1,14 +1,15 @@ #!/usr/bin/env pwsh [CmdletBinding()] param( - [Parameter(Mandatory)][ValidateSet('Gather', 'Validate')][string]$Stage, + [Parameter(Mandatory)][ValidateSet('Gather', 'Validate', 'Complete')][string]$Stage, [Parameter(Mandatory)][ValidateRange(1, 2147483647)][int]$IssueNumber, [ValidateSet('dotnet/maui')][string]$Repository = 'dotnet/maui', [Parameter(Mandatory)][ValidatePattern('^[A-Za-z0-9_-]+$')][string]$Actor, [ValidateRange(0, [long]::MaxValue)][long]$CommandCommentId = 0, - [Parameter(Mandatory)][string]$OutputDirectory, + [string]$OutputDirectory, [string]$ContextDirectory, [string]$AgentOutputPath, + [ValidateRange(0, 2)][int]$ProcessedOperations = 0, [ValidatePattern('^[A-F0-9]{64}$')][string]$ExpectedContextHash ) @@ -228,6 +229,77 @@ function Assert-Actor { } } +function Complete-TriageRequest { + if ($env:GITHUB_ACTIONS -cne 'true' -or $env:GITHUB_EVENT_NAME -cne 'issue_comment' -or + $CommandCommentId -le 0 -or $ProcessedOperations -le 0 -or + -not $ContextDirectory -or -not $ExpectedContextHash) { + throw 'Command completion requires a fresh hosted issue-comment invocation.' + } + $validation = Read-Json (Join-Path $ContextDirectory 'validation.json') + $receipt = $validation.completion + if ($validation.status -cnotin @('validated', 'noop') -or + $validation.contextHash -cne $ExpectedContextHash -or + $receipt.repository -cne $Repository -or $receipt.actor -cne $Actor -or + $receipt.issueNumber -ne $IssueNumber -or $receipt.commandCommentId -ne $CommandCommentId -or + $receipt.runId -cne $env:GITHUB_RUN_ID -or $receipt.runAttempt -cne '1' -or + $receipt.warningFree -cne $true -or $receipt.operations -ne $ProcessedOperations -or + ($env:DETECTION_CONCLUSION -cne 'success' -and + -not ($env:DETECTION_CONCLUSION -ceq 'skipped' -and $validation.status -ceq 'noop'))) { + throw 'The trusted validation receipt does not prove complete successful triage for this invocation.' + } + $permissions.Clear() + Assert-Actor + $event = Read-Json $env:GITHUB_EVENT_PATH 2MB + if ($event.repository.full_name -cne $Repository -or + $event.issue.state -cne 'open' -or $event.comment.user.type -cne 'User' -or + $event.comment.user.login -cne $Actor -or + $event.comment.body -cnotmatch '\A/issue triage[ \t\r\n]*\z' -or + (Get-Timestamp $event.comment.created_at) -cne (Get-Timestamp $event.comment.updated_at) -or + [string]::IsNullOrWhiteSpace([string]$event.comment.node_id)) { + throw 'The completion event is not an unedited authorized human triage command.' + } + $issue = Get-Api "repos/$Repository/issues/$IssueNumber" + if ($issue.number -ne $IssueNumber -or $issue.id -ne $event.issue.id -or + $issue.state -cne 'open' -or $issue.ContainsKey('pull_request')) { + throw 'The completion target is no longer the exact open issue.' + } + $command = Get-Api "repos/$Repository/issues/comments/$CommandCommentId" + if ($command.id -ne $CommandCommentId -or $command.node_id -cne $event.comment.node_id -or + $command.user.type -cne 'User' -or $command.user.login -cne $Actor -or + $command.user.id -ne $event.comment.user.id -or + $command.issue_url -cne "https://api.github.com/repos/$Repository/issues/$IssueNumber" -or + $command.body -cne $event.comment.body -or + $command.body -cnotmatch '\A/issue triage[ \t\r\n]*\z' -or + (Get-Timestamp $command.created_at) -cne (Get-Timestamp $event.comment.created_at) -or + (Get-Timestamp $command.updated_at) -cne (Get-Timestamp $event.comment.updated_at)) { + throw 'The triggering command was edited, deleted, retargeted or replaced; leaving it visible.' + } + try { + $raw = Invoke-GhCommandWithRetry -Arguments @( + 'api', 'graphql', '-f', + 'query=mutation($id: ID!) { minimizeComment(input: {subjectId: $id, classifier: RESOLVED}) { minimizedComment { isMinimized } } }', + '-f', "id=$($command.node_id)" + ) -Description 'resolve the successfully handled issue-triage command' -RequireOutput -MaxAttempts 1 + $result = $raw | ConvertFrom-Json -AsHashtable + if (($result.ContainsKey('errors') -and $result.errors) -or + $result.data.minimizeComment.minimizedComment.isMinimized -cne $true) { + throw 'GitHub did not confirm that the triggering command was minimized.' + } + Write-Host "Resolved issue-triage command $CommandCommentId." + } catch { + Write-Warning "Command minimization was not confirmed; successful label operations are unchanged. $($_.Exception.Message)" + } +} + +function Get-TriageCompletionReceipt([int]$OperationCount, $Payload) { + return @{ + repository = $Repository; actor = $Actor; issueNumber = $IssueNumber + commandCommentId = $CommandCommentId; runId = $env:GITHUB_RUN_ID + runAttempt = $env:GITHUB_RUN_ATTEMPT; operations = $OperationCount + warningFree = -not ($Payload.ContainsKey('warnings') -and @($Payload.warnings).Count -gt 0) + } +} + function Test-Pattern([string]$Name, [string]$Pattern) { return $Name -cmatch ('^' + [regex]::Escape($Pattern).Replace('\*', '.*') + '$') } @@ -1509,6 +1581,11 @@ function Assert-Change($Decision, [string]$Action, $Snapshot, [string[]]$Effecti } } +if ($Stage -eq 'Complete') { + Complete-TriageRequest + return +} +if (-not $OutputDirectory) { throw 'Gather and Validate require OutputDirectory.' } $OutputDirectory = [IO.Path]::GetFullPath($OutputDirectory) $null = New-Item -ItemType Directory -Path $OutputDirectory -Force $null = Assert-RegularPath $OutputDirectory -Directory @@ -1544,7 +1621,10 @@ if ($payload.items -isnot [array] -or $payload.items.Count -eq 0 -or $payload.it } $items = @($payload.items) if ($items.Count -eq 1 -and $items[0].type -in @('noop', 'report_incomplete', 'missing_tool')) { - Write-Json 'validation.json' @{ status = $items[0].type; contextHash = $current.contextHash; writes = 0 } + Write-Json 'validation.json' @{ + status = $items[0].type; contextHash = $current.contextHash; writes = 0 + completion = Get-TriageCompletionReceipt 1 $payload + } if ($items[0].type -ne 'noop') { throw 'Triage is incomplete; inspect the agent result, resolve the missing evidence, and rerun.' } Write-Host 'No label changes requested.' return @@ -1707,12 +1787,6 @@ if ($final.contextHash -cne $current.contextHash) { } Set-Content -LiteralPath (Join-Path $OutputDirectory 'report.md') -Value $body -Encoding utf8 Write-Json 'decision.json' $proposal -Write-Json 'validation.json' @{ - status = 'validated'; contextHash = $current.contextHash; existingComment = $existing.Count -gt 0 - publicCommentWrites = 0 - requestedAdditions = @($proposal.additions | ForEach-Object { $_.label }) - requestedRemovals = @($proposal.removals | ForEach-Object { $_.label }) -} # The structured comment is evidence transport only; retain its report in Actions artifacts. $payload.items = @($items | Where-Object { $_.type -cne 'add_comment' }) if ($payload.items.Count -eq 0) { @@ -1722,4 +1796,11 @@ if ($payload.items.Count -eq 0) { }) } $payload | ConvertTo-Json -Depth 30 | Set-Content -LiteralPath $AgentOutputPath -Encoding utf8 +Write-Json 'validation.json' @{ + status = 'validated'; contextHash = $current.contextHash; existingComment = $existing.Count -gt 0 + publicCommentWrites = 0 + requestedAdditions = @($proposal.additions | ForEach-Object { $_.label }) + requestedRemovals = @($proposal.removals | ForEach-Object { $_.label }) + completion = Get-TriageCompletionReceipt $payload.items.Count $payload +} Write-Host "Validated $($proposal.additions.Count) additions and $($proposal.removals.Count) removals for issue $IssueNumber." diff --git a/.github/workflows/issue-triage.lock.yml b/.github/workflows/issue-triage.lock.yml index f37961867adc..28f064f02d73 100644 --- a/.github/workflows/issue-triage.lock.yml +++ b/.github/workflows/issue-triage.lock.yml @@ -1,4 +1,4 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"eb116514f337eb247c8767becceaefdd9cfb69da65044098b5cdc510e7c2d153","body_hash":"97839eaefddf38d3bd97d52c85a69611f1fc6dc28b4cd995893d217b45396f01","compiler_version":"v0.86.2","strict":true,"agent_id":"copilot","agent_model":"gpt-6.1-sol","engine_versions":{"copilot":"1.0.79"}} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"050ce2d5ccaf7846dbb14ba42c90ca0f2fcf69112b91903177dad20e9ba0dd96","body_hash":"97839eaefddf38d3bd97d52c85a69611f1fc6dc28b4cd995893d217b45396f01","compiler_version":"v0.86.2","strict":true,"agent_id":"copilot","agent_model":"gpt-6.1-sol","engine_versions":{"copilot":"1.0.79"}} # gh-aw-manifest: {"version":1,"secrets":["COPILOT_PAT_0","COPILOT_PAT_1","COPILOT_PAT_2","COPILOT_PAT_3","COPILOT_PAT_4","COPILOT_PAT_5","COPILOT_PAT_6","COPILOT_PAT_7","COPILOT_PAT_8","COPILOT_PAT_9","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/cache/save","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"820762786026740c76f36085b0efc47a31fe5020","version":"v7.0.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"6aab9e5b5c91c615506061f09bedd81a23babe3c","version":"v0.86.2"}],"skills":[".github/skills/issue-triage-labels"],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.44","digest":"sha256:0d727725c737b58c7bdf51f640cffb928385ec46517e0917c7f1a02f1bada8b4","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.44@sha256:0d727725c737b58c7bdf51f640cffb928385ec46517e0917c7f1a02f1bada8b4"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.44","digest":"sha256:b50fbadba138f6e9aba94aca09711335c489bb3b15861220cb66f6092e042dc7","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.44@sha256:b50fbadba138f6e9aba94aca09711335c489bb3b15861220cb66f6092e042dc7"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.44","digest":"sha256:83e48bbe12c634be8c228a576832fe45f66c529ac3659db92bddbcf2eeb6d627","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.44@sha256:83e48bbe12c634be8c228a576832fe45f66c529ac3659db92bddbcf2eeb6d627"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.4.9","digest":"sha256:e5a1569aeaf41820fa7bdee3e94468cae448133cdbf00119ad24f5b74db1ab9f","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.4.9@sha256:e5a1569aeaf41820fa7bdee3e94468cae448133cdbf00119ad24f5b74db1ab9f"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:0d9f1fb5fd6610c0ac1f5194a38e45a8a1e81f8a390d5142d8e4e6f26a4b3196","pinned_image":"ghcr.io/github/gh-aw-node@sha256:0d9f1fb5fd6610c0ac1f5194a38e45a8a1e81f8a390d5142d8e4e6f26a4b3196"}]} # This file was automatically generated by gh-aw (v0.86.2). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # @@ -1114,6 +1114,7 @@ jobs: - activation - agent - detection + - minimize_command - pat_pool - safe_outputs if: > @@ -1643,6 +1644,56 @@ jobs: } } + minimize_command: + needs: + - activation + - agent + - detection + - pre_activation + - safe_outputs + if: > + !cancelled() && github.repository == 'dotnet/maui' && github.event_name == 'issue_comment' && github.event.action == 'created' && github.event.comment.user.type == 'User' && github.event.comment.id > 0 && github.run_attempt == 1 && needs.pre_activation.outputs.triage_authorized == 'true' && needs.pre_activation.outputs.triage_ready == 'true' && needs.activation.result == 'success' && needs.agent.result == 'success' && needs.detection.result == 'success' && (needs.detection.outputs.detection_conclusion == 'success' || + needs.detection.outputs.detection_conclusion == 'skipped') && + needs.safe_outputs.result == 'success' && needs.safe_outputs.outputs.process_safe_outputs_status == 'success' && needs.safe_outputs.outputs.process_safe_outputs_items_cancelled == '0' && needs.safe_outputs.outputs.process_safe_outputs_items_deferred == '0' && needs.safe_outputs.outputs.process_safe_outputs_items_failed == '0' && needs.safe_outputs.outputs.process_safe_outputs_items_skipped == '0' && needs.safe_outputs.outputs.process_safe_outputs_items_warnings == '0' && needs.safe_outputs.outputs.process_safe_outputs_processed_count != '' && needs.safe_outputs.outputs.process_safe_outputs_processed_count > 0 && needs.safe_outputs.outputs.process_safe_outputs_items_applied == needs.safe_outputs.outputs.process_safe_outputs_processed_count && needs.safe_outputs.outputs.process_safe_outputs_items_succeeded == needs.safe_outputs.outputs.process_safe_outputs_processed_count + runs-on: ubuntu-latest + permissions: + contents: read + issues: write + steps: + - name: Configure GH_HOST for enterprise compatibility + id: ghes-host-config + shell: bash + run: | # zizmor: ignore[github-env] - GITHUB_SERVER_URL is set by GitHub Actions, not user input. + # Derive GH_HOST from GITHUB_SERVER_URL so the gh CLI targets the correct + # GitHub instance (GHES/GHEC). On github.com this is a harmless no-op. + GH_HOST="${GITHUB_SERVER_URL#https://}" + GH_HOST="${GH_HOST#http://}" + echo "GH_HOST=${GH_HOST}" >> "$GITHUB_ENV" + - name: Checkout trusted command completion script + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + ref: ${{ github.sha }} + - name: Download trusted validation receipt outside checkout + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: issue-triage-report-${{ github.run_id }} + path: ${{ runner.temp }}/issue-triage-completion + - name: Resolve only the successfully handled authorized command + run: | + timeout -k 30s 2m pwsh -NoProfile -File .github/scripts/IssueTriage.ps1 \ + -Stage Complete -IssueNumber "$ISSUE_NUMBER" -Repository "$GITHUB_REPOSITORY" \ + -Actor "$GITHUB_ACTOR" -CommandCommentId "$COMMAND_COMMENT_ID" \ + -ContextDirectory "$RUNNER_TEMP/issue-triage-completion" \ + -ExpectedContextHash "$EXPECTED_CONTEXT_HASH" -ProcessedOperations "$NATIVE_PROCESSED_COUNT" + env: + COMMAND_COMMENT_ID: ${{ github.event.comment.id }} + DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }} + EXPECTED_CONTEXT_HASH: ${{ needs.pre_activation.outputs.context_hash }} + GH_TOKEN: ${{ github.token }} + ISSUE_NUMBER: ${{ github.event.issue.number }} + NATIVE_PROCESSED_COUNT: ${{ needs.safe_outputs.outputs.process_safe_outputs_processed_count }} + pat_pool: needs: pre_activation if: needs.pre_activation.outputs.triage_ready == 'true' && github.run_attempt == 1 diff --git a/.github/workflows/issue-triage.md b/.github/workflows/issue-triage.md index 0dc09b88a1fa..938c53d2c45a 100644 --- a/.github/workflows/issue-triage.md +++ b/.github/workflows/issue-triage.md @@ -117,6 +117,63 @@ jobs: if: github.run_attempt == 1 safe_outputs: if: github.run_attempt == 1 + minimize_command: + needs: [pre_activation, activation, agent, detection, safe_outputs] + if: >- + !cancelled() && + github.repository == 'dotnet/maui' && + github.event_name == 'issue_comment' && + github.event.action == 'created' && + github.event.comment.user.type == 'User' && + github.event.comment.id > 0 && + github.run_attempt == 1 && + needs.pre_activation.outputs.triage_authorized == 'true' && + needs.pre_activation.outputs.triage_ready == 'true' && + needs.activation.result == 'success' && + needs.agent.result == 'success' && + needs.detection.result == 'success' && + (needs.detection.outputs.detection_conclusion == 'success' || + needs.detection.outputs.detection_conclusion == 'skipped') && + needs.safe_outputs.result == 'success' && + needs.safe_outputs.outputs.process_safe_outputs_status == 'success' && + needs.safe_outputs.outputs.process_safe_outputs_items_cancelled == '0' && + needs.safe_outputs.outputs.process_safe_outputs_items_deferred == '0' && + needs.safe_outputs.outputs.process_safe_outputs_items_failed == '0' && + needs.safe_outputs.outputs.process_safe_outputs_items_skipped == '0' && + needs.safe_outputs.outputs.process_safe_outputs_items_warnings == '0' && + needs.safe_outputs.outputs.process_safe_outputs_processed_count != '' && + needs.safe_outputs.outputs.process_safe_outputs_processed_count > 0 && + needs.safe_outputs.outputs.process_safe_outputs_items_applied == needs.safe_outputs.outputs.process_safe_outputs_processed_count && + needs.safe_outputs.outputs.process_safe_outputs_items_succeeded == needs.safe_outputs.outputs.process_safe_outputs_processed_count + runs-on: ubuntu-latest + permissions: + contents: read + issues: write + steps: + - name: Checkout trusted command completion script + uses: actions/checkout@v7.0.1 + with: + ref: ${{ github.sha }} + persist-credentials: false + - name: Download trusted validation receipt outside checkout + uses: actions/download-artifact@v8.0.1 + with: + name: issue-triage-report-${{ github.run_id }} + path: ${{ runner.temp }}/issue-triage-completion + - name: Resolve only the successfully handled authorized command + env: + GH_TOKEN: ${{ github.token }} + ISSUE_NUMBER: ${{ github.event.issue.number }} + COMMAND_COMMENT_ID: ${{ github.event.comment.id }} + EXPECTED_CONTEXT_HASH: ${{ needs.pre_activation.outputs.context_hash }} + NATIVE_PROCESSED_COUNT: ${{ needs.safe_outputs.outputs.process_safe_outputs_processed_count }} + DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }} + run: | + timeout -k 30s 2m pwsh -NoProfile -File .github/scripts/IssueTriage.ps1 \ + -Stage Complete -IssueNumber "$ISSUE_NUMBER" -Repository "$GITHUB_REPOSITORY" \ + -Actor "$GITHUB_ACTOR" -CommandCommentId "$COMMAND_COMMENT_ID" \ + -ContextDirectory "$RUNNER_TEMP/issue-triage-completion" \ + -ExpectedContextHash "$EXPECTED_CONTEXT_HASH" -ProcessedOperations "$NATIVE_PROCESSED_COUNT" pre-activation: outputs: triage_ready: ${{ steps.context.outputs.ready }} From cdb48762793ca59854923c2d975bc61ea39a89d2 Mon Sep 17 00:00:00 2001 From: Jakub Florkowski Date: Wed, 7 Oct 2026 21:06:30 +0200 Subject: [PATCH 2/4] Keep triage completion failures in Actions only Disable native custom-job failure reports alongside the existing artifact-only triage reporting policy. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/issue-triage.lock.yml | 20 +------------------- .github/workflows/issue-triage.md | 1 + 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/.github/workflows/issue-triage.lock.yml b/.github/workflows/issue-triage.lock.yml index 28f064f02d73..5cc14b989671 100644 --- a/.github/workflows/issue-triage.lock.yml +++ b/.github/workflows/issue-triage.lock.yml @@ -1,4 +1,4 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"050ce2d5ccaf7846dbb14ba42c90ca0f2fcf69112b91903177dad20e9ba0dd96","body_hash":"97839eaefddf38d3bd97d52c85a69611f1fc6dc28b4cd995893d217b45396f01","compiler_version":"v0.86.2","strict":true,"agent_id":"copilot","agent_model":"gpt-6.1-sol","engine_versions":{"copilot":"1.0.79"}} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"c848d6ca0861ac24b0a3d0286e6b6d49a2028ebde30f0b3680db1057823aa00b","body_hash":"97839eaefddf38d3bd97d52c85a69611f1fc6dc28b4cd995893d217b45396f01","compiler_version":"v0.86.2","strict":true,"agent_id":"copilot","agent_model":"gpt-6.1-sol","engine_versions":{"copilot":"1.0.79"}} # gh-aw-manifest: {"version":1,"secrets":["COPILOT_PAT_0","COPILOT_PAT_1","COPILOT_PAT_2","COPILOT_PAT_3","COPILOT_PAT_4","COPILOT_PAT_5","COPILOT_PAT_6","COPILOT_PAT_7","COPILOT_PAT_8","COPILOT_PAT_9","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/cache/save","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"820762786026740c76f36085b0efc47a31fe5020","version":"v7.0.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"6aab9e5b5c91c615506061f09bedd81a23babe3c","version":"v0.86.2"}],"skills":[".github/skills/issue-triage-labels"],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.44","digest":"sha256:0d727725c737b58c7bdf51f640cffb928385ec46517e0917c7f1a02f1bada8b4","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.44@sha256:0d727725c737b58c7bdf51f640cffb928385ec46517e0917c7f1a02f1bada8b4"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.44","digest":"sha256:b50fbadba138f6e9aba94aca09711335c489bb3b15861220cb66f6092e042dc7","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.44@sha256:b50fbadba138f6e9aba94aca09711335c489bb3b15861220cb66f6092e042dc7"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.44","digest":"sha256:83e48bbe12c634be8c228a576832fe45f66c529ac3659db92bddbcf2eeb6d627","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.44@sha256:83e48bbe12c634be8c228a576832fe45f66c529ac3659db92bddbcf2eeb6d627"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.4.9","digest":"sha256:e5a1569aeaf41820fa7bdee3e94468cae448133cdbf00119ad24f5b74db1ab9f","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.4.9@sha256:e5a1569aeaf41820fa7bdee3e94468cae448133cdbf00119ad24f5b74db1ab9f"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:0d9f1fb5fd6610c0ac1f5194a38e45a8a1e81f8a390d5142d8e4e6f26a4b3196","pinned_image":"ghcr.io/github/gh-aw-node@sha256:0d9f1fb5fd6610c0ac1f5194a38e45a8a1e81f8a390d5142d8e4e6f26a4b3196"}]} # This file was automatically generated by gh-aw (v0.86.2). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # @@ -1124,7 +1124,6 @@ jobs: runs-on: ubuntu-latest environment: copilot-pat-pool permissions: - actions: read contents: read issues: write pull-requests: write @@ -1358,23 +1357,6 @@ jobs: setupGlobals(core, github, context, exec, io, getOctokit); const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_agent_failure.cjs'); await main(); - - name: Report failed jobs - id: report_failed_jobs - if: always() - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} - GH_AW_WORKFLOW_NAME: "Full issue-label triage" - GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-triage.md" - GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - GH_AW_REPORT_FAILED_JOBS: "true" - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/report_failed_jobs.cjs'); - await main(); detection: needs: diff --git a/.github/workflows/issue-triage.md b/.github/workflows/issue-triage.md index 938c53d2c45a..649421e9f5a1 100644 --- a/.github/workflows/issue-triage.md +++ b/.github/workflows/issue-triage.md @@ -314,6 +314,7 @@ safe-outputs: report-incomplete: create-issue: false report-failure-as-issue: false + report-failed-jobs: false steps: - name: Checkout trusted triage validator uses: actions/checkout@v7.0.1 From ada0dbe3316b3955a693041ad5a0b72061a01c00 Mon Sep 17 00:00:00 2001 From: Jakub Florkowski Date: Wed, 7 Oct 2026 22:19:32 +0200 Subject: [PATCH 3/4] Verify exact label outcomes before resolving triage commands Require trusted validated additions to be present and removals absent on the freshly fetched issue, rejecting invalid label shapes and partial native removals. Preserve empty deltas for genuine no-op completion. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/docs/issue-triage.md | 4 ++++ .github/scripts/IssueTriage.ps1 | 40 +++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/.github/docs/issue-triage.md b/.github/docs/issue-triage.md index f4a5b65e88b0..582afdc0ec16 100644 --- a/.github/docs/issue-triage.md +++ b/.github/docs/issue-triage.md @@ -9,6 +9,10 @@ After successful validation and native safe-output processing, the exact authorized triggering slash-command comment collapses as **resolved**, including successful no-change and withheld-only results. A separate trusted completion job rechecks the open issue, unchanged human command and caller's current write access. +It also requires every trusted validated addition to be present and every removal +to be absent in the freshly fetched issue's exact canonical label names, not just +successful native operation counts. Invalid label responses, partial removals or +concurrent label reversals keep the command visible without changing any labels. Failed, cancelled, deferred, skipped, warning, partial or incomplete outcomes leave the command visible. Manual dispatches (including staged runs), edited/replayed commands, bot comments and unrelated comments are never minimized. A minimization diff --git a/.github/scripts/IssueTriage.ps1 b/.github/scripts/IssueTriage.ps1 index 273873272e57..38596b86e8e9 100644 --- a/.github/scripts/IssueTriage.ps1 +++ b/.github/scripts/IssueTriage.ps1 @@ -263,6 +263,45 @@ function Complete-TriageRequest { $issue.state -cne 'open' -or $issue.ContainsKey('pull_request')) { throw 'The completion target is no longer the exact open issue.' } + $requestedNames = [Collections.Generic.HashSet[string]]::new([StringComparer]::Ordinal) + $expectedOperations = 0 + foreach ($field in @('requestedAdditions', 'requestedRemovals')) { + if ($validation[$field] -isnot [array] -or $validation[$field].Count -gt 10) { + throw 'The trusted validation receipt has an invalid exact label delta.' + } + if ($validation[$field].Count -gt 0) { $expectedOperations++ } + foreach ($name in $validation[$field]) { + if ($name -isnot [string] -or [string]::IsNullOrWhiteSpace($name) -or + $name.Length -gt 100 -or -not $requestedNames.Add($name)) { + throw 'The trusted validation receipt has invalid, duplicate or opposing label names.' + } + } + } + if (($validation.status -ceq 'noop' -and $requestedNames.Count -ne 0) -or + [Math]::Max(1, $expectedOperations) -ne $ProcessedOperations) { + throw 'The trusted exact label delta does not match the completed native operations.' + } + if ($issue.labels -isnot [array]) { + throw 'The current issue response does not contain a valid label array; leaving the command visible.' + } + $actualNames = [Collections.Generic.HashSet[string]]::new([StringComparer]::Ordinal) + foreach ($label in $issue.labels) { + if ($label -isnot [Collections.IDictionary] -or $label.name -isnot [string] -or + [string]::IsNullOrWhiteSpace($label.name) -or $label.name.Length -gt 100 -or + -not $actualNames.Add($label.name)) { + throw 'The current issue response contains invalid or duplicate label objects; leaving the command visible.' + } + } + foreach ($name in $validation.requestedAdditions) { + if (-not $actualNames.Contains($name)) { + throw 'A validated requested addition is absent from the current issue; leaving the command visible.' + } + } + foreach ($name in $validation.requestedRemovals) { + if ($actualNames.Contains($name)) { + throw 'A validated requested removal is still present on the current issue; leaving the command visible.' + } + } $command = Get-Api "repos/$Repository/issues/comments/$CommandCommentId" if ($command.id -ne $CommandCommentId -or $command.node_id -cne $event.comment.node_id -or $command.user.type -cne 'User' -or $command.user.login -cne $Actor -or @@ -1623,6 +1662,7 @@ $items = @($payload.items) if ($items.Count -eq 1 -and $items[0].type -in @('noop', 'report_incomplete', 'missing_tool')) { Write-Json 'validation.json' @{ status = $items[0].type; contextHash = $current.contextHash; writes = 0 + requestedAdditions = @(); requestedRemovals = @() completion = Get-TriageCompletionReceipt 1 $payload } if ($items[0].type -ne 'noop') { throw 'Triage is incomplete; inspect the agent result, resolve the missing evidence, and rerun.' } From 79d289d7baada3a2ff68f5a3bf7b444944274dc0 Mon Sep 17 00:00:00 2001 From: Jakub Florkowski Date: Wed, 7 Oct 2026 23:20:26 +0200 Subject: [PATCH 4/4] Clarify point-in-time triage label verification Document that unmet label state in the fetched snapshot prevents command minimization, but later concurrent label changes are not atomically excluded. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/docs/issue-triage.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/docs/issue-triage.md b/.github/docs/issue-triage.md index 582afdc0ec16..a2611e0ad755 100644 --- a/.github/docs/issue-triage.md +++ b/.github/docs/issue-triage.md @@ -11,8 +11,11 @@ successful no-change and withheld-only results. A separate trusted completion jo rechecks the open issue, unchanged human command and caller's current write access. It also requires every trusted validated addition to be present and every removal to be absent in the freshly fetched issue's exact canonical label names, not just -successful native operation counts. Invalid label responses, partial removals or -concurrent label reversals keep the command visible without changing any labels. +successful native operation counts. This is a point-in-time postcondition check: +malformed or unmet label state detected in that fetched snapshot keeps the command +visible without changing any labels. The subsequent command checks and separate +minimization mutation are not atomic with the label read; a concurrent label change +after that snapshot can still occur before the command collapses. Failed, cancelled, deferred, skipped, warning, partial or incomplete outcomes leave the command visible. Manual dispatches (including staged runs), edited/replayed commands, bot comments and unrelated comments are never minimized. A minimization