elastic / elastic/ai-github-actions
[autonomy-atomicity] Workflow-level concurrency cancels in-progress agent runs before safe outputs
- Dominant language
- Python
- Stars
- 11
- Forks
- 16
- Avg merge
- 22h 9m
- Merged PRs (30d)
- 31
Description
## Autonomy / Atomicity Findings
### 1. Workflow-wide cancellation can discard an in-progress agent run before it emits safe outputs
**Category:** Global state / Ordering dependency
**File(s):** `.github/workflows/gh-aw-autonomy-atomicity-analyzer.md`, `.github/workflows/gh-aw-bug-hunter.md`, `.github/workflows/gh-aw-stale-issues-investigator.md`, `gh-agent-workflows/autonomy-atomicity-analyzer/example.yml`
**Problem:** Several reusable agent workflow sources define workflow-scoped concurrency groups with `cancel-in-progress: true`. For example, `.github/workflows/gh-aw-autonomy-atomicity-analyzer.md:57-59` sets `group: ${{ github.workflow }}-autonomy-atomicity-analyzer` and cancels in-progress runs; `.github/workflows/gh-aw-bug-hunter.md:58-60` and `.github/workflows/gh-aw-stale-issues-investigator.md:61-63` use the same pattern. The published trigger example for the autonomy analyzer includes both a weekday schedule and manual dispatch in `gh-agent-workflows/autonomy-atomicity-analyzer/example.yml:2-5`.
When a scheduled run and a manual run of the same agent workflow overlap, or a maintainer retries while a previous agent is still investigating, GitHub cancels the older run. These workflows run in ephemeral CI and persist conclusions through safe outputs, so canceling before the final safe-output call can silently drop a real finding or the required noop. That makes independent operator actions contend on a single workflow-level lock rather than allowing each run to finish atomically.
**Suggested fix:** Scope concurrency to true duplicates instead of the whole workflow, or stop canceling in-progress runs for detector/audit workflows. For example, include an invocation-specific dimension such as event/ref/target issue or PR where appropriate, or use `cancel-in-progress: false` for scheduled detectors that must always emit a safe output.
## Suggested Actions
- [ ] Audit hand-authored agent workflow sources that set `cancel-in-progress: true` and classify which ones are safe to cancel.
- [ ] For detector/audit workflows, replace workflow-wide cancellation with a narrower concurrency key or disable in-progress cancellation so each run can persist its safe-output conclusion.
- [ ] Document the intended concurrency policy so new workflows do not copy the broad cancellation pattern by default.
---
[What is this?](https://ela.st/github-ai-tools) | [From workflow: Trigger Autonomy Atomicity Analyzer](https://github.com/elastic/ai-github-actions/actions/runs/28042360834)
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
Contributor guide
Research direction
Audit the concurrency blocks in .github/workflows/gh-aw-autonomy-atomicity-analyzer.md, gh-aw-bug-hunter.md, gh-aw-stale-issues-investigator.md, and gh-agent-workflows/autonomy-atomicity-analyzer/example.yml. Compare scheduled and manual triggers, then define and apply a concurrency policy that prevents unsafe cancellation for detector workflows and document the intended behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions
- Domain
- ci-cd, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100