Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix stale PR workflow: enable close_pull_request tool and add 30+7 day inactivity grace period - #13402

#13402
Merged
ViktorHofer merged 5 commits into
maindotnet/msbuild:mainfrom
copilot/update-stale-pr-workflowdotnet/msbuild:copilot/update-stale-pr-workflowCopy head branch name to clipboard
Mar 17, 2026
Merged

Fix stale PR workflow: enable close_pull_request tool and add 30+7 day inactivity grace period#13402
ViktorHofer merged 5 commits into
maindotnet/msbuild:mainfrom
copilot/update-stale-pr-workflowdotnet/msbuild:copilot/update-stale-pr-workflowCopy head branch name to clipboard

Conversation

Copilot AI commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

Context

The stale PR agentic workflow (run 23191024469) found 26 stale PRs but couldn't act on them. The agent reported: "the close_pull_request tool is not available in my function set."

Root cause: close_pull_request was defined in tools.json (schema) and the safe_outputs handler config, but missing from config.json — the MCP server enforcement config that controls which tools are actually exposed to the agent. Additionally, add_comment max was 1, insufficient for multi-PR workflows.

Changes Made

Agent prompt (close-stale-prs.agent.md):

  • New two-phase staleness logic: PRs older than 180 days with 30–37 days of inactivity get a stale warning; PRs with >37 days of inactivity get closed
  • Explicit instructions to use close_pull_request / add_comment tools (not just report missing)
  • Warning comment template: "This PR has been automatically marked as stale because it has no activity for 30 days. It will be closed if no further activity occurs within another 7 days..."
  • add-comment max raised to 30

Compiled workflow (close-stale-prs.agent.lock.yml):

  • Added close_pull_request with max: 25 to config.json — the critical missing piece
  • Updated add_comment max from 1 → 30 across config.json, tool description, validation schema, and handler config

Testing

Workflow changes — verified config consistency across all four locations in the lock.yml where tool limits appear. Will validate on next scheduled run or manual dispatch.

Notes

The lock.yml is normally auto-generated by gh aw compile. These manual edits fix a likely compiler bug where close-pull-request from frontmatter was compiled into tools.json and handler config but not into config.json. A recompile should be run when the tooling is next updated to ensure the lock file stays in sync.

Copilot AI and others added 3 commits March 17, 2026 11:14
…ness logic with 30+7 day inactivity rule, add warning comments

Co-authored-by: ViktorHofer <7412651+ViktorHofer@users.noreply.github.com>
Co-authored-by: ViktorHofer <7412651+ViktorHofer@users.noreply.github.com>
@ViktorHofer
ViktorHofer marked this pull request as ready for review March 17, 2026 12:33
@ViktorHofer
ViktorHofer requested a review from a team as a code owner March 17, 2026 12:33
Copilot AI review requested due to automatic review settings March 17, 2026 12:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the “Close Stale Pull Requests” agentic workflow so it can both warn on inactivity and actually close stale PRs by exposing the required close_pull_request tool and raising safe-output limits.

Changes:

  • Adds a two-phase stale policy (warn at 30–37 days inactivity; close at >37 days) for PRs older than 180 days.
  • Raises add_comment safe-output max from 1 → 30 and enables close_pull_request in the enforced safe-outputs config.
  • Updates the compiled lock workflow to keep tool definitions, validation, and handler config in sync with the new limits.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/close-stale-prs.agent.md Updates the agent prompt to implement warn/close staleness policy and instruct use of add_comment / close_pull_request.
.github/workflows/close-stale-prs.agent.lock.yml Updates compiled workflow safe-outputs enforcement config and tool limits (including enabling close_pull_request).

You can also share your feedback on Copilot code review. Take the survey.

Comment thread .github/workflows/close-stale-prs.agent.md Outdated
Comment thread .github/workflows/close-stale-prs.agent.md Outdated
ViktorHofer and others added 2 commits March 17, 2026 13:43
- Determine staleness using last non-bot activity instead of updated_at,
  which gets reset by the bot's own warning comment
- Skip duplicate stale warnings if one already exists
- Require pull_request_number param for close_pull_request since this
  runs on schedule, not a PR event
- Clarify that only human activity resets the inactivity timer

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ViktorHofer
ViktorHofer merged commit 17e89c7 into main Mar 17, 2026
2 of 9 checks passed
@ViktorHofer
ViktorHofer deleted the copilot/update-stale-pr-workflow branch March 17, 2026 12:51
AR-May pushed a commit to AR-May/msbuild that referenced this pull request Mar 19, 2026
…y inactivity grace period (dotnet#13402)

### Context

The stale PR agentic workflow ([run
23191024469](https://github.com/dotnet/msbuild/actions/runs/23191024469/job/67386926740))
found 26 stale PRs but couldn't act on them. The agent reported: *"the
close_pull_request tool is not available in my function set."*

Root cause: `close_pull_request` was defined in `tools.json` (schema)
and the safe_outputs handler config, but **missing from `config.json`**
— the MCP server enforcement config that controls which tools are
actually exposed to the agent. Additionally, `add_comment` max was 1,
insufficient for multi-PR workflows.

### Changes Made

**Agent prompt** (`close-stale-prs.agent.md`):
- New two-phase staleness logic: PRs older than 180 days with **30–37
days** of inactivity get a stale warning; PRs with **>37 days** of
inactivity get closed
- Explicit instructions to use `close_pull_request` / `add_comment`
tools (not just report missing)
- Warning comment template: *"This PR has been automatically marked as
stale because it has no activity for 30 days. It will be closed if no
further activity occurs within another 7 days..."*
- `add-comment` max raised to 30

**Compiled workflow** (`close-stale-prs.agent.lock.yml`):
- Added `close_pull_request` with `max: 25` to `config.json` — the
critical missing piece
- Updated `add_comment` max from 1 → 30 across config.json, tool
description, validation schema, and handler config

### Testing

Workflow changes — verified config consistency across all four locations
in the lock.yml where tool limits appear. Will validate on next
scheduled run or manual dispatch.

### Notes

The lock.yml is normally auto-generated by `gh aw compile`. These manual
edits fix a likely compiler bug where `close-pull-request` from
frontmatter was compiled into tools.json and handler config but not into
config.json. A recompile should be run when the tooling is next updated
to ensure the lock file stays in sync.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ViktorHofer <7412651+ViktorHofer@users.noreply.github.com>
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.