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] [GHA] [AW] Define procedure for working with `index.json` in CI Doctor (#36843)
Andrei Kashchikhin4470834a6c4d
diff --git a/.github/ci-doctor-mq/schemas/index.schema.json b/.github/ci-doctor-mq/schemas/index.schema.jsonnew file mode 100644index 00000000000..1c97af91347--- /dev/null+++ b/.github/ci-doctor-mq/schemas/index.schema.json@@ -0,0 +1,110 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "$id": "https://github.com/openvinotoolkit/openvino/.github/ci-doctor-mq/schemas/index.schema.json",+ "title": "CI Doctor MQ Investigations Index",+ "description": "Canonical structure for the append-only aggregate index maintained by the CI Failure Doctor (Merge Queue) workflow at /tmp/gh-aw/repo-memory/default/mq/investigations/index.json. This file references every investigation record ever written; it MUST only ever grow via read-modify-write and must never be recreated from scratch or overwritten in a way that drops previously recorded entries.",+ "type": "object",+ "additionalProperties": false,+ "required": [+ "schema_version",+ "total",+ "entries"+ ],+ "properties": {+ "schema_version": {+ "type": "string",+ "const": "1.0",+ "description": "Version of this index schema. Always \"1.0\"."+ },+ "total": {+ "type": "integer",+ "minimum": 0,+ "description": "Number of elements in the entries array. Must equal entries.length and must never decrease between consecutive writes."+ },+ "entries": {+ "type": "array",+ "description": "Append-only list of investigation summaries, one per recorded investigation. New entries are appended; existing entries are never removed or reordered destructively.",+ "items": {+ "$ref": "#/$defs/entry"+ }+ },+ "investigations": {+ "type": "array",+ "deprecated": true,+ "description": "Deprecated legacy alias for entries kept only for backward compatibility with historical index files. New writes MUST use entries and MUST NOT drop any element previously present here.",+ "items": {+ "$ref": "#/$defs/entry"+ }+ }+ },+ "$defs": {+ "entry": {+ "type": "object",+ "additionalProperties": false,+ "required": [+ "investigation_id",+ "run_id",+ "timestamp",+ "title",+ "category",+ "signature_hash"+ ],+ "properties": {+ "investigation_id": {+ "type": "string",+ "description": "Filesystem-safe identifier of the investigation record file (without extension): <YYYY-MM-DD-HH-MM-SS-sss>-<run-id>. May be an empty string only for legacy entries migrated from older index files."+ },+ "id": {+ "type": "string",+ "deprecated": true,+ "description": "Deprecated legacy alias for investigation_id present in some historical entries."+ },+ "run_id": {+ "type": "string",+ "minLength": 1,+ "description": "GitHub Actions run ID of the failed merge-queue workflow, encoded as a string. Must always be a non-empty string (never a bare JSON number)."+ },+ "run_url": {+ "type": "string",+ "description": "URL of the failed GitHub Actions workflow run."+ },+ "workflow_name": {+ "type": "string",+ "description": "Name of the failed workflow (e.g., \"Linux (Ubuntu 22.04, Python 3.11)\")."+ },+ "timestamp": {+ "type": "string",+ "description": "ISO 8601 UTC time the investigation was produced (e.g., 2026-05-12T14:30:00Z). May be an empty string only for legacy entries migrated from older index files."+ },+ "title": {+ "type": "string",+ "description": "Short, searchable failure description. May be an empty string only for legacy entries migrated from older index files."+ },+ "category": {+ "type": "string",+ "enum": [+ "Code Issue",+ "Infrastructure",+ "Dependencies",+ "Configuration",+ "Flaky Test",+ "External Service",+ "Network"+ ],+ "description": "Failure category. Must be one of the seven canonical categories."+ },+ "signature_hash": {+ "type": "string",+ "description": "Hash of the failure signature; matches the pattern file name <signature-hash>.json. May be an empty string only for legacy entries migrated from older index files."+ },+ "pr_number": {+ "type": [+ "string",+ "null"+ ],+ "description": "Affected merge-queue PR number encoded as a string, or null when no PR can be identified. Prefer a string; a bare JSON number is tolerated only in legacy entries."+ }+ }+ }+ }+}\ No newline at end of filediff --git a/.github/workflows/ci-doctor-mq.lock.yml b/.github/workflows/ci-doctor-mq.lock.ymlindex c0730cbb321..27bd892df14 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":"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-metadata: {"schema_version":"v4","frontmatter_hash":"92a2828636c9ba8348f197a5ddedf84fe5ee9a1f7de0fef9717a2c05ad519a7e","body_hash":"d27390144e24c8796d074263a2b421cfc68ae47aa961accad44583e02977c2e9","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#diff --git a/.github/workflows/ci-doctor-mq.md b/.github/workflows/ci-doctor-mq.mdindex b594cf3167a..5c4169e4438 100644--- a/.github/workflows/ci-doctor-mq.md+++ b/.github/workflows/ci-doctor-mq.md@@ -294,15 +294,17 @@ Logs have been pre-downloaded before this session started:Every JSON artefact this phase writes MUST conform to a fixed JSON Schema committed in the repository. The repository is sparse-checked-out at the path reported as **workspace** in the Current Context (environment variable `GITHUB_WORKSPACE`). The schemas are:- **Investigation records** → `${GITHUB_WORKSPACE}/.github/ci-doctor-mq/schemas/investigation.schema.json`- Applies to every file under `investigations/` **except** `index.json`.+ Applies to every `<timestamp>-<run-id>.json` file under `investigations/` **except** the aggregate `index.json`.- **Pattern records** → `${GITHUB_WORKSPACE}/.github/ci-doctor-mq/schemas/pattern.schema.json`Applies to every `<signature-hash>.json` file under `patterns/`.+- **Investigations index** → `${GITHUB_WORKSPACE}/.github/ci-doctor-mq/schemas/index.schema.json`+ Applies to the single aggregate `investigations/index.json` file.-Rules that apply to both artefact types:+Rules that apply to all artefact types:- Read the relevant schema file **before** composing an artefact so the structure and field names match exactly. Do not invent your own field names or layout — the previous lack of a schema is the reason older investigation/pattern files had inconsistent structures.- Set `"schema_version": "1.0"` on every artefact you write.-- Both schemas declare `"additionalProperties": false`. Do **not** add fields that are not defined in the schema — extra fields make the artefact invalid.+- These schemas declare `"additionalProperties": false`. Do **not** add fields that are not defined in the schema — extra fields make the artefact invalid.- Use the exact field names, types, and `enum` values from the schema. `category` must be one of the seven categories; `confidence` must be `High`/`Medium`/`Low`.- Timestamp **values** inside JSON use full ISO 8601 with colons (e.g., `2026-05-12T14:30:00Z`); only **file names** use the colon-free `YYYY-MM-DD-HH-MM-SS-sss` form.@@ -322,7 +324,42 @@ Rules that apply to both artefact types:- **Important**: Use filesystem-safe timestamp format `YYYY-MM-DD-HH-MM-SS-sss` (e.g., `2026-02-12-11-20-45-458`)- **Do NOT use** ISO 8601 format with colons (e.g., `2026-02-12T11:20:45.458Z`) - colons are not safe in filenames- Store error patterns in `/tmp/gh-aw/repo-memory/default/mq/patterns/` as `.json` files (one file per failure signature, e.g., `<signature-hash>.json`), each conforming to the **pattern schema** (`pattern.schema.json`)- - Maintain an index of all investigations as a `.json` file (e.g., `/tmp/gh-aw/repo-memory/default/mq/investigations/index.json`) for fast searching+ - Update the investigations index at `/tmp/gh-aw/repo-memory/default/mq/investigations/index.json` following the **MANDATORY append-only read-modify-write procedure** in step 1a below. Never recreate this file from scratch.++1a. **Update Investigations Index — MANDATORY append-only read-modify-write procedure**:++ The index at `/tmp/gh-aw/repo-memory/default/mq/investigations/index.json` is a single **append-only** aggregate that references every investigation ever recorded. It MUST conform to the **index schema** (`index.schema.json`). Losing or overwriting previously recorded entries is a **critical data-loss bug** — the following procedure exists specifically to prevent it, and you MUST follow it exactly.++ **Step A — Read the existing index (never skip):**+ - Attempt to read `/tmp/gh-aw/repo-memory/default/mq/investigations/index.json`.+ - If it exists, parse it as JSON into `existing`. If it exists but fails to parse (corrupted/truncated), **do NOT overwrite it**: copy it aside to `index.corrupt-<timestamp>.json`, then reconstruct `existing.entries` by scanning every `*.json` investigation record already present under `investigations/` (excluding `index.json` itself) so no prior investigation is dropped.+ - If the file does NOT exist, set `existing = { "schema_version": "1.0", "total": 0, "entries": [] }`.+ - Normalize legacy shapes: if `existing` has a deprecated `investigations` array, merge its elements into `existing.entries` (deduplicating by `investigation_id`+`run_id`) and drop the `investigations` key. Map any legacy `id` field to `investigation_id`.+ - Record `PREV_COUNT = length(existing.entries)`.++ **Step B — Append the current investigation (never remove or replace prior entries):**+ - Build the new entry from the investigation you just wrote, using the fields defined in `index.schema.json`: `investigation_id`, `run_id` (string), `timestamp`, `title`, `category`, `signature_hash`, and `pr_number` (string or null).+ - If an entry with the same `investigation_id` already exists, update that one entry in place; otherwise **append** the new entry to the end of `existing.entries`.+ - Under no circumstances truncate, replace wholesale, reorder-destructively, or shrink `existing.entries`. The only allowed mutations are: appending a new entry, or updating a single matching existing entry in place.++ **Step C — Recompute and write:**+ - Set `total = length(entries)`.+ - Assert the **never-shrink invariant**: `total >= PREV_COUNT`. If this assertion fails, you have a bug — stop, re-read the existing file, and redo from Step A. Do NOT write a smaller index.+ - Write the object `{ schema_version: "1.0", total, entries }` back to `index.json`, overwriting the file with the **superset** you just computed.++ **Step D — MANDATORY verification (read-back check):**+ - Read `index.json` back, parse it, and validate against `index.schema.json` (see the validation procedure in the "Artefact schemas" block).+ - Verify `total == length(entries)` and `total >= PREV_COUNT`.+ - Verify the current investigation's `investigation_id` is present in `entries` exactly once.+ - Verify every entry that was in the pre-write `existing.entries` is still present (no prior entry was dropped).+ - If any check fails, **do not leave the shrunken/invalid index on disk** — restore from the pre-write copy and redo from Step A.++ **Common failure modes to avoid:**+ - Recreating `index.json` from scratch (e.g., writing only the current entry) — this destroys all history.+ - Skipping Step A and overwriting instead of appending.+ - Writing a `total` smaller than the previous run's `total`.+ - Dropping the deprecated `investigations` array's contents instead of merging them into `entries`.+2. **Update Pattern Database — MANDATORY read-modify-write procedure**:Each failure signature gets exactly one JSON file at `/tmp/gh-aw/repo-memory/default/mq/patterns/<signature-hash>.json`.