← Back to blog

Why Your Bot's Pull Requests Never Close Their Own Issues

Brandon Schaefer··Updated November 24, 2026·3 min read·

A workaround for a problem that didn't exist left a quieter one behind: an automation's own commit messages were written to avoid a premature auto-close that was never actually possible.

Table of contents

I run a small Gitea Actions bot against my own site's repo that picks up an issue, works out a fix, and opens a pull request for me to review. For months, every commit it wrote used the same phrasing - "Addresses #N" instead of "Closes #N" - on a deliberate design choice that turned out to be solving a problem that never existed, while quietly creating a real one.

The reasoning that sounded careful

The bot's own prompt template spelled out why: a pull request is for human review, not a direct push to the default branch, so using a recognized closing keyword in the commit message or PR body would supposedly close the tracking issue the moment the PR opened - before anyone had actually reviewed anything. "Addresses #N" sidesteps that by avoiding any keyword the git host treats as a closer. It reads like defensive engineering: don't let the bot close something it hasn't actually fixed yet.

What closing keywords actually trigger on

The premise is wrong. Gitea - deliberately mirroring the same convention most git hosts use - only auto-closes an issue referenced by a keyword like "Closes #N" or "Fixes #N" when a pull request containing that keyword is merged into the default branch, not when the pull request is merely opened. A PR that says "Fixes #30" in its body does nothing to issue #30 until someone actually merges it. The failure the bot's author was guarding against - the issue slamming shut the instant the PR opens, before review - can't happen on this workflow at all. There's a human review step sitting in between every single time, regardless of what keyword the commit uses.

How it surfaced

I noticed during ordinary backlog housekeeping - going through open issues to see what was actually still outstanding - and found a couple where the fixing pull request had merged days or weeks earlier, and the issue itself was still sitting open. Nothing was wrong with the fixes; they'd landed and were running. The tracking issue just never got the memo, because the commit that merged it never said anything a host's auto-close logic recognizes as a reference worth acting on.

The second-order symptom

The quieter cost showed up somewhere I wasn't looking for it: a later pull request from the same bot ended up cross-referencing the wrong issue entirely - a completely unrelated one, from a different corner of the backlog - because nothing about the "Addresses #N" convention ever forced that number to point at something real. A keyword the host actually resolves gets validated for free: point it at a closed PR, a deleted issue, or the wrong number, and clicking the link makes the mismatch obvious immediately. A keyword the host ignores is just a string with digits in it. Nobody notices it's wrong until they're specifically looking for it.

The fix was one word

sql
- Use "Addresses #{n}" in the commit message, NOT "Closes #{n}" - this lands as a
-  PR for review, not a direct push, so don't auto-close the issue.
+ Use "Fixes #{n}" (or "Closes #{n}") in the commit message and PR body.

Same template, same review step sitting between opening and merging, same zero risk of a premature auto-close - because that risk was never real to begin with. What changed is that an issue reference in a commit message now means something a host can resolve and a human can click and trust, instead of being free-text that merely looks like one.

The actual lesson

The mistake wasn't the convention itself - "don't let the bot close something it hasn't finished" is a perfectly reasonable rule. It just wasn't the rule this particular line of code enforced. It was a workaround for a failure mode the platform already prevents on its own, at the cost of quietly disabling a feature that would otherwise have worked for free. Worth remembering any time an automation's own self-imposed rules start to feel like load-bearing infrastructure: check what the platform actually does before writing code to work around what you assume it does.