# TL;DR

Reopen the original PR to keep the review thread, then exempt PRs with review activity from auto-close. The agent's stale rule only looked at push dates and ignored review events, so it closed a PR a human was actively reviewing. Closing and reopening destroyed the review context for no reason.

## Error

```text
agent auto-closed an upgrade PR as "stale" while a human was mid-review, then reopened an identical one the next day
```

## Steps

1. Reopen the original PR instead of keeping the duplicate. Reopening restores the review thread and the approved CI run. Expected: the original PR is open again with its comments intact.
2. Close the duplicate the agent opened. Leave a comment pointing at the original so nobody reviews the wrong one. Expected: one canonical PR, no confusion.
3. Re-request the review. Ping the human reviewer on the reopened PR. Expected: the reviewer picks up where they left off instead of starting over.
4. Fix the stale rule. Exempt PRs with open review requests, recent review comments, or recent human comments from auto-close; require a warning comment days before any close. Expected: the rule configuration no longer targets PRs humans are touching.
5. Change the agent's behavior. The agent should comment asking whether the PR is still needed instead of closing it outright. Expected: humans get a nudge, not a surprise close.

## Use this when

- A stale bot or agent closes PRs that have active reviewers
- Reopened duplicate PRs are piling up and review history is being lost
- You are configuring inactivity rules for an upgrade-agent workflow
- A human complains their in-progress review vanished

## Not for this skill when

- The PR was genuinely abandoned with no activity from anyone - closing it was correct
- The close came from a human maintainer, not automation - talk to them instead
- You want to close old PRs deliberately - do it with a warning comment first

## Variant phrasings

- stale bot closed my PR during review
- agent closed upgrade PR as stale while under review
- duplicate PR opened after stale close
- how to stop auto-close on PRs with reviewers

## Why it happens

Stale rules usually key off the last push or last commit date. A human reviewing a PR does not push, so a PR can look "inactive" to the bot while a reviewer has it open in another tab. The agent then closes it, realizes the work is still needed, and opens an identical PR the next day - losing the review thread, the CI history, and the reviewer's goodwill.

## Edge cases

- Some platforms treat a close/reopen as resetting the mergeable state - re-run CI after reopening before merging.
- If the human's review was a "request changes," reopening keeps that state; make sure the agent addresses the feedback instead of just reopening.
- Exemptions should also cover PRs labeled "do not stale" or "wip" - humans use labels to signal intent.
- Track how often the agent's closes get reverted; a high revert rate means the stale thresholds are too aggressive.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_sGCBqyI_GeGp3zZslhfC9Q
