From d5ecac3fee926c3a95b2c630efdc43a8e3ebb416 Mon Sep 17 00:00:00 2001 From: Aleksei Sviridkin Date: Fri, 24 Apr 2026 14:07:16 +0300 Subject: [PATCH 1/3] docs(agents): retry CI via empty commit, not gh run rerun MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rerun attempts restart jobs under the same run_id and do not re-register into the workflow's concurrency group. When a real fix-commit lands while a rerun is in flight, cancel-in-progress cannot gate the old rerun, so two runs race to completion and operators pay CI twice. Push an empty commit (`git commit --allow-empty`) instead — it participates in the concurrency group cleanly and the next real push cancels it as expected. Add the guidance to docs/agents/contributing.md and wire a trigger in AGENTS.md so any agent asked to "rerun CI" or "retry the failed build" reaches for the empty commit first. Assisted-By: Claude Signed-off-by: Aleksei Sviridkin --- AGENTS.md | 4 ++++ docs/agents/contributing.md | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index fe9aa8e1..e238b218 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -23,6 +23,10 @@ working with the **Cozystack** project. - Read: [`overview.md`](./docs/agents/overview.md) - Action: Read relevant sections to understand project structure and conventions +- **Retrying CI after a flake** (e.g., "rerun CI", "retry the failed run", "the build flaked, kick it again") + - Read: [`contributing.md`](./docs/agents/contributing.md), section "Retrying a CI run after a flake" + - Action: Push an empty commit with `git commit --allow-empty`. Do NOT use `gh run rerun` — it bypasses the concurrency group and leaves duplicate runs in flight + - **General questions about contributing** - Read: [`contributing.md`](./docs/agents/contributing.md) - Action: Read the file to understand git workflow, commit format, PR process diff --git a/docs/agents/contributing.md b/docs/agents/contributing.md index 658dab74..89350880 100644 --- a/docs/agents/contributing.md +++ b/docs/agents/contributing.md @@ -86,6 +86,19 @@ Fill in the template at [`.github/PULL_REQUEST_TEMPLATE.md`](../../.github/PULL_ Create the PR with `gh pr create --title "type(scope): brief description" --body-file `. +## Retrying a CI run after a flake + +Do NOT use `gh run rerun --failed` (or the "Re-run failed jobs" button) on a PR branch. Push an empty commit instead: + +```bash +git commit --allow-empty --message "chore: retry CI after " +git push origin +``` + +The `.github/workflows/pull-requests.yaml` workflow is configured with `concurrency.cancel-in-progress: true`, which cancels older runs when a new push arrives on the same PR. A rerun restarts jobs under the *same* `run_id` as a new attempt, which does not re-register into the concurrency group — so if a real fix-commit lands while the rerun is in flight, both runs race to completion and operators pay twice. The empty-commit path participates in the concurrency group cleanly, so the next real push cancels it as expected. + +If you already fired `gh run rerun` and need to push a follow-up, cancel the old run manually before pushing: `gh run cancel --repo cozystack/cozystack`. + ## Fetching Unresolved Review Comments Cozystack uses GitHub review threads with resolution status. Only unresolved threads are actionable — resolved threads are already handled.