elastic / elastic/ai-github-actions

[product-manager-impersonator] Transactional rollback for quick-setup.sh failures

Open
#1,028 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 failure-safe rollback to `scripts/quick-setup.sh` so setup errors don’t leave users on a new branch with partially written workflow files.

## Why a Customer Would Want This
Teams use quick setup as the fastest onboarding path, but a mid-run failure currently leaves manual cleanup work (branch state + partial files). A transactional rollback would make first-run adoption safer and less frustrating.

## Rough Implementation Sketch
- Track initial branch and files created during execution (the script already collects `created_files`).
- Add a `trap`-based failure handler that, on error, removes newly created files and checks out the original branch.
- Add an opt-out flag (for example `--keep-partial`) for users who want to inspect partial state.
- Document rollback behavior in quick-setup docs/help text.

## Why It Won't Be That Hard
This is a localized Bash change in one script plus small docs updates. The script already has the key state needed (`created_files` and deterministic branch switch point), so rollback is mostly wiring cleanup into existing flow.

## Evidence
- `scripts/quick-setup.sh` exits immediately on command failure (`set -euo pipefail`) without cleanup today (`scripts/quick-setup.sh:9`).
- It switches/creates the setup branch before downloading workflow files (`scripts/quick-setup.sh:173-183`).
- It writes multiple workflow files incrementally (`scripts/quick-setup.sh:194-213`).
- It already tracks created files in-memory (`created_files` at `scripts/quick-setup.sh:186`, appends at `:202` and `:212`).
- Quick setup is positioned as the recommended install path in docs (`README.md:28-39`, `gh-agent-workflows/README.md:44-55`).

> [!NOTE]
>
> 🔒 Integrity filter blocked 40 items
>
> The following items were blocked because they don't meet the GitHub integrity level.
>
> - [#937](https://github.com/elastic/ai-github-actions/pull/937) `search_pull_requests`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#1025](https://github.com/elastic/ai-github-actions/issues/1025) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#1024](https://github.com/elastic/ai-github-actions/issues/1024) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#1010](https://github.com/elastic/ai-github-actions/issues/1010) `search_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".
> - [#850](https://github.com/elastic/ai-github-actions/pull/850) `search_pull_requests`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#851](https://github.com/elastic/ai-github-actions/pull/851) `search_pull_requests`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#505](https://github.com/elastic/ai-github-actions/issues/505) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#476](https://github.com/elastic/ai-github-actions/issues/476) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#704](https://github.com/elastic/ai-github-actions/issues/704) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#694](https://github.com/elastic/ai-github-actions/issues/694) `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".
> - [#676](https://github.com/elastic/ai-github-actions/issues/676) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#139](https://github.com/elastic/ai-github-actions/issues/139) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#472](https://github.com/elastic/ai-github-actions/issues/472) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - ... and 24 more items
>
> 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/24990221493)

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.