Skip to content

bug: orchestrator dispatches quality gate multiple times — no in-flight check #213

@microsasa

Description

@microsasa

Problem

The orchestrator checks for a valid approval before dispatching the quality gate, but does NOT check if a quality gate workflow is already running. When multiple orchestrator runs fire in quick succession (via workflow_run triggers), each one sees no valid approval and dispatches the quality gate again.

Observed on PR #210 (2026-03-21)

  1. 15:34:36 — Orchestrator run (schedule): Copilot hadn't reviewed yet → skipped quality gate ✅
  2. 15:36:23 — Orchestrator run (workflow_run): Copilot reviewed, no valid approval → dispatched quality gate
  3. 15:40:21 — Orchestrator run (workflow_run): Copilot reviewed, first quality gate still running (no approval yet) → dispatched quality gate AGAIN

Result: 2 quality gate runs — one in_progress, one pending. Wastes compute and burns Opus inference tokens.

Fix

Add an in-flight check for the quality gate before dispatching, same pattern as the implementer check:

QG_RUNNING=$(gh run list --workflow=quality-gate.lock.yml --json databaseId,status 2>/dev/null \
  | jq -r '[.[] | select(.status == "in_progress" or .status == "queued" or .status == "waiting")] | length' 2>/dev/null || echo "1")
if [[ "$QG_RUNNING" -gt 0 ]]; then
  echo "  ⏳ PR #${PR}: Quality gate already in flight. Skipping dispatch."
  echo "::endgroup::"
  continue
fi

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions