Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[CI] [GHA] Make CI Doctor MQ rerun failures based on its analysis (#36706)

Andrei Kashchikhinbe0ed3a84f93
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
index 2f4996cee47..d1b10c9374a 100644
--- a/.github/workflows/android.yml
+++ b/.github/workflows/android.yml
@@ -51,7 +51,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
Docker:
needs: Smart_CI
diff --git a/.github/workflows/ci-doctor-mq.lock.yml b/.github/workflows/ci-doctor-mq.lock.yml
index 5fe0ce85a42..c0730cbb321 100644
--- a/.github/workflows/ci-doctor-mq.lock.yml
+++ b/.github/workflows/ci-doctor-mq.lock.yml
@@ -1,4 +1,4 @@
-# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"fadf2e9fbc58b877f8137afa0511f7dc7d642ec373fc0dba46ba29a0b5eaf38d","body_hash":"6ae50d07f68cd93bc2607961d10b3daa0540ae48dc58c5f7dc0e853e4d836af5","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","agent_model":"claude-sonnet-4.6","engine_versions":{"copilot":"1.0.65"}}
+# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"92a2828636c9ba8348f197a5ddedf84fe5ee9a1f7de0fef9717a2c05ad519a7e","body_hash":"babe06609f3eac4b9d157b23378472b09ce242abb466b8740f12fb3bb2d8adc4","compiler_version":"v0.81.6","strict":true,"agent_id":"copilot","agent_model":"claude-sonnet-4.6","engine_versions":{"copilot":"1.0.65"}}
# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN","TEAMS_WEBHOOK_URL"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"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":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba6380cc6e5be5d21677bebe04d52fb48e3abec7","version":"v0.81.6"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11","digest":"sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.11@sha256:979723c628182da7729333f2208bb249fd25ddee579645cf9a3892d681a929c7"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11","digest":"sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.11@sha256:807e4831999b44513b0a66e5859d478dc4da7ae74ab1918cec967d513f95bf9d"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11","digest":"sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.11@sha256:ff27ea0525ad953a6adee28a5fbe9d2e22be47dbec755c15767af4ea3f91df7d"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.30","digest":"sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.30@sha256:35625d1a2269b1238606078c879f59a91cffc4ac33eb54bf39c6418822c1a8be"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.4.0","digest":"sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036","pinned_image":"ghcr.io/github/github-mcp-server:v1.4.0@sha256:2afb26356481d1a350e14544a6e160f7f7ec1561a1ea309b823665abf0309036"}]}
# This file was automatically generated by gh-aw (v0.81.6). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
#
@@ -28,6 +28,12 @@
# and sends a second escalation alert to Microsoft Teams when the same failure pattern
# has 3 or more occurrences within the last 12 hours.
#
+# Resolved workflow manifest:
+# Imports:
+# - shared/ci-doctor-mq/notify-teams-recurring.md
+# - shared/ci-doctor-mq/notify-teams.md
+# - shared/ci-doctor-mq/rerun-failed-jobs.md
+#
# Secrets used:
# - COPILOT_GITHUB_TOKEN
# - GH_AW_GITHUB_MCP_SERVER_TOKEN
@@ -286,21 +292,21 @@ jobs:
run: |
bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh"
{
- cat << 'GH_AW_PROMPT_5a82c7401dd3ed09_EOF'
+ cat << 'GH_AW_PROMPT_a5f208f87eba8f9c_EOF'
<system>
- GH_AW_PROMPT_5a82c7401dd3ed09_EOF
+ GH_AW_PROMPT_a5f208f87eba8f9c_EOF
cat "${RUNNER_TEMP}/gh-aw/prompts/xpia.md"
cat "${RUNNER_TEMP}/gh-aw/prompts/temp_folder_prompt.md"
cat "${RUNNER_TEMP}/gh-aw/prompts/markdown.md"
cat "${RUNNER_TEMP}/gh-aw/prompts/repo_memory_prompt.md"
cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_prompt.md"
- cat << 'GH_AW_PROMPT_5a82c7401dd3ed09_EOF'
+ cat << 'GH_AW_PROMPT_a5f208f87eba8f9c_EOF'
<safe-output-tools>
- Tools: add_comment, missing_tool, missing_data, noop, notify_teams, notify_teams_recurring
+ Tools: add_comment, missing_tool, missing_data, noop, notify_teams, notify_teams_recurring, rerun_failed_jobs
</safe-output-tools>
- GH_AW_PROMPT_5a82c7401dd3ed09_EOF
+ GH_AW_PROMPT_a5f208f87eba8f9c_EOF
cat "${RUNNER_TEMP}/gh-aw/prompts/mcp_cli_tools_prompt.md"
- cat << 'GH_AW_PROMPT_5a82c7401dd3ed09_EOF'
+ cat << 'GH_AW_PROMPT_a5f208f87eba8f9c_EOF'
<github-context>
The following GitHub context information is available for this workflow:
{{#if github.actor}}
@@ -329,12 +335,15 @@ jobs:
{{/if}}
</github-context>
- GH_AW_PROMPT_5a82c7401dd3ed09_EOF
+ GH_AW_PROMPT_a5f208f87eba8f9c_EOF
cat "${RUNNER_TEMP}/gh-aw/prompts/github_mcp_tools_with_safeoutputs_prompt.md"
- cat << 'GH_AW_PROMPT_5a82c7401dd3ed09_EOF'
+ cat << 'GH_AW_PROMPT_a5f208f87eba8f9c_EOF'
</system>
+ {{#runtime-import .github/workflows/shared/ci-doctor-mq/notify-teams.md}}
+ {{#runtime-import .github/workflows/shared/ci-doctor-mq/notify-teams-recurring.md}}
+ {{#runtime-import .github/workflows/shared/ci-doctor-mq/rerun-failed-jobs.md}}
{{#runtime-import .github/workflows/ci-doctor-mq.md}}
- GH_AW_PROMPT_5a82c7401dd3ed09_EOF
+ GH_AW_PROMPT_a5f208f87eba8f9c_EOF
} > "$GH_AW_PROMPT"
- name: Interpolate variables and render templates
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
@@ -594,9 +603,9 @@ jobs:
mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs"
mkdir -p /tmp/gh-aw/safeoutputs
mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs
- cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_07c7f5dbe75f87b7_EOF'
- {"add_comment":{"max":1,"target":"*"},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"notify-teams":{"description":"Send a CI failure investigation summary to Microsoft Teams. Call this exactly once at the end of the investigation with a concise title and a thorough description of the failure.","inputs":{"author":{"default":"not_found","description":"GitHub login of the PR author or commit author, if known. Omit otherwise.","required":false,"type":"string"},"db_entries":{"default":null,"description":"Total number of unique entries currently in the CI Doctor MQ investigation database (count of distinct investigation files under /tmp/gh-aw/repo-memory/default/mq/investigations/, including the one created by this run). Report as a non-negative integer encoded as a string.","required":true,"type":"string"},"description":{"default":null,"description":"Thorough markdown description of the problem: root cause, failed jobs, key error messages, and recommended actions.","required":true,"type":"string"},"failed_workflow":{"default":null,"description":"Name of the GitHub Actions workflow that failed (as reported by `get_workflow_run`, e.g. 'Linux (Ubuntu 22.04, Python 3.11)'). Do NOT pass the CI Doctor MQ workflow name.","required":true,"type":"string"},"occurrence_count":{"default":null,"description":"How many times this same issue has been recorded in the CI Doctor MQ database, including the current investigation. Compute by matching the current failure signature (normalized error message + failure category, job-agnostic) against prior investigation/pattern files under /tmp/gh-aw/repo-memory/default/mq/. Must be \u003e= 1. Report as a positive integer encoded as a string.","required":true,"type":"string"},"pipeline_url":{"default":null,"description":"URL of the failed GitHub Actions workflow run.","required":true,"type":"string"},"pr_number":{"default":"not_found","description":"Pull request number if the failure is associated with a PR in the merge queue. Omit otherwise.","required":false,"type":"string"},"pr_url":{"default":"not_found","description":"Pull request URL if the failure is associated with a PR in the merge queue. Omit otherwise.","required":false,"type":"string"},"statistics":{"default":null,"description":"Markdown-formatted statistics summary of the CI Doctor MQ pattern database. Must include a table (or list) of every known failure pattern with: pattern signature/title, total reproduction count, first-seen timestamp (UTC, ISO 8601), and last-seen timestamp (UTC, ISO 8601). Sort patterns by reproduction count descending. Compute from files under /tmp/gh-aw/repo-memory/default/mq/investigations/ and /tmp/gh-aw/repo-memory/default/mq/patterns/. Keep concise (top 20 patterns max). Use the rendering rules from the description field (tilde fences, no raw HTML).","required":true,"type":"string"},"statistics_json":{"default":null,"description":"Full statistics database serialized as a compact JSON string. Must be a JSON object of the form {\"generated_at\": \u003cISO8601 UTC\u003e, \"total_patterns\": \u003cint\u003e, \"total_investigations\": \u003cint\u003e, \"patterns\": [{\"signature\": \u003cstr\u003e, \"title\": \u003cstr\u003e, \"category\": \u003cstr\u003e, \"count\": \u003cint\u003e, \"first_seen\": \u003cISO8601 UTC\u003e, \"last_seen\": \u003cISO8601 UTC\u003e, \"recent_run_urls\": [\u003cstr\u003e, ...]}]}. Include ALL known patterns, not just the top N. This payload is uploaded as a workflow artifact for offline analysis.","required":true,"type":"string"},"title":{"default":null,"description":"Short, searchable description of the failure (e.g. 'smoke_Bucketize tests fail on comparison'). No PR/run numbers.","required":true,"type":"string"}},"output":"Notification sent to Microsoft Teams."},"notify-teams-recurring":{"description":"Send a recurring merge-queue failure escalation alert to Microsoft Teams. Call this ONLY when the same failure pattern has 3 or more occurrences in the last 12 hours. Do NOT call this for every failure.","inputs":{"affected_prs":{"default":null,"description":"Markdown-formatted list of affected PR numbers/links from the merge queue that hit this failure in the last 12 hours. One PR per line, e.g. '- [#1234](https://github.com/org/repo/pull/1234)'. Include up to 10 most recent PRs.","required":true,"type":"string"},"description":{"default":null,"description":"Concise markdown gist of the recurring problem: what keeps failing, suspected root cause, and recommended escalation actions. Use Teams-safe markdown only (no raw HTML).","required":true,"type":"string"},"failed_workflow":{"default":null,"description":"Name of the GitHub Actions workflow with the recurring failure.","required":true,"type":"string"},"pipeline_url":{"default":null,"description":"URL of the current (latest) failed workflow run.","required":true,"type":"string"},"recent_count":{"default":null,"description":"Number of times this failure pattern has occurred in the last 12 hours, including the current run. Report as a positive integer encoded as a string (e.g., '3', '5').","required":true,"type":"string"},"recent_run_urls":{"default":null,"description":"Markdown-formatted list of workflow run URLs that exhibited this failure in the last 12 hours. One URL per line, e.g. '- [Run 12345](https://github.com/org/repo/actions/runs/12345)'. Include up to 10 most recent runs.","required":true,"type":"string"},"title":{"default":null,"description":"Short, searchable description of the recurring failure pattern (same as notify_teams.title).","required":true,"type":"string"}},"output":"Recurring failure escalation sent to Microsoft Teams."},"push_repo_memory":{"memories":[{"dir":"/tmp/gh-aw/repo-memory/default","id":"default","max_file_count":500,"max_file_size":1048576,"max_patch_size":1048576}]},"report_incomplete":{}}
- GH_AW_SAFE_OUTPUTS_CONFIG_07c7f5dbe75f87b7_EOF
+ cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_a089ec2687e82813_EOF'
+ {"add_comment":{"max":1,"target":"*"},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"notify-teams":{"description":"Send a CI failure investigation summary to Microsoft Teams. Call this exactly once at the end of the investigation with a concise title and a thorough description of the failure.","inputs":{"author":{"default":"not_found","description":"GitHub login of the PR author or commit author, if known. Omit otherwise.","required":false,"type":"string"},"db_entries":{"default":null,"description":"Total number of unique entries currently in the CI Doctor MQ investigation database (count of distinct investigation files under /tmp/gh-aw/repo-memory/default/mq/investigations/, including the one created by this run). Report as a non-negative integer encoded as a string.","required":true,"type":"string"},"description":{"default":null,"description":"Thorough markdown description of the problem: root cause, failed jobs, key error messages, and recommended actions.","required":true,"type":"string"},"failed_workflow":{"default":null,"description":"Name of the GitHub Actions workflow that failed (as reported by `get_workflow_run`, e.g. 'Linux (Ubuntu 22.04, Python 3.11)'). Do NOT pass the CI Doctor MQ workflow name.","required":true,"type":"string"},"occurrence_count":{"default":null,"description":"How many times this same issue has been recorded in the CI Doctor MQ database, including the current investigation. Compute by matching the current failure signature (normalized error message + failure category, job-agnostic) against prior investigation/pattern files under /tmp/gh-aw/repo-memory/default/mq/. Must be \u003e= 1. Report as a positive integer encoded as a string.","required":true,"type":"string"},"pipeline_url":{"default":null,"description":"URL of the failed GitHub Actions workflow run.","required":true,"type":"string"},"pr_number":{"default":"not_found","description":"Pull request number if the failure is associated with a PR in the merge queue. Omit otherwise.","required":false,"type":"string"},"pr_url":{"default":"not_found","description":"Pull request URL if the failure is associated with a PR in the merge queue. Omit otherwise.","required":false,"type":"string"},"statistics":{"default":null,"description":"Markdown-formatted statistics summary of the CI Doctor MQ pattern database. Must include a table (or list) of every known failure pattern with: pattern signature/title, total reproduction count, first-seen timestamp (UTC, ISO 8601), and last-seen timestamp (UTC, ISO 8601). Sort patterns by reproduction count descending. Compute from files under /tmp/gh-aw/repo-memory/default/mq/investigations/ and /tmp/gh-aw/repo-memory/default/mq/patterns/. Keep concise (top 20 patterns max). Use the rendering rules from the description field (tilde fences, no raw HTML).","required":true,"type":"string"},"statistics_json":{"default":null,"description":"Full statistics database serialized as a compact JSON string. Must be a JSON object of the form {\"generated_at\": \u003cISO8601 UTC\u003e, \"total_patterns\": \u003cint\u003e, \"total_investigations\": \u003cint\u003e, \"patterns\": [{\"signature\": \u003cstr\u003e, \"title\": \u003cstr\u003e, \"category\": \u003cstr\u003e, \"count\": \u003cint\u003e, \"first_seen\": \u003cISO8601 UTC\u003e, \"last_seen\": \u003cISO8601 UTC\u003e, \"recent_run_urls\": [\u003cstr\u003e, ...]}]}. Include ALL known patterns, not just the top N. This payload is uploaded as a workflow artifact for offline analysis.","required":true,"type":"string"},"title":{"default":null,"description":"Short, searchable description of the failure (e.g. 'smoke_Bucketize tests fail on comparison'). No PR/run numbers.","required":true,"type":"string"}},"output":"Notification sent to Microsoft Teams."},"notify-teams-recurring":{"description":"Send a recurring merge-queue failure escalation alert to Microsoft Teams. Call this ONLY when the same failure pattern has 3 or more occurrences in the last 12 hours. Do NOT call this for every failure.","inputs":{"affected_prs":{"default":null,"description":"Markdown-formatted list of affected PR numbers/links from the merge queue that hit this failure in the last 12 hours. One PR per line, e.g. '- [#1234](https://github.com/org/repo/pull/1234)'. Include up to 10 most recent PRs.","required":true,"type":"string"},"description":{"default":null,"description":"Concise markdown gist of the recurring problem: what keeps failing, suspected root cause, and recommended escalation actions. Use Teams-safe markdown only (no raw HTML).","required":true,"type":"string"},"failed_workflow":{"default":null,"description":"Name of the GitHub Actions workflow with the recurring failure.","required":true,"type":"string"},"pipeline_url":{"default":null,"description":"URL of the current (latest) failed workflow run.","required":true,"type":"string"},"recent_count":{"default":null,"description":"Number of times this failure pattern has occurred in the last 12 hours, including the current run. Report as a positive integer encoded as a string (e.g., '3', '5').","required":true,"type":"string"},"recent_run_urls":{"default":null,"description":"Markdown-formatted list of workflow run URLs that exhibited this failure in the last 12 hours. One URL per line, e.g. '- [Run 12345](https://github.com/org/repo/actions/runs/12345)'. Include up to 10 most recent runs.","required":true,"type":"string"},"title":{"default":null,"description":"Short, searchable description of the recurring failure pattern (same as notify_teams.title).","required":true,"type":"string"}},"output":"Recurring failure escalation sent to Microsoft Teams."},"push_repo_memory":{"memories":[{"dir":"/tmp/gh-aw/repo-memory/default","id":"default","max_file_count":500,"max_file_size":1048576,"max_patch_size":1048576}]},"report_incomplete":{},"rerun-failed-jobs":{"description":"Re-run ONLY the failed jobs of the analysed workflow run. Call this at most once and ONLY when the investigation concludes the failure is transient and a plain restart is likely to fix it (e.g. Infrastructure, Flaky Test, Network, or External Service categories such as runner hiccups, network timeouts, or downstream outages). Do NOT call for deterministic Code Issue / Dependencies / Configuration failures that a restart cannot fix.","inputs":{"reason":{"default":null,"description":"Short justification for why a restart is expected to remedy the failure (e.g. 'network timeout while downloading dependencies').","required":true,"type":"string"},"repository":{"default":"not_found","description":"The owner/repo of the repository that owns the analysed run (e.g. 'openvinotoolkit/openvino'). Defaults to the current repository when omitted.","required":false,"type":"string"},"run_id":{"default":null,"description":"Numeric ID of the GitHub Actions workflow run whose failed jobs should be re-run. This is the run that was investigated (github.event.workflow_run.id for merge-queue triggers, or the run_id input for workflow_dispatch). Report as a numeric string.","required":true,"type":"string"}},"output":"Failed jobs re-run requested for the analysed workflow run."}}
+ GH_AW_SAFE_OUTPUTS_CONFIG_a089ec2687e82813_EOF
- name: Generate Safe Outputs Tools
env:
GH_AW_TOOLS_META_JSON: |
@@ -719,6 +728,33 @@ jobs:
"type": "object"
},
"name": "notify_teams_recurring"
+ },
+ {
+ "description": "Re-run ONLY the failed jobs of the analysed workflow run. Call this at most once and ONLY when the investigation concludes the failure is transient and a plain restart is likely to fix it (e.g. Infrastructure, Flaky Test, Network, or External Service categories such as runner hiccups, network timeouts, or downstream outages). Do NOT call for deterministic Code Issue / Dependencies / Configuration failures that a restart cannot fix.",
+ "inputSchema": {
+ "additionalProperties": false,
+ "properties": {
+ "reason": {
+ "description": "Short justification for why a restart is expected to remedy the failure (e.g. 'network timeout while downloading dependencies').",
+ "type": "string"
+ },
+ "repository": {
+ "default": "not_found",
+ "description": "The owner/repo of the repository that owns the analysed run (e.g. 'openvinotoolkit/openvino'). Defaults to the current repository when omitted.",
+ "type": "string"
+ },
+ "run_id": {
+ "description": "Numeric ID of the GitHub Actions workflow run whose failed jobs should be re-run. This is the run that was investigated (github.event.workflow_run.id for merge-queue triggers, or the run_id input for workflow_dispatch). Report as a numeric string.",
+ "type": "string"
+ }
+ },
+ "required": [
+ "reason",
+ "run_id"
+ ],
+ "type": "object"
+ },
+ "name": "rerun_failed_jobs"
}
]
}
@@ -1202,6 +1238,7 @@ jobs:
- notify_teams
- notify_teams_recurring
- push_repo_memory
+ - rerun_failed_jobs
- safe_outputs
if: >
always() && (needs.agent.result != 'skipped' || needs.activation.outputs.lockdown_check_failed == 'true' ||
@@ -1820,7 +1857,7 @@ jobs:
if-no-files-found: ignore
name: ci-doctor-mq-statistics
path: ${{ runner.temp }}/ci-doctor-mq-stats
- retention-days: 90
+ retention-days: 90.0
notify_teams_recurring:
needs:
@@ -2024,6 +2061,78 @@ jobs:
const { main } = require('${{ runner.temp }}/gh-aw/actions/push_repo_memory.cjs');
await main();
+ rerun_failed_jobs:
+ needs:
+ - agent
+ - detection
+ if: (!cancelled()) && needs.agent.result != 'skipped' && contains(needs.agent.outputs.output_types, 'rerun_failed_jobs')
+ runs-on: ubuntu-latest
+ permissions:
+ actions: write
+ steps:
+ - name: Download agent output artifact
+ continue-on-error: true
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+ with:
+ name: agent
+ path: ${{ runner.temp }}/gh-aw/safe-jobs/
+ - name: Re-run failed jobs
+ run: |
+ set -euo pipefail
+
+ if [ ! -f "${GH_AW_AGENT_OUTPUT:-}" ]; then
+ echo "No agent output found at GH_AW_AGENT_OUTPUT" >&2
+ exit 1
+ fi
+
+ ITEM=$(jq -c '[.items[] | select(.type == "rerun_failed_jobs")] | last' "$GH_AW_AGENT_OUTPUT")
+ if [ -z "$ITEM" ] || [ "$ITEM" = "null" ]; then
+ echo "No rerun_failed_jobs item present in agent output" >&2
+ exit 1
+ fi
+
+ RUN_ID=$(echo "$ITEM" | jq -r '.run_id // ""')
+ REPOSITORY=$(echo "$ITEM" | jq -r '.repository // ""')
+ REASON=$(echo "$ITEM" | jq -r '.reason // ""')
+
+ # Validate run_id is purely numeric to avoid API path injection.
+ if ! printf '%s' "$RUN_ID" | grep -Eq '^[0-9]+$'; then
+ echo "run_id must be a numeric string, got: '$RUN_ID'" >&2
+ exit 1
+ fi
+
+ # Fall back to the current repository when none was supplied.
+ if [ -z "$REPOSITORY" ] || [ "$REPOSITORY" = "not_found" ]; then
+ REPOSITORY="${GITHUB_REPOSITORY}"
+ fi
+
+ # Validate repository is in owner/repo form to avoid API path injection.
+ if ! printf '%s' "$REPOSITORY" | grep -Eq '^[A-Za-z0-9._-]+/[A-Za-z0-9._-]+$'; then
+ echo "repository must be in owner/repo format, got: '$REPOSITORY'" >&2
+ exit 1
+ fi
+
+ echo "Requested re-run of failed jobs for $REPOSITORY run $RUN_ID (reason: $REASON)"
+
+ # Guard against restart loops: if the run has already been attempted
+ # more than once, do not re-run it again (mirrors rerunner.py).
+ ATTEMPT=$(gh api "repos/${REPOSITORY}/actions/runs/${RUN_ID}" --jq '.run_attempt')
+ if [ "${ATTEMPT:-1}" -gt 1 ]; then
+ echo "Run $RUN_ID already has $ATTEMPT attempts; not re-running to avoid loops."
+ exit 0
+ fi
+
+ # Re-run ONLY the failed jobs of the analysed run.
+ gh api \
+ --method POST \
+ -H "Accept: application/vnd.github+json" \
+ "repos/${REPOSITORY}/actions/runs/${RUN_ID}/rerun-failed-jobs"
+
+ echo "Successfully requested re-run of failed jobs for $REPOSITORY run $RUN_ID."
+ env:
+ GH_AW_AGENT_OUTPUT: ${{ runner.temp }}/gh-aw/safe-jobs/agent_output.json
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
safe_outputs:
needs:
- activation
@@ -2108,7 +2217,7 @@ jobs:
GH_AW_ALLOWED_DOMAINS: "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,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,github.com,host.docker.internal,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,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.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_OUTPUT_JOBS: "{\"notify_teams\":\"\",\"notify_teams_recurring\":\"\"}"
+ GH_AW_SAFE_OUTPUT_JOBS: "{\"notify_teams\":\"\",\"notify_teams_recurring\":\"\",\"rerun_failed_jobs\":\"\"}"
GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":1,\"target\":\"*\"},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"true\"},\"report_incomplete\":{}}"
with:
github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/ci-doctor-mq.md b/.github/workflows/ci-doctor-mq.md
index d447baa56b0..b594cf3167a 100644
--- a/.github/workflows/ci-doctor-mq.md
+++ b/.github/workflows/ci-doctor-mq.md
@@ -45,282 +45,15 @@ engine:
network: defaults
+imports:
+ - shared/ci-doctor-mq/notify-teams.md
+ - shared/ci-doctor-mq/notify-teams-recurring.md
+ - shared/ci-doctor-mq/rerun-failed-jobs.md
+
safe-outputs:
add-comment:
max: 1 # at most one remediation comment per investigation
target: "*" # workflow_run trigger has no PR context; agent supplies the PR number
- jobs:
- notify-teams:
- description: "Send a CI failure investigation summary to Microsoft Teams. Call this exactly once at the end of the investigation with a concise title and a thorough description of the failure."
- runs-on: ubuntu-latest
- output: "Notification sent to Microsoft Teams."
- permissions:
- contents: read
- inputs:
- title:
- description: "Short, searchable description of the failure (e.g. 'smoke_Bucketize tests fail on comparison'). No PR/run numbers."
- required: true
- type: string
- failed_workflow:
- description: "Name of the GitHub Actions workflow that failed (as reported by `get_workflow_run`, e.g. 'Linux (Ubuntu 22.04, Python 3.11)'). Do NOT pass the CI Doctor MQ workflow name."
- required: true
- type: string
- pipeline_url:
- description: "URL of the failed GitHub Actions workflow run."
- required: true
- type: string
- description:
- description: "Thorough markdown description of the problem: root cause, failed jobs, key error messages, and recommended actions."
- required: true
- type: string
- pr_number:
- description: "Pull request number if the failure is associated with a PR in the merge queue. Omit otherwise."
- required: false
- type: string
- default: "not_found"
- pr_url:
- description: "Pull request URL if the failure is associated with a PR in the merge queue. Omit otherwise."
- required: false
- type: string
- default: "not_found"
- author:
- description: "GitHub login of the PR author or commit author, if known. Omit otherwise."
- required: false
- type: string
- default: "not_found"
- db_entries:
- description: "Total number of unique entries currently in the CI Doctor MQ investigation database (count of distinct investigation files under /tmp/gh-aw/repo-memory/default/mq/investigations/, including the one created by this run). Report as a non-negative integer encoded as a string."
- required: true
- type: string
- occurrence_count:
- description: "How many times this same issue has been recorded in the CI Doctor MQ database, including the current investigation. Compute by matching the current failure signature (normalized error message + failure category, job-agnostic) against prior investigation/pattern files under /tmp/gh-aw/repo-memory/default/mq/. Must be >= 1. Report as a positive integer encoded as a string."
- required: true
- type: string
- statistics:
- description: "Markdown-formatted statistics summary of the CI Doctor MQ pattern database. Must include a table (or list) of every known failure pattern with: pattern signature/title, total reproduction count, first-seen timestamp (UTC, ISO 8601), and last-seen timestamp (UTC, ISO 8601). Sort patterns by reproduction count descending. Compute from files under /tmp/gh-aw/repo-memory/default/mq/investigations/ and /tmp/gh-aw/repo-memory/default/mq/patterns/. Keep concise (top 20 patterns max). Use the rendering rules from the description field (tilde fences, no raw HTML)."
- required: true
- type: string
- statistics_json:
- description: "Full statistics database serialized as a compact JSON string. Must be a JSON object of the form {\"generated_at\": <ISO8601 UTC>, \"total_patterns\": <int>, \"total_investigations\": <int>, \"patterns\": [{\"signature\": <str>, \"title\": <str>, \"category\": <str>, \"count\": <int>, \"first_seen\": <ISO8601 UTC>, \"last_seen\": <ISO8601 UTC>, \"recent_run_urls\": [<str>, ...]}]}. Include ALL known patterns, not just the top N. This payload is uploaded as a workflow artifact for offline analysis."
- required: true
- type: string
- steps:
- - name: Send Teams notification
- env:
- TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }}
- RUN_URL: ${{ github.event.workflow_run.html_url || github.event.inputs.link || '' }}
- run: |
- set -euo pipefail
-
- if [ -z "${TEAMS_WEBHOOK_URL:-}" ]; then
- echo "TEAMS_WEBHOOK_URL secret is not configured" >&2
- exit 1
- fi
-
- if [ ! -f "${GH_AW_AGENT_OUTPUT:-}" ]; then
- echo "No agent output found at GH_AW_AGENT_OUTPUT" >&2
- exit 1
- fi
-
- ITEM=$(jq -c '[.items[] | select(.type == "notify_teams")] | last' "$GH_AW_AGENT_OUTPUT")
- if [ -z "$ITEM" ] || [ "$ITEM" = "null" ]; then
- echo "No notify_teams item present in agent output" >&2
- exit 1
- fi
-
- TITLE=$(echo "$ITEM" | jq -r '.title // ""')
- FAILED_WORKFLOW=$(echo "$ITEM" | jq -r '.failed_workflow // ""')
- PIPELINE_URL=$(echo "$ITEM" | jq -r '.pipeline_url // ""')
- DESCRIPTION=$(echo "$ITEM" | jq -r '.description // ""')
- PR_NUMBER=$(echo "$ITEM" | jq -r '.pr_number // ""')
- PR_URL=$(echo "$ITEM" | jq -r '.pr_url // ""')
- AUTHOR=$(echo "$ITEM" | jq -r '.author // ""')
- DB_ENTRIES=$(echo "$ITEM" | jq -r '.db_entries // ""')
- OCCURRENCES=$(echo "$ITEM" | jq -r '.occurrence_count // ""')
- STATISTICS=$(echo "$ITEM" | jq -r '.statistics // ""')
- STATISTICS_JSON=$(echo "$ITEM" | jq -r '.statistics_json // ""')
-
- # Persist the full statistics database as a workflow artifact for offline review.
- STATS_DIR="${RUNNER_TEMP:-/tmp}/ci-doctor-mq-stats"
- mkdir -p "$STATS_DIR"
- if [ -n "$STATISTICS_JSON" ]; then
- # Validate and pretty-print; fall back to raw on parse error.
- if echo "$STATISTICS_JSON" | jq '.' > "$STATS_DIR/ci-doctor-mq-statistics.json" 2>/dev/null; then
- echo "Wrote validated statistics JSON ($(wc -c < "$STATS_DIR/ci-doctor-mq-statistics.json") bytes)"
- else
- echo "Warning: statistics_json failed jq parse; storing raw payload" >&2
- printf '%s' "$STATISTICS_JSON" > "$STATS_DIR/ci-doctor-mq-statistics.json"
- fi
- fi
- if [ -n "$STATISTICS" ]; then
- printf '%s\n' "$STATISTICS" > "$STATS_DIR/ci-doctor-mq-statistics.md"
- fi
- echo "stats_dir=$STATS_DIR" >> "$GITHUB_OUTPUT"
-
- # Build Adaptive Card facts conditionally (only include PR/author when present).
- FACTS=$(jq -nc \
- --arg pipeline_url "$PIPELINE_URL" \
- --arg pr_number "$PR_NUMBER" \
- --arg pr_url "$PR_URL" \
- --arg author "$AUTHOR" \
- --arg failed_workflow "$FAILED_WORKFLOW" \
- --arg db_entries "$DB_ENTRIES" \
- --arg occurrences "$OCCURRENCES" '
- [
- ( $failed_workflow | select(length > 0) | { title: "Workflow", value: . } ),
- ( $pipeline_url | select(length > 0) | { title: "Pipeline", value: ("[Open run](" + . + ")") } ),
- ( $pr_number | select(length > 0) | { title: "PR", value: (if ($pr_url | length) > 0 then ("[#" + . + "](" + $pr_url + ")") else ("#" + .) end) } ),
- ( $author | select(length > 0) | { title: "Author", value: ("@" + .) } ),
- ( $occurrences | select(length > 0) | { title: "Occurrences", value: (. + "×") } ),
- ( $db_entries | select(length > 0) | { title: "DB entries", value: . } )
- ] | map(select(. != null))')
-
- PAYLOAD=$(jq -nc \
- --arg title "$TITLE" \
- --arg description "$DESCRIPTION" \
- --arg statistics "$STATISTICS" \
- --argjson facts "$FACTS" '
- {
- type: "message",
- attachments: [{
- contentType: "application/vnd.microsoft.card.adaptive",
- content: {
- "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
- type: "AdaptiveCard",
- version: "1.4",
- body: ([
- { type: "TextBlock", text: ("\ud83d\udd34 [MQ] " + $title), weight: "Bolder", size: "Medium", color: "Attention", wrap: true },
- { type: "FactSet", facts: $facts },
- { type: "TextBlock", text: $description, wrap: true, spacing: "Medium" }
- ] + (if ($statistics | length) > 0 then [
- { type: "TextBlock", text: "Pattern Database Statistics", weight: "Bolder", size: "Medium", spacing: "Large", separator: true },
- { type: "TextBlock", text: $statistics, wrap: true, spacing: "Small" }
- ] else [] end))
- }
- }]
- }')
-
- curl -sS --fail-with-body \
- -H "Content-Type: application/json" \
- -d "$PAYLOAD" \
- "$TEAMS_WEBHOOK_URL"
-
- - name: Upload statistics artifact
- if: always()
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
- with:
- name: ci-doctor-mq-statistics
- path: ${{ runner.temp }}/ci-doctor-mq-stats
- if-no-files-found: ignore
- retention-days: 90
-
- notify-teams-recurring:
- description: "Send a recurring merge-queue failure escalation alert to Microsoft Teams. Call this ONLY when the same failure pattern has 3 or more occurrences in the last 12 hours. Do NOT call this for every failure."
- runs-on: ubuntu-latest
- output: "Recurring failure escalation sent to Microsoft Teams."
- permissions:
- contents: read
- inputs:
- title:
- description: "Short, searchable description of the recurring failure pattern (same as notify_teams.title)."
- required: true
- type: string
- failed_workflow:
- description: "Name of the GitHub Actions workflow with the recurring failure."
- required: true
- type: string
- pipeline_url:
- description: "URL of the current (latest) failed workflow run."
- required: true
- type: string
- recent_count:
- description: "Number of times this failure pattern has occurred in the last 12 hours, including the current run. Report as a positive integer encoded as a string (e.g., '3', '5')."
- required: true
- type: string
- description:
- description: "Concise markdown gist of the recurring problem: what keeps failing, suspected root cause, and recommended escalation actions. Use Teams-safe markdown only (no raw HTML)."
- required: true
- type: string
- affected_prs:
- description: "Markdown-formatted list of affected PR numbers/links from the merge queue that hit this failure in the last 12 hours. One PR per line, e.g. '- [#1234](https://github.com/org/repo/pull/1234)'. Include up to 10 most recent PRs."
- required: true
- type: string
- recent_run_urls:
- description: "Markdown-formatted list of workflow run URLs that exhibited this failure in the last 12 hours. One URL per line, e.g. '- [Run 12345](https://github.com/org/repo/actions/runs/12345)'. Include up to 10 most recent runs."
- required: true
- type: string
- steps:
- - name: Send recurring failure escalation to Teams
- env:
- TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }}
- run: |
- set -euo pipefail
-
- if [ -z "${TEAMS_WEBHOOK_URL:-}" ]; then
- echo "TEAMS_WEBHOOK_URL secret is not configured" >&2
- exit 1
- fi
-
- if [ ! -f "${GH_AW_AGENT_OUTPUT:-}" ]; then
- echo "No agent output found at GH_AW_AGENT_OUTPUT" >&2
- exit 1
- fi
-
- ITEM=$(jq -c '[.items[] | select(.type == "notify_teams_recurring")] | last' "$GH_AW_AGENT_OUTPUT")
- if [ -z "$ITEM" ] || [ "$ITEM" = "null" ]; then
- echo "No notify_teams_recurring item present in agent output" >&2
- exit 1
- fi
-
- TITLE=$(echo "$ITEM" | jq -r '.title // ""')
- FAILED_WORKFLOW=$(echo "$ITEM" | jq -r '.failed_workflow // ""')
- PIPELINE_URL=$(echo "$ITEM" | jq -r '.pipeline_url // ""')
- RECENT_COUNT=$(echo "$ITEM" | jq -r '.recent_count // ""')
- DESCRIPTION=$(echo "$ITEM" | jq -r '.description // ""')
- AFFECTED_PRS=$(echo "$ITEM" | jq -r '.affected_prs // ""')
- RECENT_RUNS=$(echo "$ITEM" | jq -r '.recent_run_urls // ""')
-
- FACTS=$(jq -nc \
- --arg failed_workflow "$FAILED_WORKFLOW" \
- --arg pipeline_url "$PIPELINE_URL" \
- --arg recent_count "$RECENT_COUNT" '
- [
- { title: "Workflow", value: $failed_workflow },
- { title: "Pipeline", value: ("[Latest run](" + $pipeline_url + ")") },
- { title: "Hits (last 12 hrs)", value: ($recent_count + " occurrences") }
- ]')
-
- PAYLOAD=$(jq -nc \
- --arg title "$TITLE" \
- --arg description "$DESCRIPTION" \
- --arg affected_prs "$AFFECTED_PRS" \
- --arg recent_runs "$RECENT_RUNS" \
- --argjson facts "$FACTS" '
- {
- type: "message",
- attachments: [{
- contentType: "application/vnd.microsoft.card.adaptive",
- content: {
- "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
- type: "AdaptiveCard",
- version: "1.4",
- body: [
- { type: "TextBlock", text: ("\ud83d\udd01 [MQ] Recurring Failure: " + $title), weight: "Bolder", size: "Medium", color: "Warning", wrap: true },
- { type: "FactSet", facts: $facts },
- { type: "TextBlock", text: $description, wrap: true, spacing: "Medium" },
- { type: "TextBlock", text: "### Affected PRs", weight: "Bolder", spacing: "Large", separator: true },
- { type: "TextBlock", text: $affected_prs, wrap: true, spacing: "Small" },
- { type: "TextBlock", text: "### Recent Failure Runs", weight: "Bolder", spacing: "Large", separator: true },
- { type: "TextBlock", text: $recent_runs, wrap: true, spacing: "Small" }
- ]
- }
- }]
- }')
-
- curl -sS --fail-with-body \
- -H "Content-Type: application/json" \
- -d "$PAYLOAD" \
- "$TEAMS_WEBHOOK_URL"
tools:
github:
@@ -726,6 +459,7 @@ ELSE:
2. **Actionable Deliverables**:
- Send a Microsoft Teams notification with the investigation results (see Output Requirements below)
- When the failure is associated with a PR in the merge queue, post a remediation comment on that PR with the failed pipeline name/link, a short failure description, and a short possible remedy (see `add_comment` field guidance below)
+ - When the investigation concludes the failure is transient and a plain restart is likely to clear it, request a re-run of only the failed jobs of the analysed run (see `rerun_failed_jobs` decision guidance below)
- Provide specific file locations and line numbers for fixes
- Suggest code changes or configuration updates
@@ -799,6 +533,7 @@ Post a concise, actionable remediation comment on the affected merge-queue PR so
**Pipeline**: [<failed_workflow name>](<pipeline_url>)
**Failure**: <one-line summary, same as notify_teams.title>
+**Automatic restart**: <one of: `✅ Re-run of failed jobs requested (reason: <reason>)` when you called `rerun_failed_jobs`; `❌ Not triggered — <short reason, e.g. deterministic code failure>` otherwise>
#### Possible remedy
@@ -872,6 +607,12 @@ Provide all required fields and include the optional PR-related fields whenever
- **Commit**: ${{ github.event.workflow_run.head_sha }}
- **Trigger**: merge_group
+### Automatic Restart
+
+State whether an automatic re-run of the failed jobs was triggered:
+- If you called `rerun_failed_jobs`: `✅ Re-run of failed jobs requested` followed by the one-line `reason` you passed.
+- Otherwise: `❌ Not triggered` followed by a short justification (e.g. deterministic code failure that a restart cannot fix).
+
### Root Cause Analysis
Write this as a single, consolidated section. Do NOT add a separate "Investigation Findings", "Deep Analysis", or standalone "Failed Jobs and Errors" section — they duplicate this one. Use the following fixed sub-structure with `####` headings, in this order; omit a sub-heading only if there is genuinely nothing to say.
@@ -937,6 +678,24 @@ This notification is **only** sent when the same failure has occurred 3 or more
- **`affected_prs`** — Markdown bullet list of PRs affected by this failure in the last 12 hours (up to 10, e.g., `- [#1234](url)`). If no PRs can be identified, write "No PR information available."
- **`recent_run_urls`** — Markdown bullet list of failure run URLs from the last 12 hours (up to 10, e.g., `- [Run 56789](url)`).
+### `rerun_failed_jobs` decision guidance
+
+Call the `rerun_failed_jobs` safe-output tool **only** when your Root Cause Analysis concludes the failure is transient and a plain restart is likely to clear it — typically the `Infrastructure`, `Flaky Test`, `Network`, or `External Service` categories (runner hiccups, network timeouts, cancelled jobs, transient download/registry errors, downstream service outages).
+
+**Do NOT** request a re-run for deterministic failures a restart cannot fix — `Code Issue`, `Dependencies`, or `Configuration` categories (compilation errors, assertion failures, missing symbols, bad workflow config). When in doubt, do not re-run.
+
+Only the **failed** jobs of the analysed run are restarted; passing jobs are untouched. The job also refuses to re-run a run that already has more than one attempt, to avoid restart loops.
+
+Provide:
+
+- **`run_id`** (required) — Numeric ID of the analysed run: `${{ github.event.workflow_run.id }}` for merge-queue triggers, or the `run_id` input for `workflow_dispatch`. Pass as a numeric string.
+- **`repository`** (optional) — `owner/repo` of the analysed run. Omit to default to the current repository.
+- **`reason`** (required) — One-line justification for the restart, matching the transient cause identified in the investigation.
+
+This tool is independent of the notifications: still call `notify_teams` (and `add_comment` / `notify_teams_recurring` when applicable) as usual. A re-run request does not replace the investigation report.
+
+Whenever you decide about a restart (whether or not you trigger one), you MUST record the outcome in both the Teams message (the `### Automatic Restart` section of `notify_teams.description`) and, when a PR comment is posted, the `**Automatic restart**` line of the `add_comment` body. Keep both consistent with the actual `rerun_failed_jobs` call.
+
## Important Guidelines
- **Be Thorough**: Don't just report the error - investigate the underlying cause
@@ -960,6 +719,7 @@ You **MUST** always call at least one safe output tool before finishing:
- **`notify_teams`**: Send the investigation report as a Microsoft Teams notification (default for any actionable finding). Call this exactly once.
- **`notify_teams_recurring`**: Send a recurring-failure escalation alert. Call this **only** if Phase 5.5 determines that there are 3+ occurrences in the last 12 hours. Call at most once per run.
- **`add_comment`**: Post a remediation comment on the affected merge-queue PR. Call this **only** when the failure is associated with a PR (provide `item_number` and `body`). Call at most once per run.
+- **`rerun_failed_jobs`**: Re-run only the failed jobs of the analysed run. Call this **only** when the failure is transient and a restart is likely to remedy it (see `rerun_failed_jobs` decision guidance). Call at most once per run.
- **`noop`**: When no action is needed (e.g., CI was successful, not a merge-queue run, no failure to investigate).
- **`missing_data`**: When you cannot gather the information needed to complete the investigation.
@@ -967,6 +727,7 @@ You **MUST** always call at least one safe output tool before finishing:
- `notify_teams` alone — standard investigation with no identifiable PR, fewer than 3 occurrences in the last 12 hours.
- `notify_teams` + `add_comment` — standard investigation where the failure is tied to a PR in the merge queue.
- `notify_teams` + `notify_teams_recurring` (+ `add_comment` when a PR is identified) — standard investigation AND 3+ occurrences in the last 12 hours.
+- Any of the `notify_teams` combinations above **+ `rerun_failed_jobs`** — when the investigation also concludes a plain restart is likely to remedy a transient failure.
- `noop` alone — no investigation needed.
- `missing_data` alone — investigation blocked by missing data.
diff --git a/.github/workflows/clang_tidy.yml b/.github/workflows/clang_tidy.yml
index 750c02ff38e..a3252692887 100644
--- a/.github/workflows/clang_tidy.yml
+++ b/.github/workflows/clang_tidy.yml
@@ -49,7 +49,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
- name: Show affected components
run: |
diff --git a/.github/workflows/code_style.yml b/.github/workflows/code_style.yml
index b37245797c7..df5ac7defae 100644
--- a/.github/workflows/code_style.yml
+++ b/.github/workflows/code_style.yml
@@ -40,7 +40,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
- name: Show affected components
run: |
diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml
index ad7f6c91636..254ccf4c9d6 100644
--- a/.github/workflows/coverity.yml
+++ b/.github/workflows/coverity.yml
@@ -61,7 +61,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
Docker:
needs: Smart_CI
diff --git a/.github/workflows/debian_10_arm.yml b/.github/workflows/debian_10_arm.yml
index 883bbe0f9eb..65d36635967 100644
--- a/.github/workflows/debian_10_arm.yml
+++ b/.github/workflows/debian_10_arm.yml
@@ -51,7 +51,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs,GPU,NPU'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
- name: Show affected components
run: |
diff --git a/.github/workflows/dev_cpu_linux_snippets_libxsmm.yml b/.github/workflows/dev_cpu_linux_snippets_libxsmm.yml
index 0de86f8ad4d..8851c41e72b 100644
--- a/.github/workflows/dev_cpu_linux_snippets_libxsmm.yml
+++ b/.github/workflows/dev_cpu_linux_snippets_libxsmm.yml
@@ -54,7 +54,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
- name: Show affected components
run: |
diff --git a/.github/workflows/dev_gpu_linux_level_zero.yml b/.github/workflows/dev_gpu_linux_level_zero.yml
index c57c384a485..60f16d6776d 100644
--- a/.github/workflows/dev_gpu_linux_level_zero.yml
+++ b/.github/workflows/dev_gpu_linux_level_zero.yml
@@ -50,7 +50,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
- name: Show affected components
run: |
diff --git a/.github/workflows/linux_arm64.yml b/.github/workflows/linux_arm64.yml
index 1b871c31609..16e1a3e8109 100644
--- a/.github/workflows/linux_arm64.yml
+++ b/.github/workflows/linux_arm64.yml
@@ -55,7 +55,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs,GPU,NPU'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
- name: Show affected components
run: |
diff --git a/.github/workflows/linux_conditional_compilation.yml b/.github/workflows/linux_conditional_compilation.yml
index 56b07f25f72..67a0ae0ffc4 100644
--- a/.github/workflows/linux_conditional_compilation.yml
+++ b/.github/workflows/linux_conditional_compilation.yml
@@ -56,7 +56,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
- name: Show affected components
run: |
diff --git a/.github/workflows/linux_riscv.yml b/.github/workflows/linux_riscv.yml
index 57a2cfa7284..e1b9056b39a 100644
--- a/.github/workflows/linux_riscv.yml
+++ b/.github/workflows/linux_riscv.yml
@@ -83,7 +83,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs,GPU,NPU'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
- name: Get target branch
id: set_target_branch
diff --git a/.github/workflows/linux_riscv_conan.yml b/.github/workflows/linux_riscv_conan.yml
index f52cfe74ee4..69b12162414 100644
--- a/.github/workflows/linux_riscv_conan.yml
+++ b/.github/workflows/linux_riscv_conan.yml
@@ -54,7 +54,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
- name: Get target branch
id: set_target_branch
diff --git a/.github/workflows/linux_sanitizers.yml b/.github/workflows/linux_sanitizers.yml
index 049fde69031..cb5ba6ffcaa 100644
--- a/.github/workflows/linux_sanitizers.yml
+++ b/.github/workflows/linux_sanitizers.yml
@@ -71,7 +71,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
Docker:
needs: Smart_CI
diff --git a/.github/workflows/mac_arm64.yml b/.github/workflows/mac_arm64.yml
index 78651bcafb6..05e83a16856 100644
--- a/.github/workflows/mac_arm64.yml
+++ b/.github/workflows/mac_arm64.yml
@@ -68,7 +68,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
Build:
needs: Smart_CI
diff --git a/.github/workflows/manylinux_2_28.yml b/.github/workflows/manylinux_2_28.yml
index 6d904042c3c..2d7a3c6ca93 100644
--- a/.github/workflows/manylinux_2_28.yml
+++ b/.github/workflows/manylinux_2_28.yml
@@ -54,7 +54,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
- name: Show affected components
run: |
diff --git a/.github/workflows/shared/ci-doctor-mq/notify-teams-recurring.md b/.github/workflows/shared/ci-doctor-mq/notify-teams-recurring.md
new file mode 100644
index 00000000000..06b72cf4355
--- /dev/null
+++ b/.github/workflows/shared/ci-doctor-mq/notify-teams-recurring.md
@@ -0,0 +1,120 @@
+---
+description: |
+ Shared custom safe-output job for the CI Doctor MQ workflow.
+ Sends a recurring merge-queue failure escalation alert to Microsoft Teams.
+safe-outputs:
+ jobs:
+ notify-teams-recurring:
+ description: "Send a recurring merge-queue failure escalation alert to Microsoft Teams. Call this ONLY when the same failure pattern has 3 or more occurrences in the last 12 hours. Do NOT call this for every failure."
+ runs-on: ubuntu-latest
+ output: "Recurring failure escalation sent to Microsoft Teams."
+ permissions:
+ contents: read
+ inputs:
+ title:
+ description: "Short, searchable description of the recurring failure pattern (same as notify_teams.title)."
+ required: true
+ type: string
+ failed_workflow:
+ description: "Name of the GitHub Actions workflow with the recurring failure."
+ required: true
+ type: string
+ pipeline_url:
+ description: "URL of the current (latest) failed workflow run."
+ required: true
+ type: string
+ recent_count:
+ description: "Number of times this failure pattern has occurred in the last 12 hours, including the current run. Report as a positive integer encoded as a string (e.g., '3', '5')."
+ required: true
+ type: string
+ description:
+ description: "Concise markdown gist of the recurring problem: what keeps failing, suspected root cause, and recommended escalation actions. Use Teams-safe markdown only (no raw HTML)."
+ required: true
+ type: string
+ affected_prs:
+ description: "Markdown-formatted list of affected PR numbers/links from the merge queue that hit this failure in the last 12 hours. One PR per line, e.g. '- [#1234](https://github.com/org/repo/pull/1234)'. Include up to 10 most recent PRs."
+ required: true
+ type: string
+ recent_run_urls:
+ description: "Markdown-formatted list of workflow run URLs that exhibited this failure in the last 12 hours. One URL per line, e.g. '- [Run 12345](https://github.com/org/repo/actions/runs/12345)'. Include up to 10 most recent runs."
+ required: true
+ type: string
+ steps:
+ - name: Send recurring failure escalation to Teams
+ env:
+ TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }}
+ run: |
+ set -euo pipefail
+
+ if [ -z "${TEAMS_WEBHOOK_URL:-}" ]; then
+ echo "TEAMS_WEBHOOK_URL secret is not configured" >&2
+ exit 1
+ fi
+
+ if [ ! -f "${GH_AW_AGENT_OUTPUT:-}" ]; then
+ echo "No agent output found at GH_AW_AGENT_OUTPUT" >&2
+ exit 1
+ fi
+
+ ITEM=$(jq -c '[.items[] | select(.type == "notify_teams_recurring")] | last' "$GH_AW_AGENT_OUTPUT")
+ if [ -z "$ITEM" ] || [ "$ITEM" = "null" ]; then
+ echo "No notify_teams_recurring item present in agent output" >&2
+ exit 1
+ fi
+
+ TITLE=$(echo "$ITEM" | jq -r '.title // ""')
+ FAILED_WORKFLOW=$(echo "$ITEM" | jq -r '.failed_workflow // ""')
+ PIPELINE_URL=$(echo "$ITEM" | jq -r '.pipeline_url // ""')
+ RECENT_COUNT=$(echo "$ITEM" | jq -r '.recent_count // ""')
+ DESCRIPTION=$(echo "$ITEM" | jq -r '.description // ""')
+ AFFECTED_PRS=$(echo "$ITEM" | jq -r '.affected_prs // ""')
+ RECENT_RUNS=$(echo "$ITEM" | jq -r '.recent_run_urls // ""')
+
+ FACTS=$(jq -nc \
+ --arg failed_workflow "$FAILED_WORKFLOW" \
+ --arg pipeline_url "$PIPELINE_URL" \
+ --arg recent_count "$RECENT_COUNT" '
+ [
+ { title: "Workflow", value: $failed_workflow },
+ { title: "Pipeline", value: ("[Latest run](" + $pipeline_url + ")") },
+ { title: "Hits (last 12 hrs)", value: ($recent_count + " occurrences") }
+ ]')
+
+ PAYLOAD=$(jq -nc \
+ --arg title "$TITLE" \
+ --arg description "$DESCRIPTION" \
+ --arg affected_prs "$AFFECTED_PRS" \
+ --arg recent_runs "$RECENT_RUNS" \
+ --argjson facts "$FACTS" '
+ {
+ type: "message",
+ attachments: [{
+ contentType: "application/vnd.microsoft.card.adaptive",
+ content: {
+ "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
+ type: "AdaptiveCard",
+ version: "1.4",
+ body: [
+ { type: "TextBlock", text: ("\ud83d\udd01 [MQ] Recurring Failure: " + $title), weight: "Bolder", size: "Medium", color: "Warning", wrap: true },
+ { type: "FactSet", facts: $facts },
+ { type: "TextBlock", text: $description, wrap: true, spacing: "Medium" },
+ { type: "TextBlock", text: "### Affected PRs", weight: "Bolder", spacing: "Large", separator: true },
+ { type: "TextBlock", text: $affected_prs, wrap: true, spacing: "Small" },
+ { type: "TextBlock", text: "### Recent Failure Runs", weight: "Bolder", spacing: "Large", separator: true },
+ { type: "TextBlock", text: $recent_runs, wrap: true, spacing: "Small" }
+ ]
+ }
+ }]
+ }')
+
+ curl -sS --fail-with-body \
+ -H "Content-Type: application/json" \
+ -d "$PAYLOAD" \
+ "$TEAMS_WEBHOOK_URL"
+---
+
+# CI Doctor MQ — Recurring Teams Notification Job
+
+Shared definition of the `notify-teams-recurring` custom safe-output job used by
+the CI Doctor Merge Queue workflow. Import it via `imports:` in the consuming
+workflow's frontmatter.
diff --git a/.github/workflows/shared/ci-doctor-mq/notify-teams.md b/.github/workflows/shared/ci-doctor-mq/notify-teams.md
new file mode 100644
index 00000000000..9a36e5292d7
--- /dev/null
+++ b/.github/workflows/shared/ci-doctor-mq/notify-teams.md
@@ -0,0 +1,176 @@
+---
+description: |
+ Shared custom safe-output job for the CI Doctor MQ workflow.
+ Sends a CI failure investigation summary to Microsoft Teams.
+safe-outputs:
+ jobs:
+ notify-teams:
+ description: "Send a CI failure investigation summary to Microsoft Teams. Call this exactly once at the end of the investigation with a concise title and a thorough description of the failure."
+ runs-on: ubuntu-latest
+ output: "Notification sent to Microsoft Teams."
+ permissions:
+ contents: read
+ inputs:
+ title:
+ description: "Short, searchable description of the failure (e.g. 'smoke_Bucketize tests fail on comparison'). No PR/run numbers."
+ required: true
+ type: string
+ failed_workflow:
+ description: "Name of the GitHub Actions workflow that failed (as reported by `get_workflow_run`, e.g. 'Linux (Ubuntu 22.04, Python 3.11)'). Do NOT pass the CI Doctor MQ workflow name."
+ required: true
+ type: string
+ pipeline_url:
+ description: "URL of the failed GitHub Actions workflow run."
+ required: true
+ type: string
+ description:
+ description: "Thorough markdown description of the problem: root cause, failed jobs, key error messages, and recommended actions."
+ required: true
+ type: string
+ pr_number:
+ description: "Pull request number if the failure is associated with a PR in the merge queue. Omit otherwise."
+ required: false
+ type: string
+ default: "not_found"
+ pr_url:
+ description: "Pull request URL if the failure is associated with a PR in the merge queue. Omit otherwise."
+ required: false
+ type: string
+ default: "not_found"
+ author:
+ description: "GitHub login of the PR author or commit author, if known. Omit otherwise."
+ required: false
+ type: string
+ default: "not_found"
+ db_entries:
+ description: "Total number of unique entries currently in the CI Doctor MQ investigation database (count of distinct investigation files under /tmp/gh-aw/repo-memory/default/mq/investigations/, including the one created by this run). Report as a non-negative integer encoded as a string."
+ required: true
+ type: string
+ occurrence_count:
+ description: "How many times this same issue has been recorded in the CI Doctor MQ database, including the current investigation. Compute by matching the current failure signature (normalized error message + failure category, job-agnostic) against prior investigation/pattern files under /tmp/gh-aw/repo-memory/default/mq/. Must be >= 1. Report as a positive integer encoded as a string."
+ required: true
+ type: string
+ statistics:
+ description: "Markdown-formatted statistics summary of the CI Doctor MQ pattern database. Must include a table (or list) of every known failure pattern with: pattern signature/title, total reproduction count, first-seen timestamp (UTC, ISO 8601), and last-seen timestamp (UTC, ISO 8601). Sort patterns by reproduction count descending. Compute from files under /tmp/gh-aw/repo-memory/default/mq/investigations/ and /tmp/gh-aw/repo-memory/default/mq/patterns/. Keep concise (top 20 patterns max). Use the rendering rules from the description field (tilde fences, no raw HTML)."
+ required: true
+ type: string
+ statistics_json:
+ description: "Full statistics database serialized as a compact JSON string. Must be a JSON object of the form {\"generated_at\": <ISO8601 UTC>, \"total_patterns\": <int>, \"total_investigations\": <int>, \"patterns\": [{\"signature\": <str>, \"title\": <str>, \"category\": <str>, \"count\": <int>, \"first_seen\": <ISO8601 UTC>, \"last_seen\": <ISO8601 UTC>, \"recent_run_urls\": [<str>, ...]}]}. Include ALL known patterns, not just the top N. This payload is uploaded as a workflow artifact for offline analysis."
+ required: true
+ type: string
+ steps:
+ - name: Send Teams notification
+ env:
+ TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }}
+ RUN_URL: ${{ github.event.workflow_run.html_url || github.event.inputs.link || '' }}
+ run: |
+ set -euo pipefail
+
+ if [ -z "${TEAMS_WEBHOOK_URL:-}" ]; then
+ echo "TEAMS_WEBHOOK_URL secret is not configured" >&2
+ exit 1
+ fi
+
+ if [ ! -f "${GH_AW_AGENT_OUTPUT:-}" ]; then
+ echo "No agent output found at GH_AW_AGENT_OUTPUT" >&2
+ exit 1
+ fi
+
+ ITEM=$(jq -c '[.items[] | select(.type == "notify_teams")] | last' "$GH_AW_AGENT_OUTPUT")
+ if [ -z "$ITEM" ] || [ "$ITEM" = "null" ]; then
+ echo "No notify_teams item present in agent output" >&2
+ exit 1
+ fi
+
+ TITLE=$(echo "$ITEM" | jq -r '.title // ""')
+ FAILED_WORKFLOW=$(echo "$ITEM" | jq -r '.failed_workflow // ""')
+ PIPELINE_URL=$(echo "$ITEM" | jq -r '.pipeline_url // ""')
+ DESCRIPTION=$(echo "$ITEM" | jq -r '.description // ""')
+ PR_NUMBER=$(echo "$ITEM" | jq -r '.pr_number // ""')
+ PR_URL=$(echo "$ITEM" | jq -r '.pr_url // ""')
+ AUTHOR=$(echo "$ITEM" | jq -r '.author // ""')
+ DB_ENTRIES=$(echo "$ITEM" | jq -r '.db_entries // ""')
+ OCCURRENCES=$(echo "$ITEM" | jq -r '.occurrence_count // ""')
+ STATISTICS=$(echo "$ITEM" | jq -r '.statistics // ""')
+ STATISTICS_JSON=$(echo "$ITEM" | jq -r '.statistics_json // ""')
+
+ # Persist the full statistics database as a workflow artifact for offline review.
+ STATS_DIR="${RUNNER_TEMP:-/tmp}/ci-doctor-mq-stats"
+ mkdir -p "$STATS_DIR"
+ if [ -n "$STATISTICS_JSON" ]; then
+ # Validate and pretty-print; fall back to raw on parse error.
+ if echo "$STATISTICS_JSON" | jq '.' > "$STATS_DIR/ci-doctor-mq-statistics.json" 2>/dev/null; then
+ echo "Wrote validated statistics JSON ($(wc -c < "$STATS_DIR/ci-doctor-mq-statistics.json") bytes)"
+ else
+ echo "Warning: statistics_json failed jq parse; storing raw payload" >&2
+ printf '%s' "$STATISTICS_JSON" > "$STATS_DIR/ci-doctor-mq-statistics.json"
+ fi
+ fi
+ if [ -n "$STATISTICS" ]; then
+ printf '%s\n' "$STATISTICS" > "$STATS_DIR/ci-doctor-mq-statistics.md"
+ fi
+ echo "stats_dir=$STATS_DIR" >> "$GITHUB_OUTPUT"
+
+ # Build Adaptive Card facts conditionally (only include PR/author when present).
+ FACTS=$(jq -nc \
+ --arg pipeline_url "$PIPELINE_URL" \
+ --arg pr_number "$PR_NUMBER" \
+ --arg pr_url "$PR_URL" \
+ --arg author "$AUTHOR" \
+ --arg failed_workflow "$FAILED_WORKFLOW" \
+ --arg db_entries "$DB_ENTRIES" \
+ --arg occurrences "$OCCURRENCES" '
+ [
+ ( $failed_workflow | select(length > 0) | { title: "Workflow", value: . } ),
+ ( $pipeline_url | select(length > 0) | { title: "Pipeline", value: ("[Open run](" + . + ")") } ),
+ ( $pr_number | select(length > 0) | { title: "PR", value: (if ($pr_url | length) > 0 then ("[#" + . + "](" + $pr_url + ")") else ("#" + .) end) } ),
+ ( $author | select(length > 0) | { title: "Author", value: ("@" + .) } ),
+ ( $occurrences | select(length > 0) | { title: "Occurrences", value: (. + "×") } ),
+ ( $db_entries | select(length > 0) | { title: "DB entries", value: . } )
+ ] | map(select(. != null))')
+
+ PAYLOAD=$(jq -nc \
+ --arg title "$TITLE" \
+ --arg description "$DESCRIPTION" \
+ --arg statistics "$STATISTICS" \
+ --argjson facts "$FACTS" '
+ {
+ type: "message",
+ attachments: [{
+ contentType: "application/vnd.microsoft.card.adaptive",
+ content: {
+ "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
+ type: "AdaptiveCard",
+ version: "1.4",
+ body: ([
+ { type: "TextBlock", text: ("\ud83d\udd34 [MQ] " + $title), weight: "Bolder", size: "Medium", color: "Attention", wrap: true },
+ { type: "FactSet", facts: $facts },
+ { type: "TextBlock", text: $description, wrap: true, spacing: "Medium" }
+ ] + (if ($statistics | length) > 0 then [
+ { type: "TextBlock", text: "Pattern Database Statistics", weight: "Bolder", size: "Medium", spacing: "Large", separator: true },
+ { type: "TextBlock", text: $statistics, wrap: true, spacing: "Small" }
+ ] else [] end))
+ }
+ }]
+ }')
+
+ curl -sS --fail-with-body \
+ -H "Content-Type: application/json" \
+ -d "$PAYLOAD" \
+ "$TEAMS_WEBHOOK_URL"
+
+ - name: Upload statistics artifact
+ if: always()
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: ci-doctor-mq-statistics
+ path: ${{ runner.temp }}/ci-doctor-mq-stats
+ if-no-files-found: ignore
+ retention-days: 90
+---
+
+# CI Doctor MQ — Teams Notification Job
+
+Shared definition of the `notify-teams` custom safe-output job used by the
+CI Doctor Merge Queue workflow. Import it via `imports:` in the consuming
+workflow's frontmatter.
diff --git a/.github/workflows/shared/ci-doctor-mq/rerun-failed-jobs.md b/.github/workflows/shared/ci-doctor-mq/rerun-failed-jobs.md
new file mode 100644
index 00000000000..676e6dc25c2
--- /dev/null
+++ b/.github/workflows/shared/ci-doctor-mq/rerun-failed-jobs.md
@@ -0,0 +1,93 @@
+---
+description: |
+ Shared custom safe-output job for the CI Doctor MQ workflow.
+ Re-runs ONLY the failed jobs of an analysed GitHub Actions workflow run,
+ when the CI Doctor concludes a plain restart is likely to remedy the failure.
+safe-outputs:
+ jobs:
+ rerun-failed-jobs:
+ description: "Re-run ONLY the failed jobs of the analysed workflow run. Call this at most once and ONLY when the investigation concludes the failure is transient and a plain restart is likely to fix it (e.g. Infrastructure, Flaky Test, Network, or External Service categories such as runner hiccups, network timeouts, or downstream outages). Do NOT call for deterministic Code Issue / Dependencies / Configuration failures that a restart cannot fix."
+ runs-on: ubuntu-latest
+ output: "Failed jobs re-run requested for the analysed workflow run."
+ permissions:
+ actions: write
+ inputs:
+ run_id:
+ description: "Numeric ID of the GitHub Actions workflow run whose failed jobs should be re-run. This is the run that was investigated (github.event.workflow_run.id for merge-queue triggers, or the run_id input for workflow_dispatch). Report as a numeric string."
+ required: true
+ type: string
+ repository:
+ description: "The owner/repo of the repository that owns the analysed run (e.g. 'openvinotoolkit/openvino'). Defaults to the current repository when omitted."
+ required: false
+ type: string
+ default: "not_found"
+ reason:
+ description: "Short justification for why a restart is expected to remedy the failure (e.g. 'network timeout while downloading dependencies')."
+ required: true
+ type: string
+ steps:
+ - name: Re-run failed jobs
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ set -euo pipefail
+
+ if [ ! -f "${GH_AW_AGENT_OUTPUT:-}" ]; then
+ echo "No agent output found at GH_AW_AGENT_OUTPUT" >&2
+ exit 1
+ fi
+
+ ITEM=$(jq -c '[.items[] | select(.type == "rerun_failed_jobs")] | last' "$GH_AW_AGENT_OUTPUT")
+ if [ -z "$ITEM" ] || [ "$ITEM" = "null" ]; then
+ echo "No rerun_failed_jobs item present in agent output" >&2
+ exit 1
+ fi
+
+ RUN_ID=$(echo "$ITEM" | jq -r '.run_id // ""')
+ REPOSITORY=$(echo "$ITEM" | jq -r '.repository // ""')
+ REASON=$(echo "$ITEM" | jq -r '.reason // ""')
+
+ # Validate run_id is purely numeric to avoid API path injection.
+ if ! printf '%s' "$RUN_ID" | grep -Eq '^[0-9]+$'; then
+ echo "run_id must be a numeric string, got: '$RUN_ID'" >&2
+ exit 1
+ fi
+
+ # Fall back to the current repository when none was supplied.
+ if [ -z "$REPOSITORY" ] || [ "$REPOSITORY" = "not_found" ]; then
+ REPOSITORY="${GITHUB_REPOSITORY}"
+ fi
+
+ # Validate repository is in owner/repo form to avoid API path injection.
+ if ! printf '%s' "$REPOSITORY" | grep -Eq '^[A-Za-z0-9._-]+/[A-Za-z0-9._-]+$'; then
+ echo "repository must be in owner/repo format, got: '$REPOSITORY'" >&2
+ exit 1
+ fi
+
+ echo "Requested re-run of failed jobs for $REPOSITORY run $RUN_ID (reason: $REASON)"
+
+ # Guard against restart loops: if the run has already been attempted
+ # more than once, do not re-run it again (mirrors rerunner.py).
+ ATTEMPT=$(gh api "repos/${REPOSITORY}/actions/runs/${RUN_ID}" --jq '.run_attempt')
+ if [ "${ATTEMPT:-1}" -gt 1 ]; then
+ echo "Run $RUN_ID already has $ATTEMPT attempts; not re-running to avoid loops."
+ exit 0
+ fi
+
+ # Re-run ONLY the failed jobs of the analysed run.
+ gh api \
+ --method POST \
+ -H "Accept: application/vnd.github+json" \
+ "repos/${REPOSITORY}/actions/runs/${RUN_ID}/rerun-failed-jobs"
+
+ echo "Successfully requested re-run of failed jobs for $REPOSITORY run $RUN_ID."
+---
+
+# CI Doctor MQ — Re-run Failed Jobs
+
+Shared definition of the `rerun-failed-jobs` custom safe-output job used by the
+CI Doctor Merge Queue workflow. It calls the GitHub Actions
+`POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs` endpoint to
+restart only the failed jobs of the analysed run. Import it via `imports:` in the
+consuming workflow's frontmatter, and instruct the agent to call
+`rerun_failed_jobs` only when a restart is likely to remedy the failure.
diff --git a/.github/workflows/ubuntu_22.yml b/.github/workflows/ubuntu_22.yml
index 95e3915cbb3..59713816aed 100644
--- a/.github/workflows/ubuntu_22.yml
+++ b/.github/workflows/ubuntu_22.yml
@@ -63,7 +63,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
- name: Show affected components
run: |
diff --git a/.github/workflows/ubuntu_22_arm64_cross_compilation.yml b/.github/workflows/ubuntu_22_arm64_cross_compilation.yml
index 1f0789d0687..16401ead1db 100644
--- a/.github/workflows/ubuntu_22_arm64_cross_compilation.yml
+++ b/.github/workflows/ubuntu_22_arm64_cross_compilation.yml
@@ -56,7 +56,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs,GPU,NPU'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
- name: Show affected components
run: |
diff --git a/.github/workflows/ubuntu_22_dpcpp.yml b/.github/workflows/ubuntu_22_dpcpp.yml
index 8ee6ed2c274..9ff3180c457 100644
--- a/.github/workflows/ubuntu_22_dpcpp.yml
+++ b/.github/workflows/ubuntu_22_dpcpp.yml
@@ -42,7 +42,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
- name: Show affected components
run: |
diff --git a/.github/workflows/ubuntu_24.yml b/.github/workflows/ubuntu_24.yml
index 774f0680cf9..119a817693a 100644
--- a/.github/workflows/ubuntu_24.yml
+++ b/.github/workflows/ubuntu_24.yml
@@ -58,7 +58,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
- name: Show affected components
run: |
diff --git a/.github/workflows/webassembly.yml b/.github/workflows/webassembly.yml
index 1b89138ac8c..2ec4ea88c0e 100644
--- a/.github/workflows/webassembly.yml
+++ b/.github/workflows/webassembly.yml
@@ -51,7 +51,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs,GPU,NPU'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
- name: Show affected components
run: |
diff --git a/.github/workflows/windows_conditional_compilation.yml b/.github/workflows/windows_conditional_compilation.yml
index 5935d4da363..6b3414874eb 100644
--- a/.github/workflows/windows_conditional_compilation.yml
+++ b/.github/workflows/windows_conditional_compilation.yml
@@ -57,7 +57,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
# check SELECTIVE_BUILD_STAT in CC 'COLLECT' AND 'ON' modes
diff --git a/.github/workflows/windows_level_zero_build.yml b/.github/workflows/windows_level_zero_build.yml
index d74a3acdc41..34ac7f443f2 100644
--- a/.github/workflows/windows_level_zero_build.yml
+++ b/.github/workflows/windows_level_zero_build.yml
@@ -53,7 +53,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
- name: Get target branch
id: set_target_branch
diff --git a/.github/workflows/windows_vs2022_debug.yml b/.github/workflows/windows_vs2022_debug.yml
index 5a3aa3600bd..b1da98abb70 100644
--- a/.github/workflows/windows_vs2022_debug.yml
+++ b/.github/workflows/windows_vs2022_debug.yml
@@ -53,7 +53,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
- name: Get target branch
id: set_target_branch
diff --git a/.github/workflows/windows_vs2022_release.yml b/.github/workflows/windows_vs2022_release.yml
index 150fc0dbbc7..e4be688a8bd 100644
--- a/.github/workflows/windows_vs2022_release.yml
+++ b/.github/workflows/windows_vs2022_release.yml
@@ -55,7 +55,7 @@ jobs:
component_pattern: "category: (.*)"
repo_token: ${{ secrets.GITHUB_TOKEN }}
skip_when_only_listed_labels_set: 'docs'
- skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml'
+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*,.github/workflows/ci-doctor.lock.yml,.github/workflows/ci-doctor-mq.lock.yml'
- name: Get target branch
id: set_target_branch