elastic / elastic/ai-github-actions

[autonomy-atomicity] Dogfood trigger generation uses shared target.tmp files

Open
#1,551 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
11
Forks
16
Avg merge
22h 9m
Merged PRs (30d)
31

Description

## Autonomy / Atomicity Findings

### 1. Dogfood synchronization is not safe for overlapping compile runs
**Category:** Global state
**File(s):** `scripts/dogfood.sh:13,68-87,97-114,125-147`; `Makefile:190-195`; `.github/workflows/ci.yml:46-52`
**Problem:** `scripts/dogfood.sh` enables `set -euo pipefail` and rewrites each generated trigger through the fixed path `$target.tmp` (for example, lines 83, 87, 114, and 147) before moving it over the target. `Makefile` runs this script as the `sync` prerequisite of every `make compile`, and the CI compile job invokes `make compile`. If two agents or automation processes run compilation in the same checkout, they share the same temporary pathname: one process can overwrite the other process’s intermediate output, or one `mv` can remove the temporary file before the other process reaches its `mv`, causing the second run to fail under `set -e`.
**Suggested fix:** Serialize the sync/compile critical section with a checkout-scoped lock, or use unique same-directory temporary files such as `mktemp "$target.XXXXXX"` and clean them up on failure before the atomic rename.

## Suggested Actions
- [ ] Make dogfood trigger generation safe when two `make compile` or `make sync` processes overlap in one checkout.
- [ ] Add a regression test or concurrency check covering the temporary-file and rename path.

---
[What is this?](https://ela.st/github-ai-tools) | [From workflow: Trigger Autonomy Atomicity Analyzer](https://github.com/elastic/ai-github-actions/actions/runs/29108461918)

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

Contributor guide

Open the contributing guide

Research direction

Start by inspecting scripts/dogfood.sh at lines 13, 68-87, 97-114, and 125-147, then trace its sync role in Makefile lines 190-195 and the CI invocation in .github/workflows/ci.yml lines 46-52. Reproduce overlapping make compile or make sync runs and add the requested regression or concurrency check; done means concurrent runs no longer share or prematurely remove target.tmp files.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
build-system, ci-cd
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.