From 0ebad23cb004ae990da1c6db2e884e3f2260a656 Mon Sep 17 00:00:00 2001
From: Sergio Sisternes <sergio.sisternes@epam.com>
Date: Sun, 12 Apr 2026 11:59:20 +0200
Subject: [PATCH 1/2] fix: prevent duplicate Test Improver monthly activity
 issues (#658, #673, #679)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 .github/workflows/daily-test-improver.md | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/daily-test-improver.md b/.github/workflows/daily-test-improver.md
index 9dfbb38c7..cf51ed816 100644
--- a/.github/workflows/daily-test-improver.md
+++ b/.github/workflows/daily-test-improver.md
@@ -246,7 +246,15 @@ Always do Task 7 (Update Monthly Activity Summary Issue) every run. In all comme
 
 Maintain a single open issue titled `[Test Improver] Monthly Activity {YYYY}-{MM}` as a rolling summary of all Test Improver activity for the current month.
 
-1. Search for an open `[Test Improver] Monthly Activity` issue with label `testing`. If it's for the current month, update it. If for a previous month, close it and create a new one. Read any maintainer comments - they may contain instructions or priorities; note them in memory.
+1. **Find the existing monthly issue (MANDATORY before any create)**:
+   - Determine the current month string as `YYYY-MM` (e.g. `2025-04`).
+   - Search for open issues using: `gh search issues --repo <owner>/<repo> --state open --label testing "[Test Improver] Monthly Activity" --json number,title`
+   - From the results, find any issue whose title **contains** the current `YYYY-MM` string.
+   - **If a matching issue for the current month exists: UPDATE it. Do NOT create a new issue.**
+   - If no matching issue exists for the current month but one exists for a previous month: close the old one, then create a new issue for the current month.
+   - If no matching issue exists at all: create a new issue for the current month.
+   - Read any maintainer comments on the issue - they may contain instructions or priorities; note them in memory.
+   - **NEVER create a new issue if an open issue with the current month's `YYYY-MM` already exists in its title.**
 2. **Issue body format** - use **exactly** this structure:
 
    ```markdown

From 478869ba3bf24db39240876192f427e5d4f7a751 Mon Sep 17 00:00:00 2001
From: Sergio Sisternes <sergio.sisternes@epam.com>
Date: Sun, 12 Apr 2026 12:07:29 +0200
Subject: [PATCH 2/2] =?UTF-8?q?fix:=20address=20Copilot=20review=20?=
 =?UTF-8?q?=E2=80=94=20use=20${{=20github.repository=20}}=20and=20handle?=
 =?UTF-8?q?=20multiple=20duplicates?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 .github/workflows/daily-test-improver.md | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/daily-test-improver.md b/.github/workflows/daily-test-improver.md
index cf51ed816..2ced3d7e9 100644
--- a/.github/workflows/daily-test-improver.md
+++ b/.github/workflows/daily-test-improver.md
@@ -248,13 +248,15 @@ Maintain a single open issue titled `[Test Improver] Monthly Activity {YYYY}-{MM
 
 1. **Find the existing monthly issue (MANDATORY before any create)**:
    - Determine the current month string as `YYYY-MM` (e.g. `2025-04`).
-   - Search for open issues using: `gh search issues --repo <owner>/<repo> --state open --label testing "[Test Improver] Monthly Activity" --json number,title`
-   - From the results, find any issue whose title **contains** the current `YYYY-MM` string.
-   - **If a matching issue for the current month exists: UPDATE it. Do NOT create a new issue.**
+   - Search for open issues using: `gh search issues --repo ${{ github.repository }} --state open --label testing "[Test Improver] Monthly Activity" --json number,title`
+   - From the results, collect all open issues whose title **contains** the current `YYYY-MM` string.
+   - **If exactly one matching issue for the current month exists: UPDATE it. Do NOT create a new issue.**
+   - **If multiple matching issues for the current month exist: treat the lowest-numbered issue as the canonical monthly issue, UPDATE it, and close every other current-month match as a duplicate of that canonical issue.**
+   - Before closing duplicate current-month issues, read any maintainer comments on each of them and preserve any instructions or priorities in memory, then consolidate any still-relevant details into the canonical issue update.
    - If no matching issue exists for the current month but one exists for a previous month: close the old one, then create a new issue for the current month.
    - If no matching issue exists at all: create a new issue for the current month.
-   - Read any maintainer comments on the issue - they may contain instructions or priorities; note them in memory.
-   - **NEVER create a new issue if an open issue with the current month's `YYYY-MM` already exists in its title.**
+   - Read any maintainer comments on the canonical issue - they may contain instructions or priorities; note them in memory.
+   - **NEVER create a new issue if any open issue with the current month's `YYYY-MM` already exists in its title; update the canonical issue and close duplicates instead.**
 2. **Issue body format** - use **exactly** this structure:
 
    ```markdown
