Skip to content

claim bot: comment on a closing keyword only in the PR title (Fixes #38) - #39

Merged
vpacher merged 3 commits into
masterfrom
fix/38-title-only-closing-keyword
Dec 1, 2026
Merged

vpacher merged 3 commits into
masterfrom
fix/38-title-only-closing-keyword

Conversation

@vpacher

@vpacher vpacher commented Dec 1, 2026

Copy link
Copy Markdown
Member

Fixes #38

GitHub links issues only from closing keywords in the PR body. A keyword in the title links nothing, so the merge does not close the issue, and the claim check (which read only the body) never saw the reference. In obs-rust/obs-studio this happened 4 times in the last 500 merged PRs (since 2026-11-18): 5982, 5969, 6032 and 5854. The issues of 5982 and 5969 were closed by hand on 2026-12-01, the issue of 6032 by its author. The issue of 5854 is still open.

Change

  • workflow/pr_claims.py: title_only(repo, pr) returns the closing references in the title that the body names with neither a closing keyword nor Refs (new REFS pattern). A bare (#N) in the body links nothing, so it does not count. A revert title (Revert "...") returns nothing: the original's keyword names an issue the revert does not close. conflicts() now checks the title-only references too.
  • workflow/claim_bot.py: title_note_actions() keeps one comment (marker pr-title-keyword) while a title-only reference exists. It asks for the body line, prints the same text as a ::warning for fork PRs (their token cannot comment), and deletes the comment when the body is fixed or the title names other issues. The note never fails the check. A conflict on a title-only reference does, as for a body reference.
  • workflow/gh.py, workflow/sim.py: a delete_comment action. HTTP 404 counts as done.
  • WORKFLOW.md: the rule, next to the PR claim check.

The issue called the claim check on title references optional. I made it unconditional, because a title-only keyword shows the author means to close the issue, and skipping the check is the gap behind obs-rust/obs-studio#3307. It can add claim-conflict to a PR in flight. The dry run below found none.

RED → GREEN

  • RED 1c3be24: tests/test_pr_claims.py, class TitleOnlyClosingKeyword (shared setup moved to a PrEvents mixin) and test_delete_comment_uses_the_issues_rest_permission. 4 failures and 1 error (KeyError: 'delete_comment').
  • GREEN e1e658b: all pass.
  • c638ecb: the revert guard, plus tests for an exempt docs-only PR (it still gets the note) and a changed title (the note is replaced, not added). The revert test fails without the guard.

Dry run on live PRs

title_only() over every open PR in the non-archived obs-rust repos (85 PRs on 2026-12-01): 0 hits, so merging adds no note and no label to a PR in flight. The same function over the last 500 merged obs-studio PRs finds exactly the 4 PRs above.

Local checks

$ uv run -m unittest discover -s tests -t .
Ran 272 tests
OK
$ uvx ruff format --check workflow/pr_claims.py workflow/claim_bot.py tests/test_pr_claims.py
3 files already formatted

ruff check on the touched files gives the same 13 findings as on master, and none new.

🤖 Generated with Claude Code

vpacher and others added 3 commits December 1, 2026 08:08
GitHub links issues only from closing keywords in the PR body.
obs-rust/obs-studio#5982, #5969 and #5987 named their issue only in the
title, the issues stayed open after the merge, and the claim check never
saw the reference.

The new cases expect one claim-bot comment for a title-only keyword, none
when the body names the issue with Fixes or Refs, the comment removed once
the body is fixed, and the claim check run on a title-only reference. A
delete_comment action is expected in GhBackend.

RED: 4 failures, 1 error (KeyError: 'delete_comment').

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
)

GitHub links issues only from closing keywords in the PR body. When the
title has one for an issue that the body names with neither a closing
keyword nor Refs, the claim bot now posts one comment (marker
pr-title-keyword) and a check warning that ask for the body line, and
deletes the comment when the body is fixed or names other issues.

It is a note, not a conflict: it never fails the check. But a title-only
reference now goes through the claim check, so it cannot skip it.

- pr_claims: title_only(), title_note(), REFS; conflicts() checks the
  title-only references too.
- claim_bot: title_note_actions() in on_pull_request.
- gh + sim: a delete_comment action (a 404 counts as done).
- WORKFLOW.md: the rule.

GREEN: uv run -m unittest discover -s tests -t .  -> Ran 269 tests, OK.
No new ruff findings in the touched files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… Refs #38)

GitHub titles a revert 'Revert "<original title>"'. The original's
closing keyword names an issue that the revert does not close and that is
usually closed, so the title-only claim check would flag the revert with
claim-conflict, and the coordinator would not queue it.

Also tests that a docs-only (exempt) PR still gets the note and that a
changed title replaces the note instead of adding a second one.

The revert test fails without the guard. Ran 272 tests, OK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vpacher
vpacher merged commit 42f8ff1 into master Dec 1, 2026
3 checks passed
@vpacher
vpacher deleted the fix/38-title-only-closing-keyword branch December 1, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

claim bot: a closing keyword only in the PR title does not link the issue

1 participant