Skip to content

feat(ai-qa): close issues on delivery PASS; cleanup PR head branches - #58

Merged
Hicham Zinalabdin (hichamza) merged 1 commit into
mainfrom
hz/ai-qa-issue-pr-hygiene-e361
Sep 1, 2026
Merged

feat(ai-qa): close issues on delivery PASS; cleanup PR head branches#58
Hicham Zinalabdin (hichamza) merged 1 commit into
mainfrom
hz/ai-qa-issue-pr-hygiene-e361

Conversation

@hichamza

@hichamza Hicham Zinalabdin (hichamza) commented Sep 1, 2026

Copy link
Copy Markdown
Member

Why

ai-qa was a post-merge agentic review that treated GitHub’s merge as done. Merge is not delivery: GitHub auto-closes linked issues at merge time, auto-deletes heads only on merge (never on close-without-merge), and neither waits for deploy health.

This makes ai-qa own done at two surfaces, matching finishing-a-development-branch (verify success, then clean up only what we own).

What changed

Issue-level

  • On delivery PASS, close linked issues (consumers should turn off GitHub auto-close-on-merge).
  • On FAIL, leave them open; reopen if GitHub already auto-closed them.
  • On issues.closed, reopen if the issue was closed before delivery (linked merged PR without ✓ /ai-qa), unless this action closed it or state_reason is not_planned.

PR-level

  • Merged + PASS → delete head branch.
  • Merged + FAIL → keep the branch.
  • Closed without merge → delete head (the GitHub-native gap).
  • Never delete the default branch, a fork head, or a ref still used by another open PR. 404 = already gone; 403 warns; job stays green. Delete uses GITHUB_TOKEN (contents: write), not the App token.

Policy lives in tested ai-qa/lib/cleanup.js. Unit CI now also runs ai-qa/lib/**/*.test.js.

Caller workflows should add:

on:
  push:
    branches: [main]
  pull_request:
    types: [closed]
  issues:
    types: [closed]
permissions:
  contents: write
  pull-requests: write
  issues: write

And disable Settings → General → Issues → Auto-close issues with merged linked pull requests.

Out of scope

The optional Claude review is unchanged (still color on the report). No tag/deployment deletion.

Open in Web Open in Cursor 

✅ ai-qa: PASS

Deploy health: healthy · findings P0 0 · P1 0 · P2 0 · P3 0

Last updated by ai-qa · QA run

ai-qa is post-merge hygiene, not a second review. Policy lives in
tested ai-qa/lib/cleanup.js (same extraction reason as recompute.js).

- Merged delivery PASS closes linked issues and deletes the head branch
- FAIL leaves issues open (reopens if GitHub already auto-closed) and keeps the branch
- PR closed without merge deletes the head (GitHub never does)
- issues.closed reopens premature closes unless this action closed them
- Never delete default/fork/in-use refs; contents:write via GITHUB_TOKEN

Co-authored-by: Hicham Zinalabdin <hichamza@users.noreply.github.com>
@hichamza
Hicham Zinalabdin (hichamza) marked this pull request as ready for review September 1, 2026 17:12
@hichamza
Hicham Zinalabdin (hichamza) merged commit 090a4a7 into main Sep 1, 2026
6 checks passed
@hichamza
Hicham Zinalabdin (hichamza) deleted the hz/ai-qa-issue-pr-hygiene-e361 branch September 1, 2026 17:24
@mtm-bot

mtm-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

✅ ai-qa: PASS

Merge commit 090a4a7ccda9

Signal Result
Deploy health (https://raw.githubusercontent.com/EdulyCom/github-actions/main/README.md) ✅ healthy
QA review ⚠️ did not run — reporting deploy-health signal only
Head branch will delete hz/ai-qa-issue-pr-hygiene-e361

Posted by mtm-bot[bot] · workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants