Skip to content

ci: reject issue-state keywords in PR text - #2341

Merged
Sinity merged 1 commit into
masterfrom
feature/fix/exact-ref-read-summary
Jun 23, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/fix/exact-ref-read-summary

Conversation

@Sinity

@Sinity Sinity commented Jun 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds a fast PR policy check that rejects PR title/body text containing GitHub issue-state keywords next to issue references, and updates the PR template to steer authors toward neutral references.

Problem

GitHub can change issue state from PR text when a linked PR is merged. That is too easy for agents to trigger accidentally, especially when a broad issue still has residual deployed/runtime work.

Solution

The new PR State Guard workflow runs on PR metadata changes and scans the PR title/body directly from the event payload. It accepts neutral Ref #NNN wording and rejects state-changing keyword forms before merge. The PR template now reminds authors to keep issue references neutral unless the operator explicitly asks for that exact state change.

Verification

  • devtools verify ci-workflows -> 17 workflow files checked, no errors.
  • Local regex smoke: neutral Ref #2308 passed; state-changing same-repo and cross-repo keyword forms failed.
  • Pre-push devtools verify --quick -> pass (20260623T165120Z-quick-84113-aec841b3).

Changelog

Skipped; CI/project-process only.

Risks and Follow-ups

The GitHub repository setting for auto-changing issue state on linked PR merge should still be disabled manually under repository settings when available. This PR adds an enforceable repository guard so the workflow does not depend only on agent memory or the GitHub UI setting.

Summary by CodeRabbit

Release Notes

  • Documentation

    • Enhanced pull request submission guidelines with clearer issue referencing instructions.
  • Chores

    • Added automated workflow to validate pull request formatting and issue references.

@Sinity
Sinity force-pushed the feature/fix/exact-ref-read-summary branch from b3bfb3c to 44d5078 Compare June 23, 2026 16:53
@coderabbitai

coderabbitai Bot commented Jun 23, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Sinity, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 53 minutes and 24 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses rolling per-developer review limits. Reviews become available again as older review attempts age out of the rolling limit window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d95f30fb-50a5-4990-a7a8-ca03003ef26f

📥 Commits

Reviewing files that changed from the base of the PR and between 44d5078 and e4a5c55.

📒 Files selected for processing (2)
  • .github/pull_request_template.md
  • .github/workflows/pr-state-guard.yml
📝 Walkthrough

Walkthrough

A new GitHub Actions workflow (pr-state-guard.yml) is added that runs on pull request events targeting master. It executes an inline Python script that parses the PR title and body for issue-state keywords (close, fix, resolve, etc.) adjacent to issue references, failing the job on any match. The PR template gains explicit instructions to reference issues neutrally and avoid such keywords.

Changes

PR State Guard enforcement

Layer / File(s) Summary
Keyword detection workflow and template guidance
.github/workflows/pr-state-guard.yml, .github/pull_request_template.md
Adds a CI workflow with read-only permissions and per-ref concurrency cancellation; an inline Python script loads the event payload, regex-matches title and body for state/intent keywords (e.g., fixes, closes, resolves) adjacent to issue refs, and exits with code 1 on any hit. The PR template adds instructions to use neutral references like Ref #NNN`` and prohibit issue-state keywords unless explicitly requested.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hoppy news from the warren today,
No "fixes #123" shall slip away!
The guard sniffs the title, the body too,
And fails the build if keywords get through.
Ref neutrally, friend — that's the bunny way! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: adding a CI check to reject issue-state keywords in PR text, which matches the main objective of implementing the PR State Guard workflow.
Description check ✅ Passed The PR description comprehensively covers all required template sections: Summary, Problem, Solution, Verification with specific commands/results, Changelog rationale, and Risks/Follow-ups, providing clear context for reviewers.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/exact-ref-read-summary

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b3bfb3cf3d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/pr-state-guard.yml Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/pr-state-guard.yml:
- Around line 13-15: Add explanatory comments above the permissions block in the
pr-state-guard.yml workflow file to document why the specific permissions are
needed. The contents and pull-requests read permissions should each have a brief
comment explaining their purpose. For example, document that contents read is
needed to access repository metadata and pull-requests read is needed to
interact with pull request data, helping future maintainers understand the
security rationale for these permission assignments.
- Around line 28-58: The Python script lacks error handling for missing
environment variables and file operations. Wrap the code that reads and parses
the GitHub event file (starting with the retrieval of GITHUB_EVENT_PATH
environment variable through the json.load call) in a try-except block to
gracefully catch KeyError for missing environment variables, FileNotFoundError
for missing event files, and JSONDecodeError for malformed JSON. For each error
type, print a descriptive error message to help with debugging, then call
sys.exit(1) to fail the check appropriately instead of letting Python tracebacks
propagate.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: aa207720-1c9b-466e-9bd4-aef37f8054ec

📥 Commits

Reviewing files that changed from the base of the PR and between e4a4c8b and 44d5078.

📒 Files selected for processing (2)
  • .github/pull_request_template.md
  • .github/workflows/pr-state-guard.yml

Comment thread .github/workflows/pr-state-guard.yml Resolved
Comment thread .github/workflows/pr-state-guard.yml Resolved
@Sinity
Sinity force-pushed the feature/fix/exact-ref-read-summary branch from 44d5078 to 98a850b Compare June 23, 2026 16:58
@Sinity
Sinity force-pushed the feature/fix/exact-ref-read-summary branch from 98a850b to e4a5c55 Compare June 23, 2026 17:00
@Sinity
Sinity merged commit af8f801 into master Jun 23, 2026
13 checks passed
@Sinity
Sinity deleted the feature/fix/exact-ref-read-summary branch June 23, 2026 17:02
@Sinity

Sinity commented Sep 30, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

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.

1 participant