[bug-hunter] trigger-ci-workflows exits 0 even when workflow dispatches fail

Open Beginner friendly
#2,127 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
bash, shell
Domain
ci-cd, tooling

Research direction

Start in scripts/trigger-ci-workflows.sh, focusing on the dispatch loop and summary section near the end where failed is declared and dispatch errors are logged. Run the supplied gh shim reproduction and verify that failed dispatches produce a non-zero exit status while successful dispatches retain the current behavior.

Written by the indexing model from the issue text.

Description

Impact

scripts/trigger-ci-workflows.sh exits with status 0 even when every workflow dispatch fails. Any automation or maintainer script relying on exit status treats the run as successful, so dispatch failures are silently missed.

Reproduction Steps

  1. From repository root, create a gh shim that forces gh workflow run to fail:
    mkdir -p /tmp/gh-aw/agent/ghshim
    cat > /tmp/gh-aw/agent/ghshim/gh <<'SH'
    #!/usr/bin/env bash
    if [ "$1" = "workflow" ] && [ "$2" = "run" ]; then
      exit 1
    fi
    exit 0
    SH
    chmod +x /tmp/gh-aw/agent/ghshim/gh
    
  2. Run the script with that shim first on PATH:
    PATH="/tmp/gh-aw/agent/ghshim:$PATH" bash scripts/trigger-ci-workflows.sh detectors
    echo "exit_code=$?"
    

Expected vs Actual

Expected: non-zero exit status when one or more workflow dispatches fail (especially when all fail).

Actual: script prints multiple dispatch failed errors but exits 0.

Observed output:

## Detectors

Attempted to dispatch 13 workflows across 1 categories.
exit_code=0

stderr contained 13 failure lines like:

✗ Trigger Bug Hunter (dispatch failed)

Failing Test

#!/usr/bin/env bash
set -euo pipefail

mkdir -p /tmp/gh-aw/agent/ghshim
cat > /tmp/gh-aw/agent/ghshim/gh <<'SH'
#!/usr/bin/env bash
if [ "$1" = "workflow" ] && [ "$2" = "run" ]; then
  exit 1
fi
exit 0
SH
chmod +x /tmp/gh-aw/agent/ghshim/gh

set +e
PATH="/tmp/gh-aw/agent/ghshim:$PATH" bash scripts/trigger-ci-workflows.sh detectors >/tmp/gh-aw/agent/repro.out 2>/tmp/gh-aw/agent/repro.err
code=$?
set -e

echo "exit_code=$code"
cat /tmp/gh-aw/agent/repro.err

if [ "$code" -eq 0 ]; then
  echo "FAIL: script reported success despite dispatch failures"
  exit 1
fi

Evidence

  • scripts/trigger-ci-workflows.sh declares failed=0 but never increments it and never exits non-zero on failures.
  • In the dispatch loop, the failure path only logs ✗ ... (dispatch failed) to stderr.
  • Current file reference: scripts/trigger-ci-workflows.sh (dispatch loop and summary section near the end of the file).
  • This appears to match a previously fixed class of bug from #315 and is reproducible again on current main.

What is this? | From workflow: Trigger Bug Hunter

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

  • expires on Sep 25, 2026, 11:27 AM UTC
Dominant language
Python
Stars
11
Forks
16
Avg merge
11h 16m
Merged PRs (30d)
29

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from elastic/ai-github-actions

All issues in elastic/ai-github-actions

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.