elastic / elastic/ai-github-actions

[autonomy-atomicity] Run-scope workflow log scratch paths to prevent cross-run collisions

Open
#1,518 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. Workflow log analyzers share fixed scratch paths
**Category:** Global state / Ordering dependency
**File(s):** `scripts/fetch-workflow-logs.py`, `.github/workflows/agent-efficiency.md`, `.github/workflows/agent-deep-dive.md`

**Problem:** Several log-analysis entry points write run metadata, downloaded logs, manifests, and extracted errors into fixed `/tmp/gh-aw` paths. The standalone fetcher defaults to `/tmp/gh-aw/logs` (`scripts/fetch-workflow-logs.py:14`, `scripts/fetch-workflow-logs.py:140-141`), creates that shared directory (`scripts/fetch-workflow-logs.py:171-173`), writes each run under `/` (`scripts/fetch-workflow-logs.py:103-123`), and overwrites `/manifest.json` on every invocation (`scripts/fetch-workflow-logs.py:193-196`). The agent-efficiency workflow similarly writes `/tmp/gh-aw/failed_runs.json`, `/tmp/gh-aw/logs//`, `/tmp/gh-aw/logs/manifest.json`, and `/tmp/gh-aw/errors.json` (`.github/workflows/agent-efficiency.md:69-113`). Agent Deep Dive uses the same fixed pattern under `/tmp/gh-aw/deep-dive`, including `runs.json`, per-run logs, `manifest.json`, and `errors.json` (`.github/workflows/agent-deep-dive.md:73-139`).

When two agents or maintainers run these analyzers concurrently in the same workspace/runner host, one run can overwrite the other run's manifest or error output while both still reference the same fixed path. That makes the downstream analysis depend on execution order rather than the selected workflow/run set, and it can mix stale or partial log paths into the final report.

**Suggested fix:** Scope these scratch directories per workflow run/job and per target workflow, for example `${RUNNER_TEMP:-/tmp}/gh-aw/${GITHUB_RUN_ID:-manual}-${GITHUB_JOB:-logs}-${TARGET_WORKFLOW:-workflow}` or a `mktemp -d` directory exported to the prompt. Have `scripts/fetch-workflow-logs.py` default to a unique output directory or require `--output-dir` in automation, and write `manifest.json` via an atomic temp-file rename.

## Suggested Actions
- [ ] Replace fixed `/tmp/gh-aw/logs` and `/tmp/gh-aw/deep-dive` workflow paths with run-scoped scratch directories.
- [ ] Update `scripts/fetch-workflow-logs.py` so default output cannot collide across concurrent invocations, or require callers to pass an explicit unique `--output-dir`.
- [ ] Adjust prompts/tests to consume the exported scoped paths instead of hard-coded `/tmp/gh-aw/...` locations.

Duplicate check: `/tmp/previous-findings.json` contains related autonomy issues for ready-to-make-pr temp state, MkDocs temp-dir state, workflow concurrency, and Agent Deep Dive rotation, but none cover `fetch-workflow-logs.py`, `agent-efficiency.md`, or the log manifest scratch path collision. GitHub issue searches for `/tmp/gh-aw/logs` returned no matches; searches for `fetch-workflow-logs.py` showed feature/bug reports unrelated to this atomicity blocker.

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

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

Contributor guide

Open the contributing guide

Research direction

Read scripts/fetch-workflow-logs.py and the path-handling sections of .github/workflows/agent-efficiency.md and .github/workflows/agent-deep-dive.md. Trace how each workflow creates and passes scratch paths, then verify that concurrent runs use distinct directories and that manifest output is written atomically. Done means the listed analyzers and prompts no longer depend on fixed /tmp/gh-aw paths or overwrite one another's outputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, python
Domain
ci-cd, devops, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.