OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[CI] [AW] [DOCS] Add documentation on the agentic workflows setup; add relevant SKILL for AW; introduce PR info pre-collection job (#36971)
Andrei Kashchikhin04972c078a3b
diff --git a/.claude/skills/ov-agentic-workflows/SKILL.md b/.claude/skills/ov-agentic-workflows/SKILL.mdnew file mode 100644index 00000000000..3e79a056b05--- /dev/null+++ b/.claude/skills/ov-agentic-workflows/SKILL.md@@ -0,0 +1,149 @@+---+name: ov-agentic-workflows+description: Author, edit, compile, validate, and debug any OpenVINO gh-aw agentic workflow (e.g. ci-doctor, ci-doctor-mq, and any future ones) and their shared safe-output jobs under .github/workflows/shared/agentic-workflows. Use when a user wants to create a new agentic workflow; change an existing one's prompt, triggers, tools, permissions, or safe-outputs; add or edit a shared job/step; recompile a .lock.yml; update a workflow's persisted-state JSON schemas; or test a workflow via workflow_dispatch. Do NOT use for regular (non-agentic) GitHub Actions workflows, plugin/runtime code, or diagnosing a specific live CI failure.+---++# Work on OpenVINO Agentic Workflows++Guides changes to **any** `gh-aw` agentic workflow in this repository and its shared jobs — not just+the ones that exist today. New agentic workflows are expected to be added over time; treat every+`.github/workflows/*.md` file with `gh-aw` frontmatter (`on:`, `engine:`, `safe-outputs:`, etc.) as in+scope for this skill.++**Read [docs/dev/ci/github_actions/agentic_workflows.md](../../../docs/dev/ci/github_actions/agentic_workflows.md) first** — it documents the workflows that exist today (`ci-doctor`, `ci-doctor-mq`) in+detail: what they are, how they are built, their algorithms, and the shared jobs. Treat it as the+worked example of the concepts in this skill, and keep it up to date (see the **Skill+self-improvement** section below) whenever a new agentic workflow is added or an existing one changes+meaningfully.++For the framework itself, consult the official [GitHub Agentic Workflows (`gh-aw`) documentation](https://github.github.com/gh-aw/introduction/overview/) — the authoritative reference for frontmatter+keys, `imports`, `safe-outputs`, tools, and the `gh aw compile` workflow.++## Identifying agentic workflows++* **Source files**: `.github/workflows/*.md` with a `gh-aw` YAML frontmatter (`on:`, `engine:`,+ `safe-outputs:`, `tools:`, ...) — as opposed to a plain `.yml` workflow.+* **Compiled output**: each source `<name>.md` compiles to a generated `<name>.lock.yml` in the same+ directory. This is what GitHub Actions actually runs.+* **Shared building blocks**: step/job fragments imported by one or more agentic workflows live under+ `.github/workflows/shared/agentic-workflows/*.md`. Each such `.md` defines only the job *interface and+ wiring* (inputs, `permissions:`, steps); the actual logic lives in standalone Python scripts under+ `.github/scripts/agentic-workflows/*.py` (one per job, plus a shared `common.py`). A shared job step+ sparse-checks-out that scripts directory and runs its script.+* **Known examples today**: `ci-doctor.md` (on-demand PR investigator) and `ci-doctor-mq.md` (automatic+ merge-queue investigator). Do not assume this is the complete list — check `.github/workflows/*.md`+ for the current set of `gh-aw` sources, since more will be added over time.++## Golden rules++1. **Never edit a `.lock.yml` by hand.** It is generated. Edit the `.md` source (or an imported shared+ file), then recompile. If a user skips recompilation, tell them to recompile themselves before committing.+2. **Always recompile after editing** any `.md` source or imported file:+ ```bash+ gh aw compile+ ```+ Commit the `.md` **and** the regenerated `.lock.yml` together in the same change.+3. **Keep trigger guards intact.** Agentic workflows commonly gate execution with an `if:` condition+ (an actor allow-list, a specific event/conclusion combination, a slash command, etc.). Do not loosen+ a guard without explicit intent — re-read the workflow's own description of how it is+ invoked/triggered first.+4. **Preserve source-inspection safeguards.** Investigative workflows typically cap how much of the+ codebase the agent may read (file/search budgets, PR-diff-first, "stop and report" conditions). Keep+ these bounds when editing a prompt — they bound cost and blast radius.+5. **Respect `safe-outputs` as the only side-effect boundary.** The agent itself must never be granted+ permission to directly comment, notify, merge, or otherwise mutate shared state — that must go+ through a `safe-outputs` job with its own narrowly-scoped `permissions:`.++## Common tasks++### Create a new agentic workflow+1. Author `.github/workflows/<name>.md` with `gh-aw` frontmatter (`on:`, `permissions:`, `engine:`,+ `network:`, `tools:`, `safe-outputs:`, `imports:` as needed) and a natural-language body describing+ the mission and investigation/action protocol.+2. Reuse existing shared jobs/steps under `.github/workflows/shared/agentic-workflows/` instead of+ duplicating logic (for example log pre-download, notification jobs) — add a new shared file only for+ genuinely new, reusable behavior.+3. Give the workflow the narrowest `permissions:` and the smallest `safe-outputs` surface it needs.+4. Recompile (`gh aw compile`) and commit the `.md` and the generated `.lock.yml` together.+5. Extend [docs/dev/ci/github_actions/agentic_workflows.md](../../../docs/dev/ci/github_actions/agentic_workflows.md) with the new workflow, and apply+ the **Skill self-improvement** guidance below.++### Edit a workflow's prompt, triggers, tools, or permissions+1. Edit the frontmatter or body of the relevant `.md` source.+2. If you touch `on:`/`if:`, re-read that workflow's own "how it is invoked/triggered" description+ (in the doc, or in the workflow's frontmatter comment) to keep the guard semantics correct.+3. Recompile and commit both files.++### Add or change a shared safe-output job or step+1. Decide what you are changing:+ * **Job logic** (what the step actually does) lives in `.github/scripts/agentic-workflows/<name>.py`+ (shared helpers in `common.py`) — edit the Python there.+ * **Job interface / wiring** (inputs, `permissions:`, which script runs, step order) lives in the+ shared `.md` under `.github/workflows/shared/agentic-workflows/` — edit that, then recompile.+2. A *step* fragment has no `on:` and is prepended to importers; a *safe-output job* lives under+ `safe-outputs.jobs:`.+3. Ensure every consuming workflow lists the file under `imports:` and that its body instructs the+ agent when to call the new safe output.+4. Give each safe-output job the **narrowest** `permissions:` it needs.+5. Recompile every workflow that imports the file (only needed when the `.md` changed).++### Add a new safe output+- Define the job (inputs, `permissions`, steps) in a shared file (or inline if genuinely single-use),+ import it, and document in the workflow body exactly when the agent may emit it and any valid+ combinations with other safe outputs. Remember: **all numeric-looking safe-output fields must be+ passed as strings** (see pitfalls).++### Change a workflow's persisted-state / schema format+Some agentic workflows persist structured JSON state across runs (for example via the `repo-memory`+tool). If a workflow you're changing does this:+1. Update the matching JSON Schema file (typically under a workflow-specific directory such as+ `.github/ci-doctor-mq/schemas/`).+2. Update the write/validation instructions in the workflow's `.md` body so the agent writes+ conforming artifacts.+3. Validate a sample artifact against the schema, e.g.:+ ```bash+ python3 -c "import jsonschema, json, sys; jsonschema.validate(json.load(open(sys.argv[1])), json.load(open(sys.argv[2])))" sample.json path/to/schema.json+ ```++## Pitfalls to check before finishing++General, applies to any agentic workflow:+- **Lock file out of date** — did you run `gh aw compile` and stage the `.lock.yml`?+- **Safe-output typing** — every numeric-looking field (e.g. `pr_number`, counts) must be a quoted+ string, never a bare number, unless the field is explicitly typed otherwise.+- **Permission creep** — did you give the agent job or a safe-output job broader `permissions:` than it+ needs?+- **Guard regressions** — does the workflow still only run for the intended trigger/actor/event after+ your change?++Known pitfalls from existing workflows (check whether they still apply, and add new ones as you find+them — see below):+- **Teams markdown** (`ci-doctor-mq`) — Adaptive Cards render a limited subset; use `~~~` (tilde)+ fences for log excerpts, no raw HTML (`<details>`, `<br>`, `<table>`).+- **Signature hashing** (`ci-doctor-mq`) — the pattern hash must stay job-agnostic (normalized error ++ category, no job name), or recurrence counting breaks.+- **Read-only knowledge base** (`ci-doctor`) — must never write under `/tmp/gh-aw/repo-memory/default/`;+ only `ci-doctor-mq` writes to it.+- **Secrets** — new Teams/queue-style behavior may need dedicated secrets (e.g. `TEAMS_WEBHOOK_URL`,+ `MERGE_QUEUE_TOKEN`); the default `GITHUB_TOKEN` cannot re-trigger `merge_group` runs.++## Skill self-improvement++This skill must evolve alongside the agentic workflows it describes. Whenever you make a change that+reveals a new rule, reusable pattern, shared job, or footgun, **update this file** (and its mirror,+see below) before finishing:++- **New agentic workflow added** — update the "Known examples today" note, and make sure+ [docs/dev/ci/github_actions/agentic_workflows.md](../../../docs/dev/ci/github_actions/agentic_workflows.md) documents it.+- **New shared job/step introduced** — mention it under "Common tasks" if it changes how a common task+ should be done (e.g. a new reusable notification or remediation pattern).+- **New footgun discovered** (a safe-output typing quirk, a rendering limitation, a required+ permission/secret, a validation step that was missed) — add it to "Pitfalls to check before+ finishing".+- **A rule becomes obsolete** (a workflow is removed, a schema path changes, a guard is redesigned) —+ update or remove the corresponding entry instead of leaving stale guidance in place.+- **Keep it concise** — prefer linking to the (now-updated) doc over duplicating detail here; this+ skill should stay a short, actionable checklist, not a second copy of the documentation.+- **Keep mirrors in sync** — this skill is duplicated under `.claude/skills/ov-agentic-workflows/SKILL.md`+ for tool compatibility. When you edit one copy, apply the identical edit to the other so they never+ drift apart.diff --git a/.github/aw/actions-lock.json b/.github/aw/actions-lock.jsonindex 483abd3db42..7dfd04e8206 100644--- a/.github/aw/actions-lock.json+++ b/.github/aw/actions-lock.json@@ -1,10 +1,5 @@{"entries": {- "actions/[email protected]": {- "repo": "actions/github-script",- "version": "v9.0.0",- "sha": "3a2844b7e9c422d3c10d287c895573f7108da1b3"- },"github/gh-aw-actions/[email protected]": {"repo": "github/gh-aw-actions/setup-cli","version": "v0.83.4",@@ -15,22 +10,5 @@"version": "v0.83.4","sha": "e89c65e17eb281bbd5ff2ff9e9199a03e96654c7"}- },- "containers": {- "ghcr.io/github/gh-aw-firewall/agent:0.27.0": {- "image": "ghcr.io/github/gh-aw-firewall/agent:0.27.0",- "digest": "sha256:3816d1692e6d96887b27f1e4f1d64b8d7edb43ed9d7506b8f203913cbb81c248",- "pinned_image": "ghcr.io/github/gh-aw-firewall/agent:0.27.0@sha256:3816d1692e6d96887b27f1e4f1d64b8d7edb43ed9d7506b8f203913cbb81c248"- },- "ghcr.io/github/gh-aw-firewall/api-proxy:0.27.0": {- "image": "ghcr.io/github/gh-aw-firewall/api-proxy:0.27.0",- "digest": "sha256:f28d2bd3197fb6ef9ec40ef345bbf2bb33e50151a8e72e89abb618fc3d0066eb",- "pinned_image": "ghcr.io/github/gh-aw-firewall/api-proxy:0.27.0@sha256:f28d2bd3197fb6ef9ec40ef345bbf2bb33e50151a8e72e89abb618fc3d0066eb"- },- "ghcr.io/github/gh-aw-firewall/squid:0.27.0": {- "image": "ghcr.io/github/gh-aw-firewall/squid:0.27.0",- "digest": "sha256:d6a01d4cf3d928e6a7fc42e34afef228e753dce87646edc91d8a5cd0b612d9a6",- "pinned_image": "ghcr.io/github/gh-aw-firewall/squid:0.27.0@sha256:d6a01d4cf3d928e6a7fc42e34afef228e753dce87646edc91d8a5cd0b612d9a6"- }}}diff --git a/.github/scripts/agentic-workflows/collect_pr_info.py b/.github/scripts/agentic-workflows/collect_pr_info.pynew file mode 100644index 00000000000..4b3986dbf81--- /dev/null+++ b/.github/scripts/agentic-workflows/collect_pr_info.py@@ -0,0 +1,202 @@+# Copyright (C) 2018-2026 Intel Corporation+# SPDX-License-Identifier: Apache-2.0++"""Pre-collect pull-request metadata for the CI Doctor workflows.++Used by the shared pre-agent step+(.github/workflows/shared/agentic-workflows/collect-pr-info.md). Auto-detects its+mode from the environment (mirroring ``download_failure_logs.py``):+ - run mode (RUN_ID set): a merge-queue (``merge_group``) run carries no+ direct PR context, so the PR number is recovered from the merge-queue head+ branch (``gh-readonly-queue/<base>/pr-<number>-<sha>``), falling back to the+ run's associated ``pull_requests``.+ - pr mode (PR_NUMBER set): the PR number is already known (e.g. a+ ``/ci-doctor`` pull-request comment), so the PR is fetched directly.++Resolving it deterministically before the session and writing it to+``/tmp/gh-aw/agent/ci-doctor/pr-info.json`` (plus a human-readable+``pr-info.txt``) lets the agent populate the Teams ``PR`` / ``Author`` fields and+scope its source inspection to the PR diff.+"""++from __future__ import annotations++import json+import os+import re+from typing import TYPE_CHECKING, Any++from common import github_client++if TYPE_CHECKING:+ from github.PullRequest import PullRequest+ from github.Repository import Repository+ from github.WorkflowRun import WorkflowRun++OUTPUT_DIR = "/tmp/gh-aw/agent/ci-doctor"+PR_INFO_JSON = os.path.join(OUTPUT_DIR, "pr-info.json")+PR_INFO_TXT = os.path.join(OUTPUT_DIR, "pr-info.txt")++# Merge-queue branches look like: gh-readonly-queue/<base_branch>/pr-<number>-<sha>+MERGE_QUEUE_PR_RE = re.compile(r"/pr-(\d+)-[0-9a-f]+$")++# Cap the number of changed files and the PR body length written to disk so the+# artifact stays small and the agent context is not flooded.+MAX_CHANGED_FILES = 100+MAX_BODY_CHARS = 4000+++def pr_number_from_run(workflow_run: "WorkflowRun") -> str:+ """Resolve the PR number behind a merge-queue run.++ Prefers the ``gh-readonly-queue/<base>/pr-<number>-<sha>`` head branch used by+ the merge queue; falls back to the run's associated ``pull_requests`` list.+ Returns an empty string when no PR can be identified.+ """+ head_branch = workflow_run.head_branch or ""+ match = MERGE_QUEUE_PR_RE.search(head_branch)+ if match:+ return match.group(1)++ try:+ pulls = workflow_run.pull_requests or []+ except Exception:+ pulls = []+ if pulls:+ return str(pulls[0].number)++ return ""+++def changed_files(pull: "PullRequest") -> list[str]:+ """Return up to ``MAX_CHANGED_FILES`` changed file paths for the PR."""+ files: list[str] = []+ try:+ for changed in pull.get_files():+ files.append(changed.filename)+ if len(files) >= MAX_CHANGED_FILES:+ break+ except Exception:+ return files+ return files+++def build_pr_info(pull: "PullRequest") -> dict[str, Any]:+ """Assemble the serialisable PR metadata dictionary."""+ body = pull.body or ""+ if len(body) > MAX_BODY_CHARS:+ body = body[:MAX_BODY_CHARS] + "\n...(truncated)..."++ author = pull.user.login if pull.user else ""+ author_url = pull.user.html_url if pull.user else ""++ return {+ "pr_number": str(pull.number),+ "pr_url": pull.html_url,+ "title": pull.title or "",+ "author": author,+ "author_url": author_url,+ "base_branch": pull.base.ref if pull.base else "",+ "head_ref": pull.head.ref if pull.head else "",+ "head_sha": pull.head.sha if pull.head else "",+ "state": pull.state or "",+ "draft": bool(pull.draft),+ "merged": bool(pull.merged),+ "labels": [label.name for label in pull.labels],+ "changed_files": changed_files(pull),+ "body": body,+ }+++def write_outputs(pr_info: dict[str, Any] | None) -> None:+ """Write the JSON and human-readable PR-info artifacts to ``OUTPUT_DIR``."""+ with open(PR_INFO_JSON, "w", encoding="utf-8") as handle:+ json.dump(pr_info or {}, handle, indent=2)++ with open(PR_INFO_TXT, "w", encoding="utf-8") as handle:+ if not pr_info:+ handle.write("No pull request could be associated with this merge-queue run.\n")+ handle.write("Leave the Teams PR / Author fields unset (use 'not_found').\n")+ return+ handle.write("=== CI Doctor: Pull Request Info ===\n")+ handle.write(f"PR number: {pr_info['pr_number']}\n")+ handle.write(f"PR URL: {pr_info['pr_url']}\n")+ handle.write(f"Title: {pr_info['title']}\n")+ handle.write(f"Author: {pr_info['author']}\n")+ handle.write(f"Author URL: {pr_info['author_url']}\n")+ handle.write(f"Base branch: {pr_info['base_branch']}\n")+ handle.write(f"Head ref: {pr_info['head_ref']}\n")+ handle.write(f"Head SHA: {pr_info['head_sha']}\n")+ handle.write(f"State: {pr_info['state']} (draft={pr_info['draft']}, merged={pr_info['merged']})\n")+ handle.write(f"Labels: {', '.join(pr_info['labels']) or '(none)'}\n")+ handle.write("\n")+ handle.write(f"Changed files ({len(pr_info['changed_files'])}, capped at {MAX_CHANGED_FILES}):\n")+ for path in pr_info["changed_files"]:+ handle.write(f" {path}\n")+++def persist_pull(repo: "Repository", pr_number: str) -> None:+ """Fetch PR ``pr_number`` and persist its metadata (or the no-PR fallback)."""+ try:+ pull = repo.get_pull(int(pr_number))+ except Exception as error:+ print(f"Could not fetch PR #{pr_number}: {error}")+ write_outputs(None)+ return++ pr_info = build_pr_info(pull)+ write_outputs(pr_info)+ print(f"Wrote PR info to {PR_INFO_JSON} and {PR_INFO_TXT}")+ print(f" PR #{pr_info['pr_number']} by @{pr_info['author']}: {pr_info['title']}")+++def run_mode(repo: "Repository", run_id: str) -> None:+ """Resolve and persist the PR metadata behind a merge-queue run."""+ print(f"=== CI Doctor: Collecting PR info for run {run_id} ===")++ try:+ workflow_run = repo.get_workflow_run(int(run_id))+ except Exception as error:+ print(f"Could not fetch workflow run {run_id}: {error}")+ write_outputs(None)+ return++ pr_number = pr_number_from_run(workflow_run)+ if not pr_number:+ print(f"Could not identify a PR for run {run_id} (head branch: {workflow_run.head_branch!r})")+ write_outputs(None)+ return+ print(f"Resolved PR #{pr_number} from run {run_id}")++ persist_pull(repo, pr_number)+++def pr_mode(repo: "Repository", pr_number: str) -> None:+ """Persist the PR metadata for an already-known PR number."""+ print(f"=== CI Doctor: Collecting PR info for PR #{pr_number} ===")+ persist_pull(repo, pr_number)+++def main() -> None:+ os.makedirs(OUTPUT_DIR, exist_ok=True)++ repo_name = os.environ.get("REPO", "")+ run_id = (os.environ.get("RUN_ID") or "").strip()+ pr_number = (os.environ.get("PR_NUMBER") or "").strip()+ token = os.environ.get("GH_TOKEN", "")++ if not run_id and not pr_number:+ print("Neither RUN_ID nor PR_NUMBER is set; no PR to collect info for.")+ write_outputs(None)+ return++ repo = github_client(token).get_repo(repo_name)++ if run_id:+ run_mode(repo, run_id)+ else:+ pr_mode(repo, pr_number)+++if __name__ == "__main__":+ main()diff --git a/.github/workflows/ci-doctor-mq.lock.yml b/.github/workflows/ci-doctor-mq.lock.ymlindex 1f9ad93788d..6f3e37e4b91 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":"91233e936b75a0c51f19fe12afec70e1e7fd16b1eece9c4d72710ea1322da038","body_hash":"5453aae8ea48a65fa83acd89b195dc9b2a39c963a88c3fd299c096fe39116194","compiler_version":"v0.83.4","strict":true,"agent_id":"copilot","agent_model":"claude-sonnet-4.6","engine_versions":{"copilot":"1.0.75"}}+# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"79269a3e320777227e3dcac4c9a79d80fea35620def7389e18c274ccb4e76855","body_hash":"d095ba411012ec8f903cad9fc79c9fffc14a64b18f7813d06c120c97ef0bca31","compiler_version":"v0.83.4","strict":true,"agent_id":"copilot","agent_model":"claude-sonnet-4.6","engine_versions":{"copilot":"1.0.75"}}# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN","MERGE_QUEUE_TOKEN","TEAMS_WEBHOOK_URL"],"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/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"820762786026740c76f36085b0efc47a31fe5020","version":"v7.0.0"},{"repo":"actions/setup-python","sha":"a309ff8b426b58ec0e2a45f0f869d46889d02405","version":"a309ff8b426b58ec0e2a45f0f869d46889d02405"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"e89c65e17eb281bbd5ff2ff9e9199a03e96654c7","version":"v0.83.4"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.42","digest":"sha256:26a8af4e5566485b02f52af59ee03803ae798271a9619d4767e94d07806deb9b","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.42@sha256:26a8af4e5566485b02f52af59ee03803ae798271a9619d4767e94d07806deb9b"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.42","digest":"sha256:944f2686c9ab9bec338fd14b662461662f77cd12cd0ea8a3e7cb8c0987cd1607","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.42@sha256:944f2686c9ab9bec338fd14b662461662f77cd12cd0ea8a3e7cb8c0987cd1607"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.42","digest":"sha256:42dfeb649c680a8558cd5423dbc530b653a69413e35ffbe5e71da5d48c94bdf0","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.42@sha256:42dfeb649c680a8558cd5423dbc530b653a69413e35ffbe5e71da5d48c94bdf0"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.4.6","digest":"sha256:fecabec51bbc41f2ad61076d6bcd9a36ef23b142e672a444e054d37fc29de93c","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.4.6@sha256:fecabec51bbc41f2ad61076d6bcd9a36ef23b142e672a444e054d37fc29de93c"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:a8082161d7dceda14b68f32eb39d0eaa96b825d07f5895b096afab9d9e0c7748","pinned_image":"ghcr.io/github/gh-aw-node@sha256:a8082161d7dceda14b68f32eb39d0eaa96b825d07f5895b096afab9d9e0c7748"},{"image":"ghcr.io/github/github-mcp-server:v1.7.0","digest":"sha256:c491ffdf6f4c85cb5397021bc655edb8ab825c6f5f568e7597d77a1bd7c4d308","pinned_image":"ghcr.io/github/github-mcp-server:v1.7.0@sha256:c491ffdf6f4c85cb5397021bc655edb8ab825c6f5f568e7597d77a1bd7c4d308"}]}# This file was automatically generated by gh-aw (v0.83.4). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md#@@ -30,6 +30,7 @@## Resolved workflow manifest:# Imports:+# - shared/agentic-workflows/collect-pr-info.md# - shared/agentic-workflows/download-failure-logs.md# - shared/agentic-workflows/notify-teams-recurring.md# - shared/agentic-workflows/notify-teams.md@@ -304,21 +305,21 @@ jobs:run: |bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh"{- cat << 'GH_AW_PROMPT_59c26a7edc451954_EOF'+ cat << 'GH_AW_PROMPT_80adda4f0469ae64_EOF'<system>- GH_AW_PROMPT_59c26a7edc451954_EOF+ GH_AW_PROMPT_80adda4f0469ae64_EOFcat "${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_59c26a7edc451954_EOF'+ cat << 'GH_AW_PROMPT_80adda4f0469ae64_EOF'<safe-output-tools>Tools: add_comment, missing_tool, missing_data, noop, notify_teams, notify_teams_recurring, readd_to_merge_queue, rerun_failed_jobs</safe-output-tools>- GH_AW_PROMPT_59c26a7edc451954_EOF+ GH_AW_PROMPT_80adda4f0469ae64_EOFcat "${RUNNER_TEMP}/gh-aw/prompts/mcp_cli_tools_prompt.md"- cat << 'GH_AW_PROMPT_59c26a7edc451954_EOF'+ cat << 'GH_AW_PROMPT_80adda4f0469ae64_EOF'<github-context>The following GitHub context information is available for this workflow:{{#if github.actor}}@@ -347,17 +348,18 @@ jobs:{{/if}}</github-context>- GH_AW_PROMPT_59c26a7edc451954_EOF+ GH_AW_PROMPT_80adda4f0469ae64_EOFcat "${RUNNER_TEMP}/gh-aw/prompts/github_mcp_tools_with_safeoutputs_prompt.md"- cat << 'GH_AW_PROMPT_59c26a7edc451954_EOF'+ cat << 'GH_AW_PROMPT_80adda4f0469ae64_EOF'</system>{{#runtime-import .github/workflows/shared/agentic-workflows/download-failure-logs.md}}+ {{#runtime-import .github/workflows/shared/agentic-workflows/collect-pr-info.md}}{{#runtime-import .github/workflows/shared/agentic-workflows/notify-teams.md}}{{#runtime-import .github/workflows/shared/agentic-workflows/notify-teams-recurring.md}}{{#runtime-import .github/workflows/shared/agentic-workflows/rerun-failed-jobs.md}}{{#runtime-import .github/workflows/shared/agentic-workflows/readd-to-merge-queue.md}}{{#runtime-import .github/workflows/ci-doctor-mq.md}}- GH_AW_PROMPT_59c26a7edc451954_EOF+ GH_AW_PROMPT_80adda4f0469ae64_EOF} > "$GH_AW_PROMPT"- name: Interpolate variables and render templatesuses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0@@ -559,7 +561,7 @@ jobs:with:python-version: "3.13"- name: Install PyGithub- run: python -m pip install --quiet PyGithub+ run: python -m pip install --quiet PyGithub==2.9.1- env:GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}PR_NUMBER: ${{ github.event.issue.number }}@@ -569,6 +571,21 @@ jobs:run: |export PYTHONPATH=.github/scripts/agentic-workflows/:${PYTHONPATH}python .github/scripts/agentic-workflows/download_failure_logs.py+ - name: Set up Python+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # a309ff8b426b58ec0e2a45f0f869d46889d02405+ with:+ python-version: "3.13"+ - name: Install PyGithub+ run: python -m pip install --quiet PyGithub==2.9.1+ - env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ PR_NUMBER: ${{ github.event.issue.number }}+ REPO: ${{ github.repository }}+ RUN_ID: ${{ github.event.workflow_run.id || github.event.inputs.run_id }}+ name: Collect PR info+ run: |+ export PYTHONPATH=.github/scripts/agentic-workflows/:${PYTHONPATH}+ python .github/scripts/agentic-workflows/collect_pr_info.py- name: Configure Git credentialsenv:@@ -2014,7 +2031,7 @@ jobs:with:python-version: "3.13"- name: Install PyGithub- run: python -m pip install --quiet PyGithub+ run: python -m pip install --quiet PyGithub==2.9.1env:GH_AW_AGENT_OUTPUT: ${{ runner.temp }}/gh-aw/safe-jobs/agent_output.json- name: Re-add pull request to merge queue@@ -2055,7 +2072,7 @@ jobs:with:python-version: "3.13"- name: Install PyGithub- run: python -m pip install --quiet PyGithub+ run: python -m pip install --quiet PyGithub==2.9.1env:GH_AW_AGENT_OUTPUT: ${{ runner.temp }}/gh-aw/safe-jobs/agent_output.json- name: Re-run failed jobsdiff --git a/.github/workflows/ci-doctor-mq.md b/.github/workflows/ci-doctor-mq.mdindex 956482e4c83..3b9a65337f8 100644--- a/.github/workflows/ci-doctor-mq.md+++ b/.github/workflows/ci-doctor-mq.md@@ -46,6 +46,7 @@ network: defaultsimports:- shared/agentic-workflows/download-failure-logs.md+ - shared/agentic-workflows/collect-pr-info.md- shared/agentic-workflows/notify-teams.md- shared/agentic-workflows/notify-teams-recurring.md- shared/agentic-workflows/rerun-failed-jobs.md@@ -103,6 +104,7 @@ Logs have been pre-downloaded before this session started:- **Job metadata**: `/tmp/gh-aw/agent/ci-doctor/logs/failed-jobs.json` — structured list of failed jobs and their failed steps- **Log files**: `/tmp/gh-aw/agent/ci-doctor/logs/job-<job-id>.log` — full job logs downloaded from GitHub Actions- **Hint files**: `/tmp/gh-aw/agent/ci-doctor/filtered/*-hints.txt` — pre-located error lines (from logs) via generic grep heuristics+- **PR info**: `/tmp/gh-aw/agent/ci-doctor/pr-info.json` (structured) and `/tmp/gh-aw/agent/ci-doctor/pr-info.txt` (human-readable) — the pull request behind this merge-queue run, resolved before the session. Includes `pr_number`, `pr_url`, `author`, `title`, `base_branch`, `head_sha`, `labels`, and the list of `changed_files`. **Use these values verbatim for the analysis and safe-outputs.** If the file is empty (`{}`) or `pr-info.txt` says no PR could be associated, treat the PR/Author fields as `not_found` and skip `add_comment`. Prefer the `changed_files` list when scoping PR-diff source inspection (Phase 4).**Start here**: Read `/tmp/gh-aw/agent/ci-doctor/summary.txt` first — it lists every file location and the first few hint matches. Then examine the relevant hint files to jump directly to error locations (read ~50 lines around each hinted line number before loading the full log).@@ -513,7 +515,7 @@ Additionally, **when the failure is associated with a PR in the merge queue**, pPost a concise, actionable remediation comment on the affected merge-queue PR so the author has the context and next steps. Call `add_comment` **at most once per investigation** and **only** when a PR can be identified.-- **`item_number`** (required) — The number of the affected PR in the merge queue (the same value reported as `notify_teams.pr_number`). This is required because the `workflow_run` trigger carries no PR context; the comment cannot be posted without it.+- **`item_number`** (required) — The number of the affected PR in the merge queue (the `pr_number` from `/tmp/gh-aw/agent/ci-doctor/pr-info.json`, i.e. the same value reported as `notify_teams.pr_number`). This is required because the `workflow_run` trigger carries no PR context; the comment cannot be posted without it. If `pr-info.json` identifies no PR, skip the comment.- **`body`** (required) — Markdown comment body. Keep it focused and short. GitHub renders standard Markdown here (headings, bold, inline code, fenced code blocks with backticks, lists, links). Use this structure:@@ -563,9 +565,9 @@ Provide all required fields and include the optional PR-related fields whenever- **`failed_workflow`** (required) — Name of the workflow whose run is being investigated, taken from `get_workflow_run` (field `name`). For example: `Linux (Ubuntu 22.04, Python 3.11)`. Never pass the name of this CI Failure Doctor MQ workflow itself.-- **`pr_number`** / **`pr_url`** (optional) — Provide both together when the failure is associated with a PR in the merge queue. Omit both if no PR can be identified.+- **`pr_number`** / **`pr_url`** (optional) — Read both directly from the pre-collected `/tmp/gh-aw/agent/ci-doctor/pr-info.json` (`pr_number`, `pr_url`). Provide them together whenever that file identifies a PR. Omit both only if the file is empty (`{}`) or no PR could be resolved. Do not re-derive these from the run metadata yourself.-- **`author`** (optional) — GitHub login of the PR author or commit author when known. Omit if it cannot be determined from the workflow run / PR metadata.+- **`author`** (optional) — Read from the `author` field of `/tmp/gh-aw/agent/ci-doctor/pr-info.json`. Omit only if the file has no PR / empty `author`.- **`db_entries`** (required) — Current total number of unique entries in the CI Doctor MQ investigation database. Compute it during Phase 5 by counting distinct files under `/tmp/gh-aw/repo-memory/default/mq/investigations/` (including the one this run just wrote) and pass the resulting non-negative integer as a string (e.g., `"42"`). If the directory does not yet exist, report `"0"` (or `"1"` if you just created the first entry). Note: counting files under any path other than `/tmp/gh-aw/repo-memory/default/mq/investigations/` will give a wrong result.diff --git a/.github/workflows/ci-doctor.lock.yml b/.github/workflows/ci-doctor.lock.ymlindex 931826d6401..03ca115e860 100644--- a/.github/workflows/ci-doctor.lock.yml+++ b/.github/workflows/ci-doctor.lock.yml@@ -1,4 +1,4 @@-# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"601670df52628f3a501a81a2be85b4dacfeee7b7236cba8876cb12a4e23e2a56","body_hash":"a6cc2a4ac576c7af73935a6cc80ed1430c0afb343a3315d40825980d05205d78","compiler_version":"v0.83.4","strict":true,"agent_id":"copilot","agent_model":"claude-sonnet-4.6","engine_versions":{"copilot":"1.0.75"}}+# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"f5c472697e086d84786a7f9158f04eb08fecab68f36a85814bf083f8f755fa2d","body_hash":"771cef4e62ce41f2c011349a6bf4f2c3f5f2ce7f7786414e180ab94f3e5c6d2e","compiler_version":"v0.83.4","strict":true,"agent_id":"copilot","agent_model":"claude-sonnet-4.6","engine_versions":{"copilot":"1.0.75"}}# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/cache/save","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"820762786026740c76f36085b0efc47a31fe5020","version":"v7.0.0"},{"repo":"actions/setup-python","sha":"a309ff8b426b58ec0e2a45f0f869d46889d02405","version":"a309ff8b426b58ec0e2a45f0f869d46889d02405"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"e89c65e17eb281bbd5ff2ff9e9199a03e96654c7","version":"v0.83.4"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.42","digest":"sha256:26a8af4e5566485b02f52af59ee03803ae798271a9619d4767e94d07806deb9b","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.42@sha256:26a8af4e5566485b02f52af59ee03803ae798271a9619d4767e94d07806deb9b"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.42","digest":"sha256:944f2686c9ab9bec338fd14b662461662f77cd12cd0ea8a3e7cb8c0987cd1607","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.42@sha256:944f2686c9ab9bec338fd14b662461662f77cd12cd0ea8a3e7cb8c0987cd1607"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.42","digest":"sha256:42dfeb649c680a8558cd5423dbc530b653a69413e35ffbe5e71da5d48c94bdf0","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.42@sha256:42dfeb649c680a8558cd5423dbc530b653a69413e35ffbe5e71da5d48c94bdf0"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.4.6","digest":"sha256:fecabec51bbc41f2ad61076d6bcd9a36ef23b142e672a444e054d37fc29de93c","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.4.6@sha256:fecabec51bbc41f2ad61076d6bcd9a36ef23b142e672a444e054d37fc29de93c"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:a8082161d7dceda14b68f32eb39d0eaa96b825d07f5895b096afab9d9e0c7748","pinned_image":"ghcr.io/github/gh-aw-node@sha256:a8082161d7dceda14b68f32eb39d0eaa96b825d07f5895b096afab9d9e0c7748"},{"image":"ghcr.io/github/github-mcp-server:v1.7.0","digest":"sha256:c491ffdf6f4c85cb5397021bc655edb8ab825c6f5f568e7597d77a1bd7c4d308","pinned_image":"ghcr.io/github/github-mcp-server:v1.7.0@sha256:c491ffdf6f4c85cb5397021bc655edb8ab825c6f5f568e7597d77a1bd7c4d308"}]}# This file was automatically generated by gh-aw (v0.83.4). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md#@@ -31,6 +31,7 @@## Resolved workflow manifest:# Imports:+# - shared/agentic-workflows/collect-pr-info.md# - shared/agentic-workflows/download-failure-logs.md## Secrets used:@@ -307,21 +308,21 @@ jobs:run: |bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh"{- cat << 'GH_AW_PROMPT_9e795131ebc398eb_EOF'+ cat << 'GH_AW_PROMPT_43d9e550ac842c4b_EOF'<system>- GH_AW_PROMPT_9e795131ebc398eb_EOF+ GH_AW_PROMPT_43d9e550ac842c4b_EOFcat "${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_9e795131ebc398eb_EOF'+ cat << 'GH_AW_PROMPT_43d9e550ac842c4b_EOF'<safe-output-tools>Tools: add_comment, missing_tool, missing_data, noop</safe-output-tools>- GH_AW_PROMPT_9e795131ebc398eb_EOF+ GH_AW_PROMPT_43d9e550ac842c4b_EOFcat "${RUNNER_TEMP}/gh-aw/prompts/mcp_cli_tools_prompt.md"- cat << 'GH_AW_PROMPT_9e795131ebc398eb_EOF'+ cat << 'GH_AW_PROMPT_43d9e550ac842c4b_EOF'<github-context>The following GitHub context information is available for this workflow:{{#if github.actor}}@@ -350,16 +351,17 @@ jobs:{{/if}}</github-context>- GH_AW_PROMPT_9e795131ebc398eb_EOF+ GH_AW_PROMPT_43d9e550ac842c4b_EOFcat "${RUNNER_TEMP}/gh-aw/prompts/github_mcp_tools_with_safeoutputs_prompt.md"if [ "$GITHUB_EVENT_NAME" = "issue_comment" ] && [ -n "$GH_AW_IS_PR_COMMENT" ] || [ "$GITHUB_EVENT_NAME" = "pull_request_review_comment" ] || [ "$GITHUB_EVENT_NAME" = "pull_request_review" ]; thencat "${RUNNER_TEMP}/gh-aw/prompts/pr_context_prompt.md"fi- cat << 'GH_AW_PROMPT_9e795131ebc398eb_EOF'+ cat << 'GH_AW_PROMPT_43d9e550ac842c4b_EOF'</system>{{#runtime-import .github/workflows/shared/agentic-workflows/download-failure-logs.md}}+ {{#runtime-import .github/workflows/shared/agentic-workflows/collect-pr-info.md}}{{#runtime-import .github/workflows/ci-doctor.md}}- GH_AW_PROMPT_9e795131ebc398eb_EOF+ GH_AW_PROMPT_43d9e550ac842c4b_EOF} > "$GH_AW_PROMPT"- name: Interpolate variables and render templatesuses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0@@ -548,7 +550,7 @@ jobs:with:python-version: "3.13"- name: Install PyGithub- run: python -m pip install --quiet PyGithub+ run: python -m pip install --quiet PyGithub==2.9.1- env:GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}PR_NUMBER: ${{ github.event.issue.number }}@@ -558,6 +560,21 @@ jobs:run: |export PYTHONPATH=.github/scripts/agentic-workflows/:${PYTHONPATH}python .github/scripts/agentic-workflows/download_failure_logs.py+ - name: Set up Python+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # a309ff8b426b58ec0e2a45f0f869d46889d02405+ with:+ python-version: "3.13"+ - name: Install PyGithub+ run: python -m pip install --quiet PyGithub==2.9.1+ - env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ PR_NUMBER: ${{ github.event.issue.number }}+ REPO: ${{ github.repository }}+ RUN_ID: ${{ github.event.workflow_run.id || github.event.inputs.run_id }}+ name: Collect PR info+ run: |+ export PYTHONPATH=.github/scripts/agentic-workflows/:${PYTHONPATH}+ python .github/scripts/agentic-workflows/collect_pr_info.py- name: Configure Git credentialsenv:diff --git a/.github/workflows/ci-doctor.md b/.github/workflows/ci-doctor.mdindex db02ba87590..e8a8abe5c91 100644--- a/.github/workflows/ci-doctor.md+++ b/.github/workflows/ci-doctor.md@@ -26,6 +26,7 @@ network: defaultsimports:- shared/agentic-workflows/download-failure-logs.md+ - shared/agentic-workflows/collect-pr-info.mdsafe-outputs:add-comment:@@ -64,6 +65,7 @@ Logs for the pull request's failed pipelines have been pre-downloaded before thi- **Failed jobs per run**: `/tmp/gh-aw/agent/ci-doctor/logs/run-<run-id>-failed-jobs.json`- **Log files**: `/tmp/gh-aw/agent/ci-doctor/logs/job-<job-id>.log`- **Hint files**: `/tmp/gh-aw/agent/ci-doctor/filtered/job-<job-id>-hints.txt` — pre-located error lines.+- **PR info**: `/tmp/gh-aw/agent/ci-doctor/pr-info.json` (structured) and `/tmp/gh-aw/agent/ci-doctor/pr-info.txt` (human-readable) — the pull request under investigation, resolved before the session. Includes `pr_number`, `pr_url`, `author`, `title`, `base_branch`, `head_sha`, `labels`, and the list of `changed_files`. Prefer the `changed_files` list when scoping PR-diff source inspection (Phase 4) instead of re-fetching the diff, and use `author` / `title` for context. If the file is empty (`{}`), fall back to the workflow context (`#${{ github.event.issue.number }}`).Read the hint files first and jump to ~50 lines around each hinted line number in the full log before loading the whole log.diff --git a/.github/workflows/shared/agentic-workflows/collect-pr-info.md b/.github/workflows/shared/agentic-workflows/collect-pr-info.mdnew file mode 100644index 00000000000..30dbcc44b58--- /dev/null+++ b/.github/workflows/shared/agentic-workflows/collect-pr-info.md@@ -0,0 +1,44 @@+---+description: |+ Shared pre-agent step for the CI Doctor workflows. Resolves the pull request+ under investigation and pre-collects its metadata into+ /tmp/gh-aw/agent/ci-doctor/.++ The step auto-detects its mode from the environment (no parameters required):+ - run mode (RUN_ID set): resolve the PR behind a merge-queue+ (`merge_group`) run from its `gh-readonly-queue/<base>/pr-<number>-<sha>`+ head branch (CI Doctor — Merge Queue).+ - pr mode (PR_NUMBER set): the PR number is already known, e.g. a+ `/ci-doctor` pull-request comment (CI Doctor).++ Output layout (identical in both modes):+ - /tmp/gh-aw/agent/ci-doctor/pr-info.json (structured PR metadata)+ - /tmp/gh-aw/agent/ci-doctor/pr-info.txt (human-readable summary)+steps:+ - name: Set up Python+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0+ with:+ python-version: '3.13'+ - name: Install PyGithub+ run: python -m pip install --quiet PyGithub==2.9.1+ - name: Collect PR info+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ REPO: ${{ github.repository }}+ RUN_ID: ${{ github.event.workflow_run.id || github.event.inputs.run_id }}+ PR_NUMBER: ${{ github.event.issue.number }}+ run: |+ export PYTHONPATH=.github/scripts/agentic-workflows/:${PYTHONPATH}+ python .github/scripts/agentic-workflows/collect_pr_info.py+---++<!--+Shared CI Doctor pre-analysis step. This file has no `on:` trigger, so it is a+shared workflow component: it is imported (never compiled standalone) via++ imports:+ - shared/agentic-workflows/collect-pr-info.md++Imported `steps:` are prepended to the importing workflow's own steps at compile+time. See https://github.github.com/gh-aw/reference/imports/#importing-steps+-->diff --git a/.github/workflows/shared/agentic-workflows/download-failure-logs.md b/.github/workflows/shared/agentic-workflows/download-failure-logs.mdindex 3292d2899ae..613eeee1def 100644--- a/.github/workflows/shared/agentic-workflows/download-failure-logs.md+++ b/.github/workflows/shared/agentic-workflows/download-failure-logs.md@@ -20,7 +20,7 @@ steps:with:python-version: '3.13'- name: Install PyGithub- run: python -m pip install --quiet PyGithub+ run: python -m pip install --quiet PyGithub==2.9.1- name: Download CI failure logsenv:GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}diff --git a/.github/workflows/shared/agentic-workflows/readd-to-merge-queue.md b/.github/workflows/shared/agentic-workflows/readd-to-merge-queue.mdindex 1970f9e2609..eed2b12b409 100644--- a/.github/workflows/shared/agentic-workflows/readd-to-merge-queue.md+++ b/.github/workflows/shared/agentic-workflows/readd-to-merge-queue.md@@ -38,7 +38,7 @@ safe-outputs:with:python-version: '3.13'- name: Install PyGithub- run: python -m pip install --quiet PyGithub+ run: python -m pip install --quiet PyGithub==2.9.1- name: Re-add pull request to merge queueenv:# A PAT or GitHub App token with `contents: write` anddiff --git a/.github/workflows/shared/agentic-workflows/rerun-failed-jobs.md b/.github/workflows/shared/agentic-workflows/rerun-failed-jobs.mdindex f0200fc042c..78a2162335f 100644--- a/.github/workflows/shared/agentic-workflows/rerun-failed-jobs.md+++ b/.github/workflows/shared/agentic-workflows/rerun-failed-jobs.md@@ -37,7 +37,7 @@ safe-outputs:with:python-version: '3.13'- name: Install PyGithub- run: python -m pip install --quiet PyGithub+ run: python -m pip install --quiet PyGithub==2.9.1- name: Re-run failed jobsenv:GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}diff --git a/docs/dev/ci/github_actions/agentic_workflows.md b/docs/dev/ci/github_actions/agentic_workflows.mdnew file mode 100644index 00000000000..44e81e88208--- /dev/null+++ b/docs/dev/ci/github_actions/agentic_workflows.md@@ -0,0 +1,361 @@+# Agentic Workflows++OpenVINO CI includes a set of **agentic workflows** — GitHub Actions workflows that hand control to+an AI agent to perform an investigative or maintenance task, rather than running a fixed sequence of+shell commands. At the moment there are two of them, both dedicated to diagnosing CI failures:++* [`ci-doctor.md`](../../../../.github/workflows/ci-doctor.md) — **CI Doctor**, an on-demand+ investigator for a pull request.+* [`ci-doctor-mq.md`](../../../../.github/workflows/ci-doctor-mq.md) — **CI Doctor (Merge Queue)**,+ an automatic investigator for merge-queue failures.++This document explains what they are, how they are built and invoked, the algorithm each one follows,+and the reusable jobs from [`.github/workflows/shared`](../../../../.github/workflows/shared/agentic-workflows)+that they share.++## Table of Contents++* [What is an agentic workflow](#what-is-an-agentic-workflow)+ * [The gh-aw framework](#the-gh-aw-framework)+ * [Source files and compiled lock files](#source-files-and-compiled-lock-files)+* [Workflows at a glance](#workflows-at-a-glance)+* [CI Doctor (pull request, on-demand)](#ci-doctor-pull-request-on-demand)+* [CI Doctor — Merge Queue (automatic)](#ci-doctor--merge-queue-automatic)+* [Shared reusable jobs](#shared-reusable-jobs)+* [Setup and infrastructure](#setup-and-infrastructure)+ * [Log pre-download and caching](#log-pre-download-and-caching)+ * [Repo-memory and the pattern database](#repo-memory-and-the-pattern-database)+ * [Pattern matching and recurrence detection](#pattern-matching-and-recurrence-detection)+ * [Automated re-run integration](#automated-re-run-integration)+ * [Secrets and permissions](#secrets-and-permissions)+* [Maintaining the workflows](#maintaining-the-workflows)+* [See also](#see-also)++## What is an agentic workflow++A traditional workflow describes *exactly* what to run: check out the code, install dependencies, run+a script. An **agentic workflow** instead describes a *goal* and a *protocol* in natural language, and+delegates the execution to an AI agent. The agent decides which tools to call —+reading logs, searching the repository, querying the GitHub API — to accomplish the task, subject to+the guardrails written into the workflow.++In OpenVINO both agentic workflows are **CI failure doctors**: they read the logs of a failed pipeline,+localise the root cause, classify the failure, and produce an actionable report (a PR comment or a+Microsoft Teams notification).++### The gh-aw framework++The workflows are authored with [GitHub Agentic Workflows (`gh-aw`)](https://github.github.com/gh-aw/introduction/overview/).+A `gh-aw` workflow is a Markdown file with a YAML frontmatter block and a natural-language body:++* **Frontmatter** configures the workflow the same way a normal GitHub Actions workflow is configured —+ `on:` triggers, `permissions:`, `concurrency:`, plus `gh-aw`-specific keys:+ * `engine:` — the agent runtime (`copilot`) and `model:` (`claude-sonnet-4.6`).+ * `network:` — the network policy enforced by a firewall proxy around the agent.+ * `tools:` — which tool servers the agent may use (for example the GitHub MCP server toolsets, and+ the `repo-memory` store).+ * `safe-outputs:` — the only side effects the agent is allowed to produce. The agent cannot post a+ comment or send a notification directly; it emits a structured *safe output* that a trusted,+ non-agent job then acts on.+ * `imports:` — shared job/step fragments pulled in from+ [`.github/workflows/shared`](../../../../.github/workflows/shared/agentic-workflows).+* **Body** is the agent's prompt: the mission, the investigation protocol, the output format, and the+ guardrails (for example, "read at most 10 source files" or "never write to the knowledge base").++### Source files and compiled lock files++`gh-aw` does not run the `.md` file directly. It **compiles** each `.md` into a standard GitHub Actions+workflow with the `.lock.yml` extension:++| Source (edit this) | Compiled (generated) |+| --- | --- |+| [`ci-doctor.md`](../../../../.github/workflows/ci-doctor.md) | [`ci-doctor.lock.yml`](../../../../.github/workflows/ci-doctor.lock.yml) |+| [`ci-doctor-mq.md`](../../../../.github/workflows/ci-doctor-mq.md) | [`ci-doctor-mq.lock.yml`](../../../../.github/workflows/ci-doctor-mq.lock.yml) |++The `.lock.yml` file is what GitHub Actions actually executes. It is **auto-generated — do not edit it+by hand**. After changing a `.md` source (or any imported shared file), regenerate the lock file:++```bash+gh aw compile+```++See [Maintaining the workflows](#maintaining-the-workflows) for details.++## Workflows at a glance++| | **CI Doctor** | **CI Doctor — Merge Queue** |+| --- | --- | --- |+| Source | [`ci-doctor.md`](../../../../.github/workflows/ci-doctor.md) | [`ci-doctor-mq.md`](../../../../.github/workflows/ci-doctor-mq.md) |+| Trigger | On demand: `/ci-doctor` comment on a PR | Automatic: a monitored workflow finishes a `merge_group` run with `failure` |+| Scope | **Every** failed pipeline on the PR head commit | A **single** failed merge-queue run |+| Knowledge base | Reads the MQ pattern database (read-only) | **Writes** the pattern database (investigations + patterns) |+| Output | One consolidated PR comment | Microsoft Teams notification (+ optional PR comment, re-run, re-queue) |+| Remediation | Report only | Can re-run failed jobs, re-add the PR to the merge queue, escalate recurring failures |+| Engine / model | `copilot` / `claude-sonnet-4.6` | `copilot` / `claude-sonnet-4.6` |++## CI Doctor (pull request, on-demand)++**What it is** An on-demand assistant that investigates *all* currently failing CI pipelines on a+pull request and summarises them in a single comment.++**How it is invoked** A user posts the `/ci-doctor` slash command as a comment on the pull request.+Invocation is restricted by an `if:` guard in the frontmatter to an explicit allow-list of maintainers,+so arbitrary users cannot trigger agent runs:++```yaml+on:+ slash_command:+ name: ci-doctor+ events: [pull_request_comment]++if: ${{ contains(fromJSON('["akashchi","mryzhov","akladiev","ababushk","dorloff","as-suvorov"]'), github.actor) }}+```++**What it does / benefits**++* Aggregates *every* failed pipeline on the PR head commit into **one** comment, so the author does not+ have to open each failed run individually.+* For each failure it reports a category, the failed job(s), key log excerpts, a root-cause explanation,+ and a concrete remedy.+* Cross-references the merge-queue knowledge base (read-only) to flag failures that are already known+ recurring issues, and prefers a remedy that resolved them before.+* Bounded and safe: it only ever produces a single PR comment (`safe-outputs.add-comment: max: 1`),+ and its source-code inspection is capped (≤ 10 files, ≤ 5 searches, PR-diff first).++**Algorithm.** The body defines a five-phase protocol:++1. **Initial triage** — read the pre-downloaded summary of failed pipelines; if there are none (or the+ command was not run on a PR), stop with a `noop`.+2. **Deep log analysis** — for each failed pipeline, start from the pre-located error *hints*, then read+ ~50 lines of context around each hint before loading a whole log.+3. **Historical context** — match each failure against the merge-queue pattern database to detect known+ recurring issues (strictly read-only).+4. **Root-cause investigation** — classify the failure into one of seven categories and localise it,+ within the source-inspection safeguards.+5. **Reporting** — post one consolidated comment (via the `add_comment` safe output) with an overview+ table and a per-pipeline section; otherwise `noop`/`missing_data`.++## CI Doctor — Merge Queue (automatic)++**What it is** An automatic, always-on investigator that reacts to merge-queue CI failures, builds a+persistent knowledge base of failure patterns, and escalates when the same failure keeps recurring.++**How it is triggered** It runs on the `workflow_run: completed` event of a fixed list of monitored+workflows (the Linux/Windows/Android/ARM/RISC-V/… validation pipelines), and only proceeds when the run+was a **merge-queue** run that **failed**:++```yaml+on:+ workflow_run:+ workflows: ["Linux (Ubuntu 22.04, Python 3.11)", "Windows (VS 2022, Python 3.11, Release)", ...]+ types: [completed]++if: ${{ github.event_name == 'workflow_dispatch' || (github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.event == 'merge_group') }}+```++A `workflow_dispatch` entry (with `run_id` or `link` inputs) is also provided for manual testing.++**What it does / benefits**++* **Root-cause analysis** of a single failed merge-queue run: category, failed jobs, key errors,+ explanation, confidence.+* **Knowledge building**: every investigation is written to a persistent, cross-run knowledge base so+ recurring failures accumulate statistics (`count`, `first_seen`, `last_seen`) over time.+* **Escalation**: when the same failure signature is seen **3 or more times within 12 hours**, it sends+ a second, higher-visibility Teams alert.+* **Automated remediation**: when a failure is transient it can either re-run only the failed jobs, or —+ if GitHub already dropped the PR from the queue — re-add the PR to the merge queue. These two actions+ are mutually exclusive.++**Algorithm** The body defines a seven-phase protocol:++1. **Trigger detection & triage** — verify the run is a failed `merge_group` run; otherwise exit.+2. **Deep log analysis** — hint-first log reading, same as CI Doctor.+3. **Historical context** — search prior investigations for similar signatures.+4. **Root-cause investigation** — classify into one of the seven categories, within the source-inspection+ safeguards.+5. **Pattern storage** — write the investigation record, update the append-only investigations index, and+ read-modify-write the per-signature pattern file (all validated against JSON schemas). See+ [Repo-memory and the pattern database](#repo-memory-and-the-pattern-database).+ * **5.5 Recurrence check** — if ≥ 3 hits in the last 12 h, prepare a recurring-failure escalation.+6. **Reporting** — compose the investigation report.+7. **Output validation** — normalise the safe-output payload (all numeric-looking fields must be+ strings) before emitting it.++The run always ends by calling exactly one (or a valid combination) of the safe outputs: `notify_teams`,+`notify_teams_recurring`, `add_comment`, `rerun_failed_jobs`, `readd_to_merge_queue`, `noop`, or+`missing_data`.++## Shared reusable jobs++Common steps and safe-output jobs are factored into+[`.github/workflows/shared/agentic-workflows`](../../../../.github/workflows/shared/agentic-workflows)+and pulled into a workflow via the `imports:` key. Imported `steps:` are prepended to the importing+workflow, and imported `safe-outputs.jobs:` become callable safe outputs for the agent.++Each shared `.md` file defines only the job *interface and wiring* — its inputs, `permissions:`, and the+sequence of steps. The actual **logic lives in standalone Python scripts** under+[`.github/scripts/agentic-workflows`](../../../../.github/scripts/agentic-workflows) (one script per job,+plus a shared [`common.py`](../../../../.github/scripts/agentic-workflows/common.py)). A shared job step+sparse-checks-out that scripts directory, sets up Python, and runs its script, for example:++```yaml+- name: Checkout agentic-workflow scripts+ uses: actions/checkout@...+ with:+ sparse-checkout: .github/scripts/agentic-workflows+- name: Set up Python+ uses: actions/setup-python@...+- name: Send Teams notification+ shell: python+ run: |+ export PYTHONPATH=.github/scripts/agentic-workflows/:${PYTHONPATH}+ python .github/scripts/agentic-workflows/notify_teams.py+```++To change what a job *does*, edit its script under `.github/scripts/agentic-workflows/`; to change its+inputs, permissions, or step wiring, edit the shared `.md` and recompile.++| Shared file | Kind | Used by | Purpose |+| --- | --- | --- | --- |+| [`download-failure-logs.md`](../../../../.github/workflows/shared/agentic-workflows/download-failure-logs.md) | Pre-agent step | both | Pre-download failed logs and pre-locate error hints before the agent starts. |+| [`notify-teams.md`](../../../../.github/workflows/shared/agentic-workflows/notify-teams.md) | Safe-output job | MQ | Send the investigation summary to Microsoft Teams; upload the statistics artifact. |+| [`notify-teams-recurring.md`](../../../../.github/workflows/shared/agentic-workflows/notify-teams-recurring.md) | Safe-output job | MQ | Send a recurring-failure escalation alert to Teams. |+| [`rerun-failed-jobs.md`](../../../../.github/workflows/shared/agentic-workflows/rerun-failed-jobs.md) | Safe-output job | MQ | Re-run only the failed jobs of the analysed run (transient failures). |+| [`readd-to-merge-queue.md`](../../../../.github/workflows/shared/agentic-workflows/readd-to-merge-queue.md) | Safe-output job | MQ | Re-add a dropped PR to the merge queue (transient failures). |++**`download-failure-logs.md`** is a *step* fragment (it has no `on:` trigger). It auto-detects its mode+from the environment: **run mode** (`RUN_ID` set) analyses a single run; **PR mode** (`PR_NUMBER` set)+analyses every failed run on a PR head commit. In both modes it writes job logs, per-job error *hint*+files, and a `summary.txt` under `/tmp/gh-aw/agent/ci-doctor/` so the agent can start from a compact+summary instead of downloading logs itself.++**`notify-teams.md`** defines the `notify-teams` safe-output job. It reads the agent's `notify_teams`+item, renders an Adaptive Card (title, facts, description, and a pattern-database statistics table),+POSTs it to the `TEAMS_WEBHOOK_URL`, and uploads the full statistics JSON/Markdown as the+`ci-doctor-mq-statistics` artifact.++**`notify-teams-recurring.md`** defines the `notify-teams-recurring` job, used only when a failure has+recurred ≥ 3 times in 12 hours. It renders a condensed escalation card listing the affected PRs and the+recent failure runs.++**`rerun-failed-jobs.md`** defines the `rerun-failed-jobs` job (`permissions: actions: write`). It calls+the GitHub `rerun-failed-jobs` API for the analysed run, with a loop guard that refuses to re-run a run+that already has more than one attempt.++**`readd-to-merge-queue.md`** defines the `readd-to-merge-queue` job. It re-adds a dropped PR to the+queue via `gh pr merge` using the `MERGE_QUEUE_TOKEN` secret (the default `GITHUB_TOKEN` cannot+re-trigger `merge_group` check runs). It is idempotent and loop-safe: it skips PRs that are merged,+closed, draft, or already carry the CI Doctor re-add marker comment.++## Setup and infrastructure++### Log pre-download and caching++Downloading and scanning large CI logs from inside the agent is slow and burns the agent's context+window. Instead, the imported [`download-failure-logs.md`](../../../../.github/workflows/shared/agentic-workflows/download-failure-logs.md)+step runs **before** the agent and produces a compact, pre-digested view under+`/tmp/gh-aw/agent/ci-doctor/`:++* `logs/job-<id>.log` — the full log of each failed job.+* `filtered/*-hints.txt` — pre-located error lines (matched with a generic error/FAIL/panic/fatal regex),+ so the agent can jump straight to the interesting line numbers.+* `summary.txt` — the entry point the agent reads first: the failed jobs/pipelines, file locations, and+ the first few hint matches.++The agent is instructed to read the summary and hint files first, then read ~50 lines of context around+each hint, and only load a full log if the hints are insufficient.++### Repo-memory and the pattern database++CI Doctor — Merge Queue persists its knowledge across runs using the `repo-memory` tool, which mounts a+dedicated Git branch (`memory/ci-doctor-mq`) at `/tmp/gh-aw/repo-memory/default/`. Anything written+there survives indefinitely; anything written elsewhere is discarded when the runner is torn down. The+workflow uses the `mq/` subdirectory to isolate merge-queue data:++* `mq/investigations/<timestamp>-<run-id>.json` — one record per investigation.+* `mq/investigations/index.json` — an append-only aggregate index of every investigation.+* `mq/patterns/<signature-hash>.json` — one record per failure signature, with `count`, `first_seen`,+ `last_seen`, `recent_timestamps`, and the affected runs/PRs.++Every artifact conforms to a committed JSON Schema and is validated immediately after being written:++| Artifact | Schema |+| --- | --- |+| Investigation record | [`investigation.schema.json`](../../../../.github/ci-doctor-mq/schemas/investigation.schema.json) |+| Pattern record | [`pattern.schema.json`](../../../../.github/ci-doctor-mq/schemas/pattern.schema.json) |+| Investigations index | [`index.schema.json`](../../../../.github/ci-doctor-mq/schemas/index.schema.json) |++CI Doctor (the PR workflow) mounts the same branch **read-only** to detect known recurring issues, and+never writes to it.++### Pattern matching and recurrence detection++Failures are de-duplicated by a **signature hash** so that the *same* underlying error collapses into a+single pattern regardless of how many jobs hit it. The hash is derived from:++1. the **normalised primary error message** — with volatile tokens stripped out (absolute paths,+ line/column numbers, hex addresses, PIDs, timestamps, run IDs, commit SHAs, temp dirs, UUIDs, and any+ embedded job / runner / OS / shard names), and+2. the **failure category** (one of seven fixed values).++The failed job name is deliberately **excluded** from the hash — keying on it would split one error into+a separate pattern per job and break recurrence counting.++Each time a signature is seen, its pattern file is read-modified-written: `count` is incremented,+`last_seen` and `recent_timestamps` are updated, and `first_seen` is preserved. Phase 5.5 then counts+how many `recent_timestamps` fall within the last 12 hours; **3 or more** triggers the recurring-failure+Teams escalation.++### Automated re-run integration++Pattern records also carry a `rerun_search_string` that feeds the static+[`workflow_rerun`](../../../../.github/scripts/workflow_rerun) tooling. For **transient** categories+(`Flaky Test`, `Infrastructure`, `Network`, `External Service`) the agent stores a short, stable+substring taken verbatim from a real failure log line; for deterministic categories it stores `null` so+the re-runner never loops on an unfixable failure. The string is verified against the exact matcher in+[`log_analyzer.py`](../../../../.github/scripts/workflow_rerun/log_analyzer.py) — the same mechanism that+backs the static entries in+[`errors_to_look_for.json`](../../../../.github/scripts/workflow_rerun/errors_to_look_for.json).++### Secrets and permissions++Both workflows run with `permissions: read-all` for the agent itself; each *safe-output* job requests+only the narrow permission it needs. The workflows rely on the following secrets:++| Secret | Used by | Purpose |+| --- | --- | --- |+| `TEAMS_WEBHOOK_URL` | `notify-teams`, `notify-teams-recurring` | Microsoft Teams incoming webhook. |+| `MERGE_QUEUE_TOKEN` | `readd-to-merge-queue` | PAT / App token with `contents: write` + `pull_requests: write` to re-queue a PR (the default token cannot re-trigger `merge_group` runs). |+| `GITHUB_TOKEN` | log download, `rerun-failed-jobs` | Standard GitHub API access. |++## Maintaining the workflows++1. Edit the **`.md` source** (or an imported file under+ [`.github/workflows/shared`](../../../../.github/workflows/shared/agentic-workflows)) — never the+ generated `.lock.yml`.+2. Recompile:++ ```bash+ gh aw compile+ ```++ This regenerates `ci-doctor.lock.yml` / `ci-doctor-mq.lock.yml`. The lock file carries a hash of the+ frontmatter and body, so unrelated edits will not always change it.+3. Commit **both** the `.md` and the regenerated `.lock.yml` together.++When changing the merge-queue knowledge-base format, update the matching schema under+[`.github/ci-doctor-mq/schemas`](../../../../.github/ci-doctor-mq/schemas) so the in-workflow validation+stays in sync.++The repository ships an `ov-agentic-workflows` [agent skill](../../../../.agents/skills/ov-agentic-workflows/SKILL.md)+that captures these editing rules and common tasks. When you work on these workflows with an AI coding+assistant (such as GitHub Copilot), it loads the skill automatically to apply the correct procedure and+guardrails.++## See also++* [Overview of the OpenVINO GitHub Actions CI](./overview.md)+* [Reusable Workflows](./reusable_workflows.md)+* [GitHub Actions security guidelines](./security.md)+* [GitHub Agentic Workflows documentation](https://github.github.com/gh-aw/introduction/overview/)diff --git a/docs/dev/ci/github_actions/overview.md b/docs/dev/ci/github_actions/overview.mdindex 336cf447acc..b6bb29a82bf 100644--- a/docs/dev/ci/github_actions/overview.md+++ b/docs/dev/ci/github_actions/overview.md@@ -19,6 +19,7 @@ detailed instructions where necessary.* [How to add new tests](#adding-new-tests)* [Optimizing workflow based on PR changes](#optimizing-workflows-based-on-PR-changes)* [Merge Queue](#merge-queue)+* [Agentic Workflows](#agentic-workflows)## Workflows@@ -315,6 +316,14 @@ Merge Queue has several settings that are configured on a per-repository basis.If you would like to enable Merge Queue for another repository in the OpenVINO GitHub organisation, use these settings as the default ones and adjust if needed.+## Agentic Workflows++OpenVINO CI also includes **agentic workflows** — GitHub Actions workflows that delegate an+investigative or maintenance task to an AI agent instead of running a fixed script. Currently these are+the two CI failure doctors: an on-demand pull request investigator (`/ci-doctor`) and an automatic+merge-queue failure investigator. Learn more in the [Agentic Workflows](./agentic_workflows.md) document.+## See also+* [Agentic Workflows](./agentic_workflows.md)* [GitHub Actions official documentation](https://docs.github.com/en/actions)