TEST-INFRA: [ci-execution-time] Add concurrency group to CI workflow to cancel superseded runs #1697

Open
opened 2026-04-02 23:31:08 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/ci-concurrency-group
  • Commit Message: fix(ci): add concurrency group to cancel superseded CI runs on same branch
  • Milestone: v3.8.0
  • Parent Epic: #1678

Problem

The .forgejo/workflows/ci.yml workflow has no concurrency: block. When multiple commits are pushed to the same branch in quick succession (e.g., during active development or bot-driven commits), all triggered CI runs execute to completion in parallel. This wastes shared runner capacity on work that is already superseded by a newer commit.

Example impact: A branch with 5 rapid commits triggers 5 full CI runs simultaneously. The first 4 are wasted — only the 5th matters. With ~11 jobs per run, this can consume 44 unnecessary runner-minutes per push burst.

Solution

Add a top-level concurrency: block to .forgejo/workflows/ci.yml:

concurrency:
  group: ${{ forgejo.workflow }}-${{ forgejo.ref }}
  cancel-in-progress: true

This ensures that when a new run is triggered for the same branch/PR, any in-progress run for that branch is cancelled immediately.

Special handling for master/develop: Push events to protected branches should NOT cancel in-progress runs (to avoid cancelling a deploy mid-flight). Use a conditional group:

concurrency:
  group: ${{ forgejo.workflow }}-${{ forgejo.ref }}
  cancel-in-progress: ${{ forgejo.ref != 'refs/heads/master' && forgejo.ref != 'refs/heads/develop' }}

Subtasks

  • Add concurrency: block to .forgejo/workflows/ci.yml with branch-aware cancel-in-progress
  • Update features/ci_workflow_validation.feature to assert the concurrency key is present in the workflow
  • Verify the Behave scenario passes with nox -s unit_tests
  • Verify all nox stages pass

Definition of Done

  • .forgejo/workflows/ci.yml has a concurrency: block at the top level
  • cancel-in-progress is true for feature branches and false for master/develop
  • features/ci_workflow_validation.feature has a scenario asserting the concurrency block is present
  • All nox stages pass
  • Coverage >= 97%

Automated by CleverAgents Bot
Supervisor: Test Infrastructure | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/ci-concurrency-group` - **Commit Message**: `fix(ci): add concurrency group to cancel superseded CI runs on same branch` - **Milestone**: v3.8.0 - **Parent Epic**: #1678 ## Problem The `.forgejo/workflows/ci.yml` workflow has no `concurrency:` block. When multiple commits are pushed to the same branch in quick succession (e.g., during active development or bot-driven commits), all triggered CI runs execute to completion in parallel. This wastes shared runner capacity on work that is already superseded by a newer commit. **Example impact**: A branch with 5 rapid commits triggers 5 full CI runs simultaneously. The first 4 are wasted — only the 5th matters. With ~11 jobs per run, this can consume 44 unnecessary runner-minutes per push burst. ## Solution Add a top-level `concurrency:` block to `.forgejo/workflows/ci.yml`: ```yaml concurrency: group: ${{ forgejo.workflow }}-${{ forgejo.ref }} cancel-in-progress: true ``` This ensures that when a new run is triggered for the same branch/PR, any in-progress run for that branch is cancelled immediately. **Special handling for `master`/`develop`**: Push events to protected branches should NOT cancel in-progress runs (to avoid cancelling a deploy mid-flight). Use a conditional group: ```yaml concurrency: group: ${{ forgejo.workflow }}-${{ forgejo.ref }} cancel-in-progress: ${{ forgejo.ref != 'refs/heads/master' && forgejo.ref != 'refs/heads/develop' }} ``` ## Subtasks - [ ] Add `concurrency:` block to `.forgejo/workflows/ci.yml` with branch-aware `cancel-in-progress` - [ ] Update `features/ci_workflow_validation.feature` to assert the `concurrency` key is present in the workflow - [ ] Verify the Behave scenario passes with `nox -s unit_tests` - [ ] Verify all nox stages pass ## Definition of Done - [ ] `.forgejo/workflows/ci.yml` has a `concurrency:` block at the top level - [ ] `cancel-in-progress` is `true` for feature branches and `false` for `master`/`develop` - [ ] `features/ci_workflow_validation.feature` has a scenario asserting the concurrency block is present - [ ] All nox stages pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: Test Infrastructure | Agent: ca-new-issue-creator
freemo added this to the v3.8.0 milestone 2026-04-02 23:32:44 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • MoSCoW: MoSCoW/Could Have — CI/test infrastructure improvement. Could Have.

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **MoSCoW**: MoSCoW/Could Have — CI/test infrastructure improvement. Could Have. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#1697
No description provided.