From f3239b9accf0ba5b65a56827e4f2d391397c19c6 Mon Sep 17 00:00:00 2001 From: Cheena Malhotra Date: Thu, 5 Nov 2026 14:34:00 -0700 Subject: [PATCH] Remove label management from issue triage Keep triage comment-only and use the latest summary for author follow-ups. Update validation, regressions, and the generated workflow. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/scripts/tests/README.md | 16 +- .../tests/validate-triage-output.test.cjs | 179 ++++-------------- .github/scripts/validate-triage-output.cjs | 88 ++------- .github/workflows/issue-triage.lock.yml | 54 +----- .github/workflows/issue-triage.md | 92 +++------ 5 files changed, 94 insertions(+), 335 deletions(-) diff --git a/.github/scripts/tests/README.md b/.github/scripts/tests/README.md index b737cb0130..4255e632d4 100644 --- a/.github/scripts/tests/README.md +++ b/.github/scripts/tests/README.md @@ -39,7 +39,7 @@ node --test .github/scripts/tests/validate-triage-output.test.cjs ``` These tests also run in `verify-aw-lock.yml`. They cover the validation gate -before triage comments and labels are published: complete summaries, explicit +before triage comments are published: complete summaries, explicit no-op/failure results, placeholder comments, unfinished templates, quoted/fenced examples, duplicate comments, and mixed success/incomplete outcomes. They also reject partial safe-output batches with recorded errors while @@ -47,19 +47,19 @@ allowing C# generic type syntax in completed summaries. Draft prefixes such as `TODO:` and `TBD:` are rejected in required fields and list items; ordinary mentions of those markers within completed prose remain valid. Coverage also includes multiline template placeholders and contradictory -no-op/incomplete results. Label operations queued before the summary are moved -after it, because safe outputs publish in queue order; the reordered batch must -still pass validation before it is written back to `GH_AW_AGENT_OUTPUT` for -publication, and the compiled workflow is checked for that wiring. +no-op/incomplete results. Label operations are rejected in every queue position, +with or without a summary. Validation leaves `GH_AW_AGENT_OUTPUT` unchanged, +and the compiled workflow is checked for that wiring and the absence of label tools. Comparison operators in completed prose remain valid; angle-bracket detection targets known template fields and instructions rather than arbitrary bracketed text. Generic arguments such as `Task` and `List`, including nested types, and XML documentation tags are covered by acceptance regressions. The summary heading must start at the beginning of the body; leading indentation cannot turn a code-block heading into an accepted Markdown heading. -Initial and follow-up summaries must queue exactly one Waiting for Author label -operation matching the Environment row; on-demand summaries must leave labels -unchanged. Tests also reject diagnostic placeholders within required fields, +Initial, follow-up, and on-demand summaries require no label operations, +regardless of the Environment row. Author follow-ups use the latest workflow +summary to determine whether environment details are still missing, not labels. +Tests also reject diagnostic placeholders within required fields, duplicate required rows/sections, and unfinished content in additional prose. ## Shell script tests diff --git a/.github/scripts/tests/validate-triage-output.test.cjs b/.github/scripts/tests/validate-triage-output.test.cjs index 8726017780..2d04992adc 100644 --- a/.github/scripts/tests/validate-triage-output.test.cjs +++ b/.github/scripts/tests/validate-triage-output.test.cjs @@ -9,7 +9,6 @@ const os = require('node:os'); const path = require('node:path'); const { test } = require('node:test'); const { - normalizeTriageOutput, validateTriageOutput, validateTriageOutputFile, } = require('../validate-triage-output.cjs'); @@ -33,15 +32,8 @@ Cancellation leaves the operation running. Investigate the async cancellation pa - Ask the author for their SQL Server version. `; -const waitingLabel = 'Auto-Triage: Waiting for Author'; const output = (body) => ({ - items: [ - { type: 'add_comment', body }, - ...(!body.includes('Triage Summary (on-demand re-triage)') ? [{ - type: /\| Environment \| (?:Missing:|.*Partial:)/.test(body) ? 'add_labels' : 'remove_labels', - labels: [waitingLabel], - }] : []), - ], + items: [{ type: 'add_comment', body }], errors: [], }); @@ -52,115 +44,41 @@ test('accepts initial, follow-up, and on-demand summaries with multiline content validateTriageOutput(output(summary.replaceAll('\n', '\r\n'))); }); -test('accepts a summary followed by an allowed label operation', () => { - for (const type of ['add_labels', 'remove_labels']) { - const body = type === 'add_labels' ? summary : - summary.replace('Missing: SQL Server version', 'All required environment details provided'); - const value = output(body); - validateTriageOutput(value); - } -}); - -test('rejects label operations before the summary', () => { - for (const type of ['add_labels', 'remove_labels']) { - const value = output(summary); - value.items.unshift({ type, labels: ['Auto-Triage: Waiting for Author'] }); - assert.throws(() => validateTriageOutput(value), /before/); - } -}); - -// The agent queued its label change first in the failed runs for #4855, #4879, #4904, #4940, -// #4953, #4965, and #4969, so the gate rejected otherwise complete summaries. -const labelFirst = (type) => { - const body = type === 'add_labels' ? summary : - summary.replace('Missing: SQL Server version', 'All required environment details provided'); - return { - items: [{ type, labels: [waitingLabel] }, { type: 'add_comment', body }], - errors: [], - }; -}; - -test('queues a label operation recorded before the summary after it', () => { - for (const type of ['add_labels', 'remove_labels']) { - // Arrange - const value = labelFirst(type); - const queued = structuredClone(value); - - // Act - const normalized = normalizeTriageOutput(value); - - // Assert - // The summary is published first, and the reordered batch passes the gate. - assert.deepEqual(normalized.items, [queued.items[1], queued.items[0]]); - assert.deepEqual(normalized.errors, []); - validateTriageOutput(normalized); - // The queued batch is not mutated. - assert.deepEqual(value, queued); - } -}); - -test('leaves batches without one summary or an early label operation unchanged', () => { - const label = { type: 'add_labels', labels: [waitingLabel] }; - const comment = output(summary).items[0]; - for (const value of [ - null, - {}, - { items: null }, - { items: [null, comment] }, - output(summary), - { items: [{ type: 'noop', reason: 'No new information' }] }, - { items: [label] }, - { items: [label, comment, comment] }, - ]) { - // Act - const normalized = normalizeTriageOutput(value); - - // Assert - assert.equal(normalized, value); - } -}); - -test('still rejects invalid batches after queueing labels after the summary', () => { - const label = { type: 'add_labels', labels: [waitingLabel] }; +test('rejects label operations before or after a summary and without one', () => { + // Arrange const comment = output(summary).items[0]; - for (const [items, message] of [ - [[label, label, comment], /exactly one/], - [[label, { type: 'add_comment', body: 'test simple body' }], /Triage Summary/], - [[{ type: 'remove_labels', labels: [waitingLabel] }, comment], /add_labels/], - [[{ ...label, labels: ['Unrelated label'] }, comment], /label/i], - ]) { - // Act and Assert - assert.throws(() => validateTriageOutput(normalizeTriageOutput({ items })), message); + for (const type of ['add_labels', 'remove_labels']) { + const label = { type, labels: ['Any label'] }; + for (const items of [ + [label, comment], + [comment, label], + [label], + [{ type: 'noop', reason: 'No new information' }, label], + [{ type: 'report_incomplete', reason: 'Context unavailable' }, label], + ]) { + // Act and Assert + assert.throws(() => validateTriageOutput({ items }), /cannot change issue labels/); + } } }); -test('rewrites the queued batch file only after a reordered batch passes validation', () => { +test('validates the queued batch without rewriting its file', () => { // Arrange const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'triage-output-')); const filename = path.join(directory, 'agent_output.json'); try { - for (const type of ['add_labels', 'remove_labels']) { - // Act - const value = labelFirst(type); - fs.writeFileSync(filename, JSON.stringify(value)); - const reordered = validateTriageOutputFile(filename); - - // Assert - assert.equal(reordered, true); - assert.deepEqual(JSON.parse(fs.readFileSync(filename, 'utf8')).items, - [value.items[1], value.items[0]]); - } + const queued = JSON.stringify(output(summary), null, 2); + fs.writeFileSync(filename, queued); - // An already ordered batch is validated without rewriting the file. - const ordered = JSON.stringify(output(summary), null, 2); - fs.writeFileSync(filename, ordered); - assert.equal(validateTriageOutputFile(filename), false); - assert.equal(fs.readFileSync(filename, 'utf8'), ordered); + // Act + validateTriageOutputFile(filename); + + // Assert + assert.equal(fs.readFileSync(filename, 'utf8'), queued); // A rejected batch leaves the queued file unchanged. const invalid = JSON.stringify({ - items: [{ type: 'add_labels', labels: [waitingLabel] }, - { type: 'add_comment', body: 'test simple body' }], + items: [{ type: 'add_comment', body: 'test simple body' }], }); fs.writeFileSync(filename, invalid); assert.throws(() => validateTriageOutputFile(filename), /Triage Summary/); @@ -171,12 +89,12 @@ test('rewrites the queued batch file only after a reordered batch passes validat } }); -test('command line validation rewrites the batch that safe outputs publish', () => { +test('command line validation accepts a comment-only batch without rewriting it', () => { // Arrange const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'triage-output-')); const filename = path.join(directory, 'agent_output.json'); - const value = labelFirst('add_labels'); - fs.writeFileSync(filename, JSON.stringify(value)); + const queued = JSON.stringify(output(summary), null, 2); + fs.writeFileSync(filename, queued); try { // Act const result = spawnSync(process.execPath, @@ -185,28 +103,28 @@ test('command line validation rewrites the batch that safe outputs publish', () // Assert assert.equal(result.status, 0, result.stderr); - assert.match(result.stdout, /Queued label changes after the triage summary/); - assert.deepEqual(JSON.parse(fs.readFileSync(filename, 'utf8')).items, - [value.items[1], value.items[0]]); + assert.match(result.stdout, /Triage output validated before safe-output publication/); + assert.equal(fs.readFileSync(filename, 'utf8'), queued); } finally { // Cleanup fs.rmSync(directory, { recursive: true, force: true }); } }); -test('the compiled workflow validates and rewrites the batch before publishing it', () => { +test('the compiled workflow validates the batch before publishing without label tools', () => { // Arrange const workflow = fs.readFileSync( path.join(__dirname, '..', '..', 'workflows', 'issue-triage.lock.yml'), 'utf8'); // Act const validate = workflow.indexOf('name: Validate triage output before publishing'); - const rewrite = workflow.indexOf('validateTriageOutputFile(filename)', validate); + const validationCall = workflow.indexOf('validateTriageOutputFile(filename)', validate); const publish = workflow.indexOf('name: Process Safe Outputs', validate); // Assert - assert.ok(validate >= 0 && rewrite > validate && publish > rewrite); + assert.ok(validate >= 0 && validationCall > validate && publish > validationCall); assert.doesNotMatch(workflow.slice(validate, publish), /validateTriageOutput\(JSON\.parse/); + assert.doesNotMatch(workflow, /add_labels|remove_labels|Auto-Triage: Waiting for Author/); }); test('preserves explicit no-op and failure reporting without a comment', () => { @@ -215,7 +133,7 @@ test('preserves explicit no-op and failure reporting without a comment', () => { } }); -test('enforces label state for initial, follow-up, and on-demand summaries', () => { +test('accepts all environment states without labels for each triage scenario', () => { for (const suffix of ['', ' (updated after author response)', ' (on-demand re-triage)']) { for (const environment of [ 'Missing: SQL Server version', @@ -225,25 +143,9 @@ test('enforces label state for initial, follow-up, and on-demand summaries', () ]) { const body = summary.replace('Triage Summary', `Triage Summary${suffix}`) .replace('Missing: SQL Server version', environment); - const onDemand = suffix.includes('on-demand'); - const expected = /Missing:|Partial:/.test(environment) ? 'add_labels' : 'remove_labels'; - const comment = { type: 'add_comment', body }; - const label = { type: expected, labels: [waitingLabel] }; - validateTriageOutput({ items: onDemand ? [comment] : [comment, label] }); - const invalid = onDemand ? [ - [comment, label], - [comment, { ...label, type: expected === 'add_labels' ? 'remove_labels' : 'add_labels' }], - ] : [ - [comment], - [comment, { ...label, type: expected === 'add_labels' ? 'remove_labels' : 'add_labels' }], - [comment, label, label], - [comment, { ...label, labels: [] }], - [comment, { ...label, labels: ['Unrelated label'] }], - [comment, { ...label, labels: [waitingLabel, 'Unrelated label'] }], - ]; - for (const items of invalid) { - assert.throws(() => validateTriageOutput({ items }), /label/i); - } + + // Act and Assert + assert.doesNotThrow(() => validateTriageOutput(output(body))); } } }); @@ -502,8 +404,7 @@ test('rejects multiple comments and mixed success/incomplete outcomes', () => { test('rejects output errors even when a complete summary is queued', () => { const value = output(summary); - value.items.push({ type: 'add_labels', labels: ['Auto-Triage: Waiting for Author'] }); - value.errors.push({ type: 'remove_labels', message: 'Label operation exceeded quota' }); + value.errors.push({ type: 'add_comment', message: 'Comment operation exceeded quota' }); assert.throws(() => validateTriageOutput(value), /errors/); assert.throws(() => validateTriageOutput({ items: [{ type: 'noop', reason: 'No new information' }], @@ -517,6 +418,6 @@ test('rejects missing output, empty results, and label-only results', () => { assert.throws(() => validateTriageOutput(value), /output|result/); } assert.throws(() => validateTriageOutput({ - items: [{ type: 'add_labels', labels: ['Auto-Triage: Waiting for Author'] }], - }), /summary/); + items: [{ type: 'add_labels', labels: ['Any label'] }], + }), /cannot change issue labels/); }); diff --git a/.github/scripts/validate-triage-output.cjs b/.github/scripts/validate-triage-output.cjs index 5e966a3030..560bf52055 100644 --- a/.github/scripts/validate-triage-output.cjs +++ b/.github/scripts/validate-triage-output.cjs @@ -2,13 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -// Pre-publication gate for issue-triage safe outputs: queue label changes after the -// summary, then reject incomplete summaries and partial batches before any queued -// comment or label change reaches GitHub. +// Pre-publication gate for comment-only triage: reject label changes, incomplete +// summaries, and partial batches before publication. const fs = require('node:fs'); -const LABEL_TYPES = ['add_labels', 'remove_labels']; - const TEMPLATE_PLACEHOLDER_PATTERN = /<([^<>]+)>/g; const TEMPLATE_FIELD_PATTERN = /^(?:list|component|(?:the\s+)?affected\s+component|missing\s+details)$/i; @@ -54,35 +51,6 @@ function meaningful(value) { !/^(?:todo|tbd|test(?: message| simple body)?(?: please ignore)?|placeholder)$/i.test(text); } -// gh-aw publishes safe outputs in queue order, and the agent may queue its label change before -// the summary. Move label changes after a single summary so validation judges the batch that -// will be published; other batches are returned unchanged for validation to judge. -function normalizeTriageOutput(output) { - const items = output?.items; - if (!Array.isArray(items) || items.some(item => !item || typeof item.type !== 'string')) { - return output; - } - const comments = items.filter(item => item.type === 'add_comment'); - if (comments.length !== 1) { - return output; - } - const commentIndex = items.indexOf(comments[0]); - const before = items.slice(0, commentIndex); - const labels = before.filter(item => LABEL_TYPES.includes(item.type)); - if (labels.length === 0) { - return output; - } - return { - ...output, - items: [ - ...before.filter(item => !LABEL_TYPES.includes(item.type)), - comments[0], - ...labels, - ...items.slice(commentIndex + 1), - ], - }; -} - function validateTriageOutput(output) { if (!output || !Array.isArray(output.items) || output.items.length === 0 || output.items.some(item => !item || typeof item.type !== 'string')) { @@ -93,7 +61,11 @@ function validateTriageOutput(output) { throw new Error('Triage output contains errors; refusing to publish a partial safe-output batch.'); } - // Explicit no-op/failure reports may proceed, but cannot accompany a summary or label changes. + if (output.items.some(item => ['add_labels', 'remove_labels'].includes(item.type))) { + throw new Error('Triage cannot change issue labels.'); + } + + // Explicit no-op/failure reports may proceed, but cannot accompany a summary. const comments = output.items.filter(item => item.type === 'add_comment'); const incomplete = output.items.some(item => ['report_incomplete', 'missing_tool', 'missing_data'].includes(item.type)); @@ -108,20 +80,11 @@ function validateTriageOutput(output) { if (!incomplete && !noop) { throw new Error('Triage output has no summary or explicit no-op/incomplete result.'); } - if (output.items.some(item => ['add_labels', 'remove_labels'].includes(item.type))) { - throw new Error('Triage cannot change labels without a validated summary.'); - } return; } if (incomplete || noop) { throw new Error('Triage cannot publish a summary alongside an incomplete or no-op result.'); } - const commentIndex = output.items.indexOf(comments[0]); - if (output.items.slice(0, commentIndex).some(item => - ['add_labels', 'remove_labels'].includes(item.type))) { - throw new Error('Triage cannot change labels before its summary comment.'); - } - const body = comments[0].body; if (typeof body !== 'string' || !/^## (?:\u{1F50D} )?Triage Summary(?: \(updated after author response\)| \(on-demand re-triage\))? *\r?\n/u.test(body)) { @@ -130,7 +93,6 @@ function validateTriageOutput(output) { // Require the workflow's five check rows and both prose sections, not merely its heading. const prose = proseOnly(body.replace(/\r\n?/g, '\n').trim()); const table = prose.split(/^### /m)[0]; - let environment; for (const field of ['Issue type', 'Environment', 'Area', 'Duplicates', 'Regression']) { const rows = table.split('\n').filter(line => line.startsWith(`| ${field} |`)); if (prose.split('\n').filter(line => line.startsWith(`| ${field} |`)).length > 1) { @@ -141,9 +103,6 @@ function validateTriageOutput(output) { if (!match || !meaningful(match[1])) { throw new Error(`Missing or unfinished triage check row: ${field}.`); } - if (field === 'Environment') { - environment = match[1].replace(/[*_`]/g, '').trim(); - } } const sections = prose.split(/^### /m).slice(1); for (const heading of ['Analysis', 'Next Steps']) { @@ -162,35 +121,12 @@ function validateTriageOutput(output) { /^(?:\s*(?:[-+]|\d+[.)])\s+)?\s*(?:test simple body|2-4 sentences:|Actionable items\.)/im.test(prose)) { throw new Error('Unfinished triage content outside the required fields.'); } - - const labels = output.items.filter(item => ['add_labels', 'remove_labels'].includes(item.type)); - const onDemand = body.split('\n', 1)[0].includes('(on-demand re-triage)'); - if (onDemand) { - if (labels.length > 0) { - throw new Error('On-demand triage must preserve label state.'); - } - } else { - const missingEnvironment = /^(?:\u26A0\uFE0F?\s*)?(?:Missing|Partial):/iu.test(environment); - const expectedType = missingEnvironment ? 'add_labels' : 'remove_labels'; - if (labels.length !== 1 || labels[0].type !== expectedType || - !Array.isArray(labels[0].labels) || labels[0].labels.length !== 1 || - labels[0].labels[0] !== 'Auto-Triage: Waiting for Author') { - throw new Error(`Triage requires exactly one ${expectedType} operation for the Waiting for Author label.`); - } - } } -// Validates the queued batch in place. Safe-output publication reads the same file, so a -// reordered batch is written back only after it passes validation. Returns true if reordered. +// Validate the exact queued batch without modifying the file used for publication. function validateTriageOutputFile(filename) { - const queued = JSON.parse(fs.readFileSync(filename, 'utf8')); - const output = normalizeTriageOutput(queued); + const output = JSON.parse(fs.readFileSync(filename, 'utf8')); validateTriageOutput(output); - if (output === queued) { - return false; - } - fs.writeFileSync(filename, JSON.stringify(output)); - return true; } if (require.main === module) { @@ -199,10 +135,8 @@ if (require.main === module) { if (!filename) { throw new Error('GH_AW_AGENT_OUTPUT is required; refusing to publish unvalidated triage output.'); } - if (validateTriageOutputFile(filename)) { - console.log('Queued label changes after the triage summary.'); - } + validateTriageOutputFile(filename); console.log('Triage output validated before safe-output publication.'); } -module.exports = { normalizeTriageOutput, validateTriageOutput, validateTriageOutputFile }; +module.exports = { validateTriageOutput, validateTriageOutputFile }; diff --git a/.github/workflows/issue-triage.lock.yml b/.github/workflows/issue-triage.lock.yml index 15ce7de50d..77ca24e95b 100644 --- a/.github/workflows/issue-triage.lock.yml +++ b/.github/workflows/issue-triage.lock.yml @@ -1,5 +1,5 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"62680070cc4bac9b2a1fcf147ff51a59c2269704af8184c319d528de70b80194","body_hash":"3b96e18888d3eed5db80c8f9ba8ff306377ed19256af3b2a6232f756c60e32ff","compiler_version":"v0.88.2","strict":true,"agent_id":"copilot","agent_model":"auto","engine_versions":{"copilot":"1.0.80"}} -# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_DEFAULT_OTLP_HEADERS","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/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"9271a1804551c0dc4fb0085a97979950aa2f8489","version":"v0.88.2"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.28.12","digest":"sha256:390051be4ed1847f774fd8980b61d3a3523574c0175d00c3fc7cdf2002a88202","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.28.12@sha256:390051be4ed1847f774fd8980b61d3a3523574c0175d00c3fc7cdf2002a88202"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.28.12","digest":"sha256:d7d533d87c80d87ff91ac0e21e9299055c3beedff1536262b97ed700fb065a32","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.28.12@sha256:d7d533d87c80d87ff91ac0e21e9299055c3beedff1536262b97ed700fb065a32"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.28.12","digest":"sha256:52c34aca98d2a6833c329f1505912a6949c4fda16618c010c979bd59ea99254f","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.28.12@sha256:52c34aca98d2a6833c329f1505912a6949c4fda16618c010c979bd59ea99254f"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.4.15","digest":"sha256:60cd97533e93d8e7be36b979c0f08a70846189bda6190f28bbd6d427bc0d9b6e","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.4.15@sha256:60cd97533e93d8e7be36b979c0f08a70846189bda6190f28bbd6d427bc0d9b6e"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:bac2192f6374d6262116399b34fc5e143d576f82719e90a18261cae7480f4d4e","pinned_image":"ghcr.io/github/gh-aw-node@sha256:bac2192f6374d6262116399b34fc5e143d576f82719e90a18261cae7480f4d4e"},{"image":"ghcr.io/github/github-mcp-server:v1.11.0","digest":"sha256:fbec75de11c255213fa08d80fb166abe73d851fff631c51c0079872967720699","pinned_image":"ghcr.io/github/github-mcp-server:v1.11.0@sha256:fbec75de11c255213fa08d80fb166abe73d851fff631c51c0079872967720699"}],"mcp_servers":[{"name":"github","tools":["get_commit","get_file_contents","get_latest_release","get_me","get_pull_request","get_pull_request_comments","get_pull_request_diff","get_pull_request_files","get_pull_request_review_comments","get_pull_request_reviews","get_pull_request_status","get_release_by_tag","get_tag","issue_read","list_branches","list_commits","list_issue_types","list_issues","list_pull_requests","list_releases","list_starred_repositories","list_tags","pull_request_read","search_code","search_issues","search_pull_requests","search_repositories"]},{"name":"safeoutputs","tools":["add_comment","add_labels","missing_data","missing_tool","noop","remove_labels"]}]} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"2cf4c0c55400fad16daa2ba53c29f1a85fc66169bf5d9d14a5dee4e3278acb58","body_hash":"3f063f01716a22301ede6c42bd294855efe4a46ebc6b63ed5383a5466a7cf068","compiler_version":"v0.88.2","strict":true,"agent_id":"copilot","agent_model":"auto","engine_versions":{"copilot":"1.0.80"}} +# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_DEFAULT_OTLP_HEADERS","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/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"9271a1804551c0dc4fb0085a97979950aa2f8489","version":"v0.88.2"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.28.12","digest":"sha256:390051be4ed1847f774fd8980b61d3a3523574c0175d00c3fc7cdf2002a88202","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.28.12@sha256:390051be4ed1847f774fd8980b61d3a3523574c0175d00c3fc7cdf2002a88202"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.28.12","digest":"sha256:d7d533d87c80d87ff91ac0e21e9299055c3beedff1536262b97ed700fb065a32","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.28.12@sha256:d7d533d87c80d87ff91ac0e21e9299055c3beedff1536262b97ed700fb065a32"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.28.12","digest":"sha256:52c34aca98d2a6833c329f1505912a6949c4fda16618c010c979bd59ea99254f","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.28.12@sha256:52c34aca98d2a6833c329f1505912a6949c4fda16618c010c979bd59ea99254f"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.4.15","digest":"sha256:60cd97533e93d8e7be36b979c0f08a70846189bda6190f28bbd6d427bc0d9b6e","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.4.15@sha256:60cd97533e93d8e7be36b979c0f08a70846189bda6190f28bbd6d427bc0d9b6e"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:bac2192f6374d6262116399b34fc5e143d576f82719e90a18261cae7480f4d4e","pinned_image":"ghcr.io/github/gh-aw-node@sha256:bac2192f6374d6262116399b34fc5e143d576f82719e90a18261cae7480f4d4e"},{"image":"ghcr.io/github/github-mcp-server:v1.11.0","digest":"sha256:fbec75de11c255213fa08d80fb166abe73d851fff631c51c0079872967720699","pinned_image":"ghcr.io/github/github-mcp-server:v1.11.0@sha256:fbec75de11c255213fa08d80fb166abe73d851fff631c51c0079872967720699"}],"mcp_servers":[{"name":"github","tools":["get_commit","get_file_contents","get_latest_release","get_me","get_pull_request","get_pull_request_comments","get_pull_request_diff","get_pull_request_files","get_pull_request_review_comments","get_pull_request_reviews","get_pull_request_status","get_release_by_tag","get_tag","issue_read","list_branches","list_commits","list_issue_types","list_issues","list_pull_requests","list_releases","list_starred_repositories","list_tags","pull_request_read","search_code","search_issues","search_pull_requests","search_repositories"]},{"name":"safeoutputs","tools":["add_comment","missing_data","missing_tool","noop"]}]} # This file was automatically generated by gh-aw (v0.88.2). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # # ___ _ _ @@ -88,8 +88,7 @@ jobs: || (github.event.comment.body != '/triage' && !startsWith(github.event.comment.body, '/triage ') - && github.event.comment.user.login == github.event.issue.user.login - && contains(github.event.issue.labels.*.name, 'Auto-Triage: Waiting for Author')) + && github.event.comment.user.login == github.event.issue.user.login) )) runs-on: ubuntu-slim permissions: @@ -294,7 +293,7 @@ jobs: GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }} GH_AW_INCLUDE_PR_CONTEXT: ${{ (github.event_name == 'issue_comment' && github.event.issue.pull_request != null) || github.event_name == 'pull_request_review_comment' || github.event_name == 'pull_request_review' }} GH_AW_PROMPT_CONTENT_0000: "\n" - GH_AW_PROMPT_CONTENT_0001: "\nTools: add_comment, add_labels, remove_labels, missing_tool, missing_data, noop\n" + GH_AW_PROMPT_CONTENT_0001: "\nTools: add_comment, missing_tool, missing_data, noop\n" GH_AW_PROMPT_CONTENT_0002: "\n" GH_AW_PROMPT_CONTENT_0003: "\nThe following GitHub context information is available for this workflow:\n{{#if github.actor}}\n- **actor**: __GH_AW_GITHUB_ACTOR__\n{{/if}}\n{{#if github.repository}}\n- **repository**: __GH_AW_GITHUB_REPOSITORY__\n{{/if}}\n{{#if github.workspace}}\n- **workspace**: __GH_AW_GITHUB_WORKSPACE__\n{{/if}}\n{{#if github.event.issue.number || (github.aw.context.item_type == 'issue' && github.aw.context.item_number)}}\n- **issue-number**: #__GH_AW_EXPR_802A9F6A__\n{{/if}}\n{{#if github.event.discussion.number || (github.aw.context.item_type == 'discussion' && github.aw.context.item_number)}}\n- **discussion-number**: #__GH_AW_EXPR_1A3A194A__\n{{/if}}\n{{#if github.event.pull_request.number || (github.aw.context.item_type == 'pull_request' && github.aw.context.item_number)}}\n- **pull-request-number**: #__GH_AW_EXPR_463A214A__\n{{/if}}\n{{#if github.event.comment.id || github.aw.context.comment_id}}\n- **comment-id**: __GH_AW_EXPR_FF1D34CE__\n{{/if}}\n{{#if github.run_id}}\n- **workflow-run-id**: __GH_AW_GITHUB_RUN_ID__\n{{/if}}\n\n\n" GH_AW_PROMPT_CONTENT_0004: "\n" @@ -561,7 +560,7 @@ jobs: env: GH_AW_FILE_ROOT: "${{ runner.temp }}/gh-aw" GH_AW_FILE_CONFIG: "{\"files\":[{\"path\":\"safeoutputs/config.json\",\"content_env\":\"GH_AW_SAFE_OUTPUTS_CONFIG\"}]}" - GH_AW_SAFE_OUTPUTS_CONFIG: "{\"add_comment\":{\"hide_older_comments\":true,\"max\":1},\"add_labels\":{\"allowed\":[\"Auto-Triage: Waiting for Author\"],\"max\":1},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"false\"},\"remove_labels\":{\"allowed\":[\"Auto-Triage: Waiting for Author\"],\"max\":1},\"report_incomplete\":{}}" + GH_AW_SAFE_OUTPUTS_CONFIG: "{\"add_comment\":{\"hide_older_comments\":true,\"max\":1},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"false\"},\"report_incomplete\":{}}" with: script: | const path = require('path'); @@ -575,9 +574,7 @@ jobs: GH_AW_TOOLS_META_JSON: | { "description_suffixes": { - "add_comment": " CONSTRAINTS: Maximum 1 comment(s) can be added. Supports reply_to_id for discussion threading.", - "add_labels": " CONSTRAINTS: Maximum 1 label(s) can be added. Only these labels are allowed: [\"Auto-Triage: Waiting for Author\"].", - "remove_labels": " CONSTRAINTS: Maximum 1 label(s) can be removed. Only these labels can be removed: [Auto-Triage: Waiting for Author]." + "add_comment": " CONSTRAINTS: Maximum 1 comment(s) can be added. Supports reply_to_id for discussion threading." }, "repo_params": {}, "dynamic_tools": [] @@ -625,22 +622,6 @@ jobs: } } }, - "add_labels": { - "defaultMax": 5, - "fields": { - "item_number": { - "issueNumberOrTemporaryId": true - }, - "labels": { - "required": true, - "type": "array" - }, - "repo": { - "type": "string", - "maxLength": 256 - } - } - }, "missing_data": { "defaultMax": 20, "fields": { @@ -698,22 +679,6 @@ jobs: } } }, - "remove_labels": { - "defaultMax": 5, - "fields": { - "item_number": { - "issueNumberOrTemporaryId": true - }, - "labels": { - "required": true, - "type": "array" - }, - "repo": { - "type": "string", - "maxLength": 256 - } - } - }, "report_incomplete": { "defaultMax": 5, "fields": { @@ -1843,10 +1808,7 @@ jobs: if (!filename) { throw new Error('Missing agent output; refusing to publish unvalidated triage output.'); } - // Publication reads this file in queue order; labels must follow the summary. - if (validateTriageOutputFile(filename)) { - core.info('Queued label changes after the triage summary.'); - } + validateTriageOutputFile(filename); core.info('Triage output validated before safe-output publication.'); - name: Process Safe Outputs id: process_safe_outputs @@ -1857,7 +1819,7 @@ jobs: GH_AW_ALLOWED_DOMAINS: "api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,s.symcb.com,s.symcd.com,security.ubuntu.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com" GITHUB_SERVER_URL: ${{ github.server_url }} GITHUB_API_URL: ${{ github.api_url }} - GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"hide_older_comments\":true,\"max\":1},\"add_labels\":{\"allowed\":[\"Auto-Triage: Waiting for Author\"],\"max\":1},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"false\"},\"remove_labels\":{\"allowed\":[\"Auto-Triage: Waiting for Author\"],\"max\":1},\"report_incomplete\":{}}" + GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"hide_older_comments\":true,\"max\":1},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"false\"},\"report_incomplete\":{}}" with: github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} script: | diff --git a/.github/workflows/issue-triage.md b/.github/workflows/issue-triage.md index 8512defd80..120c98f75d 100644 --- a/.github/workflows/issue-triage.md +++ b/.github/workflows/issue-triage.md @@ -14,17 +14,14 @@ on: # -> Initial triage. Always runs. # # 2. issue_comment.created from the issue's original author, on an issue -# (not a PR), not a bot, AND the issue currently has the label -# "Auto-Triage: Waiting for Author". -# -> Follow-up triage. The label is applied by the initial triage -# only when environment fields were missing, and removed by the -# follow-up triage once the author supplies them. Without the -# label, author comments do NOT boot the agent. +# (not a PR), not a bot. +# -> Follow-up triage. The agent checks the latest triage summary +# for missing environment fields before proceeding. # # 3. issue_comment.created whose body starts with "/triage", from a repo # OWNER, MEMBER, or COLLABORATOR (maintainer-only on-demand override). # -> On-demand triage. Bypasses the follow-up gate; produces a fresh -# triage summary regardless of label or prior summaries. +# triage summary regardless of prior summaries. if: | github.event_name == 'issues' || (github.event_name == 'issue_comment' @@ -36,8 +33,7 @@ if: | || (github.event.comment.body != '/triage' && !startsWith(github.event.comment.body, '/triage ') - && github.event.comment.user.login == github.event.issue.user.login - && contains(github.event.issue.labels.*.name, 'Auto-Triage: Waiting for Author')) + && github.event.comment.user.login == github.event.issue.user.login) )) engine: copilot @@ -77,25 +73,13 @@ safe-outputs: if (!filename) { throw new Error('Missing agent output; refusing to publish unvalidated triage output.'); } - // Publication reads this file in queue order; labels must follow the summary. - if (validateTriageOutputFile(filename)) { - core.info('Queued label changes after the triage summary.'); - } + validateTriageOutputFile(filename); core.info('Triage output validated before safe-output publication.'); # One triage summary per run. `hide-older-comments` collapses previous # summaries so only the latest is visible. add-comment: max: 1 hide-older-comments: true - # Allow the workflow to apply/remove ONLY this one internal-state label. - # The label is the YAML-level flag that lets the cheap `if:` gate above - # decide whether an author comment should boot the agent at all. - add-labels: - allowed: ["Auto-Triage: Waiting for Author"] - max: 1 - remove-labels: - allowed: ["Auto-Triage: Waiting for Author"] - max: 1 # Silently skip noop runs (e.g. random author comment with no new env info). # Without this, gh-aw auto-creates a tracking issue "[aw] No-Op Runs" and # appends a comment to it for every noop. @@ -116,28 +100,28 @@ any work, then follow the matching flow: Always proceed to the triage instructions below. 2. **Follow-up triage** — `event_name == "issue_comment"` and the comment body does NOT start with `/triage`. The workflow-level `if:` has already verified - the issue currently carries the label `Auto-Triage: Waiting for Author`, - so a prior triage flagged missing env info and the author has now responded. + the comment is from the issue author. Check the latest summary posted by + this workflow before proceeding. If there is no prior summary, or its + `Environment` row does not flag `Missing:` or `Partial:` fields, call + `noop` and stop. Treat later author comments as part of the issue body and re-validate the environment. There are three sub-cases routed by "Follow-up routing" under Instructions: - **No progress** (comment supplied no new env field, e.g. "will share - soon") → silent `noop`, label stays, no comment posted. + soon") → silent `noop`, no comment posted. - **Partial progress** (comment supplied at least one new env field but others are still missing) → post a fresh summary acknowledging what - was provided and re-asking for the rest, KEEP the label. + was provided and re-asking for the rest. - **Complete** (all required env fields are now present) → post a fresh - summary, REMOVE the label. + summary. 3. **On-demand triage** — `event_name == "issue_comment"` and the comment body starts with `/triage`. A maintainer is explicitly requesting a fresh triage. - Ignore label state and prior summary counts; proceed to the triage - instructions and produce a new summary. Do NOT change the label as part of - `/triage` runs (leave it as-is). + Ignore prior summary counts; proceed to the triage instructions and + produce a new summary. Do NOT call `add_comment` more than once per run. -Do NOT call `add_labels` or `remove_labels` for any label other than -`Auto-Triage: Waiting for Author` — that single label is the only one this -workflow is permitted to manage. +Do NOT add, remove, or otherwise change issue labels. Area classification +is a recommendation in the summary only. Do NOT post intermediate findings. Do NOT post separate comments for area detection, duplicate checking, or environment validation. Everything goes into the single triage summary at the end. @@ -159,26 +143,18 @@ submit it once through `safeoutputs add_comment .`. If preparation fails, inspect and correct it before attempting submission. Once `add_comment` has been attempted, never retry it, even if its result is ambiguous or reports an error. Report the actual error via `report_incomplete` -and stop without changing labels; do not probe with another write. Only -manage labels after the completed comment is accepted. +and stop; do not probe with another write. --- -## Label-managed state - -The workflow uses one internal-state label to decide cheaply (at the YAML -`if:` level) whether an author comment should boot the agent at all: +## Summary-based follow-up state -- **`Auto-Triage: Waiting for Author`** — present iff the most recent - triage summary flagged `⚠️ Missing:` or `⚠️ Partial:` environment fields - and we are waiting for the issue author to supply them. +The latest summary posted by this workflow determines whether we are waiting +for environment details. Read its `Environment` row, including summaries +collapsed by `hide-older-comments`; never use issue labels as triage state. -The agent (you) is responsible for keeping this label accurate — see the -"Actions" section below for exactly when to call `add_labels` / -`remove_labels`. - -Only if the workflow-level `if:` gate above evaluated to true, proceed to the -triage instructions below and produce a fresh summary. Treat the prior summary +For initial and on-demand runs, or follow-up runs that add missing details, +proceed to the triage instructions below. Treat the prior summary as **invalidated** — the new one supersedes it (the older one will be collapsed automatically by `hide-older-comments`). @@ -222,8 +198,7 @@ Then route as follows: new env field; e.g. "okay, will share details soon", a question, an unrelated remark). → Call `noop` with a short reason like `"Author commented but supplied no new env info"` and STOP. Do NOT call - `add_comment`. Do NOT change the label. The label stays so the next - author comment can re-trigger this workflow. + `add_comment`. 2. **Partial progress** — `AFTER` adds at least one new env field but is still incomplete (some required fields are still missing). → Proceed @@ -231,17 +206,15 @@ Then route as follows: `Environment` row MUST acknowledge what was just provided and list only the fields that are STILL missing, e.g. `⚠️ Partial: received SqlClient version and OS; still missing: .NET TFM, SQL Server version`. - Keep the label `Auto-Triage: Waiting for Author` on the issue (i.e. call - `add_labels` with that label — it is a no-op if already present). 3. **Complete** — `AFTER` contains every required env field. → Proceed to the full analysis below and post a fresh triage summary. The `Environment` row says `All required environment details provided for - investigation`. Call `remove_labels` with the label. + investigation`. This routing does NOT apply to initial triage (scenario 1) or on-demand `/triage` (scenario 3) — those always produce a fresh summary using the -standard label-management rules in the Actions section below. +Actions section below. ### Full analysis @@ -318,15 +291,4 @@ and severity assessment (P0-P3)> > **Note**: This triage summary is auto-generated by an AI agent. The analysis and suggestions above have not been verified by a human maintainer. Please treat as preliminary guidance only. ``` -**Then manage the label**: - -- For **on-demand `/triage` runs**, do NOT touch the label — preserve - whatever state existed before. -- For **initial triage** and **follow-up triage**, base the decision on the - `Environment` row of the summary you just posted: - - If it contains `⚠️ Missing:` or `⚠️ Partial:` → call `add_labels` with - `["Auto-Triage: Waiting for Author"]` (no-op if already present). - - Otherwise (env complete) → call `remove_labels` with - `["Auto-Triage: Waiting for Author"]` (safe to call even if absent). - If the issue is spam or no action is needed, call the `noop` tool instead. \ No newline at end of file