elastic / elastic/ai-github-actions

[product-manager-impersonator] Manual replay mode for detective workflows

Open
#1,048 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

## Feature Idea

**Summary:** Add optional `workflow_dispatch` support to PR/Branch Actions Detective so maintainers can replay analysis for a specific failed run ID when event-driven diagnosis was missed or needs re-checking.

## Why a Customer Would Want This
Teams rely on detective workflows for CI incident triage, but today they only run from `workflow_run` events. If a run needs re-analysis later (or after prompt/config updates), maintainers have no direct way to invoke the detective against the original failed run, which slows incident response.

## Rough Implementation Sketch
- Add `workflow_dispatch` trigger and a required `workflow-run-id` input to:
- `gh-agent-workflows/pr-actions-detective/example.yml`
- `gh-agent-workflows/branch-actions-detective/example.yml`
- Add optional `workflow-run-id` `workflow_call` input plumbing in:
- `.github/workflows/gh-aw-pr-actions-detective.md`
- `.github/workflows/gh-aw-branch-actions-detective.md`
- Resolve run ID from `inputs.workflow-run-id` (manual) or `github.event.workflow_run.id` (event), then reuse existing job/log analysis path.
- Update corresponding README/docs trigger and input tables.

## Why It Won't Be That Hard
This is mostly trigger/input plumbing. Both detective workflows already analyze a concrete run ID and fetch logs/jobs by `{run_id}`; the manual path can reuse the existing logic. There is also precedent in `pr-actions-fixer`, which already uses manual `workflow_dispatch` with a required run ID.

## Evidence
- Current detective triggers are event-only (`workflow_run`):
- `gh-agent-workflows/pr-actions-detective/example.yml:2-5`
- `gh-agent-workflows/branch-actions-detective/example.yml:2-5`
- Detective docs currently describe only `workflow_run` trigger:
- `gh-agent-workflows/pr-actions-detective/README.md:21-24`
- `gh-agent-workflows/branch-actions-detective/README.md:21-24`
- Internal detective workflows already key behavior on run context/log retrieval:
- `.github/workflows/gh-aw-pr-actions-detective.md:52-53,86-87,103-113`
- `.github/workflows/gh-aw-branch-actions-detective.md:58-59,97-99,113-123`
- Manual run-id pattern already exists:
- `gh-agent-workflows/pr-actions-fixer/README.md:23,29`

## Duplicate Check
This is distinct from existing ideas/issues:
- `#839` **Detective-to-Fixer One-Click Handoff** (handoff UX from detective output to fixer, not rerunning detective itself)
- `#864` **Configurable failure-issue reporting for reusable workflows** (reporting behavior, not manual replay)
- `#747` **PR head-ref preflight skip** and `#893` **safe-outputs replay preflight** (different subsystems)

No open issue found proposing manual replay (`workflow_dispatch` + run ID targeting) for PR/Branch Actions Detective.

> [!NOTE]
>
> 🔒 Integrity filter blocked 15 items
>
> The following items were blocked because they don't meet the GitHub integrity level.
>
> - elastic/ai-github-actions#1029 `list_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - elastic/ai-github-actions#1025 `list_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - elastic/ai-github-actions#1024 `list_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#359](https://github.com/elastic/ai-github-actions/issues/359) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#354](https://github.com/elastic/ai-github-actions/issues/354) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#424](https://github.com/elastic/ai-github-actions/issues/424) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#325](https://github.com/elastic/ai-github-actions/issues/325) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#436](https://github.com/elastic/ai-github-actions/issues/436) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#333](https://github.com/elastic/ai-github-actions/issues/333) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#684](https://github.com/elastic/ai-github-actions/issues/684) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#875](https://github.com/elastic/ai-github-actions/issues/875) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#605](https://github.com/elastic/ai-github-actions/issues/605) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#547](https://github.com/elastic/ai-github-actions/issues/547) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#594](https://github.com/elastic/ai-github-actions/issues/594) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#370](https://github.com/elastic/ai-github-actions/issues/370) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
>
> To allow these resources, lower `min-integrity` in your GitHub frontmatter:
>
> ```yaml
> tools:
> github:
> min-integrity: approved # merged | approved | unapproved | none
> ```
>
>

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

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.