Skip to content

fix: add concurrency group to child-repo-sync workflow - #57

Merged
mateodelnorte merged 2 commits into
mainfrom
fix/sync-concurrency-group
Mar 25, 2026
Merged

mateodelnorte merged 2 commits into
mainfrom
fix/sync-concurrency-group

Conversation

@mateodelnorte

@mateodelnorte mateodelnorte commented Mar 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds concurrency: { group: child-repo-sync, cancel-in-progress: false } to on-child-update.yml
  • When multiple child repos merge simultaneously, their sync runs now queue instead of racing

Problem

Merging 5 repos at once triggered 5+ concurrent on-child-update runs. Multiple runs tried to push the same branch name simultaneously, causing push failures and orphaned duplicate PRs (e.g., #54, #55).

The existing idempotency logic handles some race conditions but fails when the winning run's PR isn't visible yet to the losers' find_existing_pr check.

Fix

cancel-in-progress: false ensures runs queue and execute sequentially — each gets a clean shot at creating its sync branch and PR without contention.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Improved workflow concurrency management to ensure sequential execution of critical synchronization operations and prevent interruption of in-progress runs.

When multiple child repos merge simultaneously, their notify chains
fire concurrent on-child-update runs that race to push the same
branch name. This causes push failures and duplicate PRs.

Adding a concurrency group queues the runs instead of racing them,
so each sync PR is created cleanly in sequence.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Mar 25, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR adds a concurrency group to the on-child-update.yml workflow to serialize concurrent sync runs triggered by multiple child repos merging at the same time. The intent is correct and the approach (cancel-in-progress: false) is the right one for this use case — however, the concurrency: block was placed in the wrong position in the file.

Key changes:

  • Adds concurrency: { group: child-repo-sync, cancel-in-progress: false } to prevent race conditions when multiple child repos dispatch events simultaneously.

Issue found:

  • P0 — YAML structural error: The concurrency: block was inserted between workflow_dispatch: and its inputs: sub-key (lines 6–17). This orphans the inputs: block outside the on: section with 4-space indentation, which is invalid at the top level. GitHub's parser will either reject the workflow or silently drop the workflow_dispatch inputs. The concurrency: block must be moved to after the closing of the full on: block (i.e., after line 33 where the actor input ends).

Confidence Score: 2/5

  • Not safe to merge — the YAML structural error will break the workflow, requiring a targeted one-line fix to move the concurrency block to after the on: section.
  • The fix strategy (concurrency group with cancel-in-progress: false) is exactly right, but the implementation introduces a critical YAML syntax error by splitting the workflow_dispatch block. One concrete positional fix is all that's needed to make this mergeable.
  • .github/workflows/on-child-update.yml — the concurrency: block must be repositioned to after line 33 (end of on: inputs).

Important Files Changed

Filename Overview
.github/workflows/on-child-update.yml The concurrency block was inserted between workflow_dispatch: and its inputs: child key, splitting the on: section and producing invalid YAML that will break workflow dispatch inputs and likely fail to parse entirely.

Sequence Diagram

sequenceDiagram
    participant CR1 as Child Repo 1
    participant CR2 as Child Repo 2
    participant GHA as GitHub Actions
    participant CQ as Concurrency Queue
    participant Meta as Meta Repo

    CR1->>GHA: repository_dispatch child-repo-updated
    CR2->>GHA: repository_dispatch child-repo-updated

    GHA->>CQ: Enqueue run for CR1 (group: child-repo-sync)
    GHA->>CQ: Enqueue run for CR2 (group: child-repo-sync, cancel-in-progress: false → queued)

    CQ->>Meta: Run 1 (CR1): checkout → push sync/CR1/sha → create PR → auto-merge
    CQ->>Meta: Run 2 (CR2): checkout → push sync/CR2/sha → create PR → auto-merge
Loading

Comments Outside Diff (1)

  1. .github/workflows/on-child-update.yml, line 6-17 (link)

    P0 concurrency block breaks workflow_dispatch inputs

    The concurrency: block was inserted between workflow_dispatch: and its inputs: child key. This splits the on: block in two — inputs: is now orphaned outside the on: context with 4-space indentation, which is invalid at the top-level scope of a GitHub Actions workflow YAML. GitHub's parser will either reject the workflow entirely or silently drop the workflow_dispatch inputs, breaking manual dispatch.

    The concurrency: block must be a top-level sibling of on:, permissions:, and jobs: — it should come after the entire on: block.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: .github/workflows/on-child-update.yml
    Line: 6-17
    
    Comment:
    **`concurrency` block breaks `workflow_dispatch` inputs**
    
    The `concurrency:` block was inserted between `workflow_dispatch:` and its `inputs:` child key. This splits the `on:` block in two — `inputs:` is now orphaned outside the `on:` context with 4-space indentation, which is invalid at the top-level scope of a GitHub Actions workflow YAML. GitHub's parser will either reject the workflow entirely or silently drop the `workflow_dispatch` inputs, breaking manual dispatch.
    
    The `concurrency:` block must be a top-level sibling of `on:`, `permissions:`, and `jobs:` — it should come **after** the entire `on:` block.
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: .github/workflows/on-child-update.yml
Line: 6-17

Comment:
**`concurrency` block breaks `workflow_dispatch` inputs**

The `concurrency:` block was inserted between `workflow_dispatch:` and its `inputs:` child key. This splits the `on:` block in two — `inputs:` is now orphaned outside the `on:` context with 4-space indentation, which is invalid at the top-level scope of a GitHub Actions workflow YAML. GitHub's parser will either reject the workflow entirely or silently drop the `workflow_dispatch` inputs, breaking manual dispatch.

The `concurrency:` block must be a top-level sibling of `on:`, `permissions:`, and `jobs:` — it should come **after** the entire `on:` block.

```suggestion
  workflow_dispatch:
    inputs:
      repo_name:
        description: 'Child repo name'
        required: true
        default: 'test-repo'
      short_sha:
        description: 'Short SHA'
        required: true
        default: 'abc1234'
      message:
        description: 'Commit message'
        required: true
        default: 'feat: test commit'
      type:
        description: 'Commit type'
        required: true
        default: 'feat'
      actor:
        description: 'Actor'
        required: true
        default: 'test-user'

concurrency:
  group: child-repo-sync
  cancel-in-progress: false

```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix: add concurrency group to child-repo..." | Re-trigger Greptile

The concurrency block was incorrectly placed between workflow_dispatch
and its inputs, breaking the YAML structure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mateodelnorte

Copy link
Copy Markdown
Contributor Author

Fixed — moved concurrency: block to after the on: section so workflow_dispatch.inputs isn't orphaned.

@coderabbitai

coderabbitai Bot commented Mar 25, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: cc0419a7-2e4e-47cf-b932-7e962af9b9af

📥 Commits

Reviewing files that changed from the base of the PR and between edf502a and be66815.

📒 Files selected for processing (1)
  • .github/workflows/on-child-update.yml

Walkthrough

A workflow-level concurrency configuration is added to the GitHub Actions workflow file, establishing a shared concurrency group named child-repo-sync with in-progress run cancellation disabled, ensuring sequential workflow execution.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow Configuration
.github/workflows/on-child-update.yml
Added concurrency configuration with group child-repo-sync and cancel-in-progress: false to serialize workflow runs.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 Hop, hop, the rabbit scripts align,
With concurrency locks, all runs now in line,
No races, no clashes, just order and grace,
One sync at a time in the child-repo space!
✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: add concurrency group to child-repo-sync workflow' directly and accurately summarizes the main change—adding a concurrency configuration to the GitHub Actions workflow to prevent concurrent runs and race conditions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sync-concurrency-group

Comment @coderabbitai help to get the list of available commands and usage tips.

@mateodelnorte
mateodelnorte merged commit d978541 into main Mar 25, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant