elastic / elastic/ai-github-actions

[product-manager-impersonator] Retry/backoff controls for workflow log fetching

Open
#1,869 0 comments 1 reaction 2 assignees Claimed by @v1v View on GitHub
Dominant language
Python
Stars
11
Forks
16
Avg merge
22h 9m
Merged PRs (30d)
31

Description

## Feature Idea

**Summary:** Add retry/backoff and request-timeout controls to `scripts/fetch-workflow-logs.py` so transient GitHub API failures do not derail scheduled diagnostics.

## Why a Customer Would Want This
Teams relying on detector workflows need dependable log collection to debug failures in one pass. Today, a transient API/network hiccup can drop run logs and force manual reruns, which slows triage and weakens trust in automated audits.

## Rough Implementation Sketch
- Add CLI inputs to `scripts/fetch-workflow-logs.py`: `--retries`, `--backoff-seconds`, and `--timeout` (with safe defaults).
- Wrap `github_api(...)` calls with bounded retry logic for retryable failures (HTTP 429 and 5xx), honoring `Retry-After` when present.
- Keep non-retryable failures fail-fast, but include retry attempt counts in stderr output to preserve operator visibility.
- Extend `manifest.json` output with per-run fetch metadata (attempt count / final error) so downstream tooling can distinguish hard failures from transient recovery.

## Why It Won't Be That Hard
The change is localized to one script with a single request helper (`github_api`) and two call paths (run listing and log archive download), so resilience behavior can be added centrally without touching workflow definitions.

## Evidence
- `scripts/fetch-workflow-logs.py` L29-L37: GitHub API requests are made with a single `urlopen` call and no retry or timeout controls.
- `scripts/fetch-workflow-logs.py` L103-L113: run log download catches exceptions but does not retry.
- `scripts/fetch-workflow-logs.py` L127-L144: current CLI options do not expose retry/backoff/timeout knobs.
- `docs/workflows/gh-agent-workflows.md` L136-L149: docs position maintenance/automation flows as operational mechanisms, which increases the value of resilient log retrieval in scheduled runs.
- Recent repository activity is already investing in workflow/API reliability (for example PR #1811: `fix: use provided token in fetch-workflow-logs API calls`).

---
[What is this?](https://ela.st/github-ai-tools) | [From workflow: Trigger Product Manager Impersonator](https://github.com/elastic/ai-github-actions/actions/runs/32357316753)

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.