Comfy-Org / Comfy-Org/ComfyUI_frontend

Duplicate Storybook build status comments on PRs

Open
#5,275 1 comment 0 reactions 0 assignees View on GitHub
area:CI/CD
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Human Preface/Disclaimer

The only issue I actually saw/can confirm was the double storybook comments in https://github.com/Comfy-Org/ComfyUI_frontend/pull/5274, but I do not know the cause of this issue.

Everything below this point is completely triaged and generated by Opus 4.1 Claude Code.

## Problem Description

When multiple commits are pushed to a PR in quick succession, duplicate "Storybook Build Status" comments are created instead of updating a single comment. This was observed in PR #5274 where two identical Storybook status comments were posted.

## Root Cause Analysis

Each commit triggers its own Chromatic workflow run, and each Chromatic run triggers a separate `pr-storybook-comment` workflow via the `workflow_run` event. When these workflows run concurrently or in rapid succession, a race condition occurs:

1. Both workflows search for existing comments with `` marker
2. Neither finds the other's comment (as they're created nearly simultaneously)
3. Both create new comments instead of updating an existing one

### Timeline Example (from PR #5274)
- **Commit 1** (33035eea at 00:22:04Z) → Chromatic run no. 423 → Comment created at 12:22:57
- **Commit 2** (91ad2a0a at 00:25:50Z) → Chromatic run no. 424 → Comment created at 12:26:17

## Proposed Solutions

### Option 1: Add Concurrency Control (Recommended)
Add concurrency settings to `pr-storybook-comment.yaml` to ensure only one instance runs per PR:

```yaml
concurrency:
group: storybook-comment-${{ github.event.workflow_run.pull_requests[0].number }}
cancel-in-progress: true
```

### Option 2: Use More Specific Comment Markers
Include additional identifiers in the comment marker to prevent collisions:
```yaml
body-includes: ''
```

### Option 3: Add Delay and Retry Logic
Implement a small delay and retry mechanism to check for recently created comments before creating a new one.

## Impact
- Creates confusion with multiple status comments on PRs
- Clutters PR discussion threads
- May cause notification spam for PR participants

## Related Information
- Issue introduced after PR #5209 which implemented the `workflow_run` architecture for CI comment/deploy separation
- Affects both `pr-storybook-comment.yaml` and potentially `pr-playwright-comment.yaml` workflows

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-5275-Duplicate-Storybook-build-status-comments-on-PRs-with-multiple-commits-2606d73d3650811f8327d15d3cca16dc) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.