← Back to Pull requests

Add AI policy label actions #722

Merged
zanieb merged 4 files (335 lines) on Oct 27, 2026 21:01 UTC
View on GitHub
zanieb zanieb commented on Oct 23, 2026 17:59 UTC
Author

Give triagers and core developers a consistent way to direct contributors to Python's AI guidelines via labels. Applying ai policy comment posts a reminder on an issue or pull request; ai policy close posts a closure message and closes it, but doesn't lock it / intentionally leaves the conversation open for clarification and questions.

I wrote some starting copy, though I imagine we'll iterate on it.

ai policy comment on pull requests:

Thank you for your interest in contributing to Python. This is a community-driven project, and we want it to be a welcoming place to learn and collaborate.

> Contributors are responsible for reviewing and understanding what they submit, checking its claims, and being able to explain changes in their own words. This helps reviewers focus on the contribution and leaves more time to support other contributors.

> This contribution appears to have been authored with AI assistance. Please explain your contribution in your own words and describe how you checked its correctness.

> Please read our guidelines for using AI tools.

ai policy close on pull requests:

Thank you for your interest in contributing to Python. This is a community-driven project, and we want it to be a welcoming place to learn and collaborate.

> Contributors are responsible for reviewing and understanding what they submit, checking its claims, and being able to explain changes in their own words. This helps reviewers focus on the contribution and leaves more time to support other contributors.

> We believe this contribution does not meet our guidelines for using AI tools, so we're closing it. If you think we've misunderstood your contribution, please let us know. You're welcome to explain your approach or ask questions about the guidelines.

> Please read our guidelines for using AI tools.

ai policy comment on issues:

Thank you for taking the time to open this issue. Python is a community-driven project, and we want it to be a welcoming place to learn and collaborate.

> This issue appears to have been written with AI assistance. Please explain your issue in your own words and describe how you checked the information you provided. This helps us understand your issue and leaves more time to address other issues.

> Please read our guidelines for using AI tools.

ai policy close on issues:

Thank you for taking the time to open this issue. Python is a community-driven project, and we want it to be a welcoming place to learn and collaborate.

> We expect issues to be explained in your own words. We believe this issue does not meet our guidelines for using AI tools, so we're closing it. If you think we've misunderstood, you're welcome to clarify the issue or ask questions about the guidelines.

> Please read our guidelines for using AI tools.

Diff: 335 lines (+334 / -1) across 4 files Reviewer: zware Review duration: 5941m
All Vouch review confidence checks passed
Residual risk 0.05 = Change Risk (0.42) × (1 − Review Confidence (0.88)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 335 lines diff across 4 files
0.42
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.85 · 5 substantive comment(s)
0.85
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
88%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.348
Real PR Conversation Timeline
62 items
python-cla-bot[bot] python-cla-bot[bot] commented on Oct 23, 2026 17:59 UTC
Bot

All commit authors signed the Contributor License Agreement.

![CLA signed](https://cla.python.org/)<!-- CLA BOT SIGNING COMMENT DO NOT EDIT -->

codecov[bot] codecov[bot] commented on Oct 23, 2026 18:02 UTC
Bot

Codecov Report


:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 100.00%. Comparing base (ead995a) to head (b52c2ee).

![Impacted file tree graph](https://app.codecov.io/gh/python/bedevere/pull/722?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python)

@@            Coverage Diff             @@
##              main      #722    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           18        20     +2     
  Lines         2182      2370   +188     
  Branches       100       117    +17     
==========================================
+ Hits          2182      2370   +188     

| Flag | Coverage Δ | |
|---|---|---|
| Python_3.14.8 | 100.00% <100.00%> (ø) | |
| Python_3.15.1 | ? | |
| Python_3.15.2 | 100.00% <100.00%> (?) | |

Flags with carried forward coverage won't be shown. Click here to find out more.

| Files with missing lines | Coverage Δ | |
|---|---|---|
| bedevere/\_\_main\_\_.py | 100.00% <100.00%> (ø) | |
| bedevere/policy.py | 100.00% <100.00%> (ø) | |
| tests/test\_policy.py | 100.00% <100.00%> (ø) | |
<details><summary> :rocket: New features to boost your workflow: </summary>

  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

  • </details>

    zanieb zanieb commented on Oct 23, 2026 18:12 UTC
    Author

    It's plausible we might want to have a slightly different message for issues instead of pull requests, i.e., less of a focus on "contributors" for issues.

    e.g. https://github.com/zanieb/bedevere/compare/ai-policy-labels...ai-policy-issue-messages

    zware zware approved these changes on Oct 23, 2026 19:06 UTC
    Approved Reviewer

    Approved these changes.

    savannahostrowski savannahostrowski approved these changes on Oct 23, 2026 19:32 UTC
    Approved Reviewer

    I think this looks great. Thanks so much for implementing this, Zanie! 💜

    StanFromIreland StanFromIreland approved these changes on Oct 23, 2026 19:33 UTC
    Approved Reviewer

    Approved these changes.

    Mariatta Mariatta commented on Oct 23, 2026 20:31 UTC
    Contributor

    What is the intention on how the comment vs closed label meant to be used? When do you comment and when do you close? Is there rules about it on the devguide?

    zanieb zanieb commented on Oct 23, 2026 20:40 UTC
    Author

    In my experience, it depends on the quality of the content. I use "close" when it seems likely it's in bad faith or is particularly low effort, and "comment" when it seems likely that they will engage. I'll pull some numbers and gather some feedback from other people on my team. We started with just the "close" action in June then split it into a "comment" action in August following some feedback from @AlexWaygood

    it seems like a majority of the times we've used this label over in Ruff/ty we've actually just wanted the comment linking to the AI policy (we usually want to give the author time to respond and amend their PR/issue), and maintainers have immediately reopened the PR/issue after the PR/issue is auto-closed by the bot.

    It might make sense to see what usage looks like before adding it to the devguide? but I don't have strong feelings about that.

    AlexWaygood AlexWaygood commented on Oct 23, 2026 20:48 UTC
    Contributor

    Yeah, I think it probably depends on whether you think the PR is salvageable or not? I'm not sure I've ever actually used the label to just insta-close the PR, but I can see a use for it if you can see that the PR comes from a completely unmonitored agent, or if it's something that you don't even want a PR for. Usually, in practice, I tend to want to give the contributor a chance to rectify or fix their error, so I usually just add the label that adds a comment without closing the PR.

    hugovk hugovk commented on code on Oct 23, 2026 20:57 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triagers and core developers."""

    """Respond to AI policy labels applied by triage and core teams."""
    

    hugovk hugovk commented on code on Oct 23, 2026 20:58 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triagers and core developers."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community \
    +driven project, and we want it to be a welcoming place to learn and collaborate.

    Thank you for your interest in contributing to Python. This is a community-driven \
    project, and we want it to be a welcoming place to learn and collaborate.
    

    hugovk hugovk commented on code on Oct 23, 2026 20:58 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triagers and core developers."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community \
    +driven project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +PR_COMMENT_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This contribution appears to have been authored with AI assistance. "
    +        "Please explain your contribution in your own words and describe how you "
    +        "checked its correctness."
    +    )
    +)
    +
    +PR_CLOSE_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this contribution because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your contribution, please let us know. "
    +        "You're welcome to explain your approach or ask questions about the guidelines."
    +    )
    +)
    +
    +_ISSUE_MESSAGE_TEMPLATE = """\
    +Thank you for taking the time to open this issue. Python is a community driven \

    Thank you for taking the time to open this issue. Python is a community-driven \
    

    zanieb zanieb commented on Oct 23, 2026 20:59 UTC
    Author

    I pulled some data. In ruff and uv, we've used "close" 104 times and "comment" 9 times. Of the 9 commented on, 6 were subsequently closed by maintainers, 1 was closed by its author, 1 merged, and 2 remain open. Of the 104 closed, 3 were reopened and 1 merged.

    As another guiding use-case, you can see we also use the "close" action for cases where someone opens a _bunch_ of pull requests https://github.com/astral-sh/ruff/issues?q=state%3Aclosed+label%3Abot%3Aai-policy-close

    hugovk hugovk commented on code on Oct 23, 2026 21:10 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triagers and core developers."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community \
    +driven project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +PR_COMMENT_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This contribution appears to have been authored with AI assistance. "
    +        "Please explain your contribution in your own words and describe how you "
    +        "checked its correctness."
    +    )
    +)
    +
    +PR_CLOSE_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this contribution because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your contribution, please let us know. "
    +        "You're welcome to explain your approach or ask questions about the guidelines."
    +    )
    +)
    +
    +_ISSUE_MESSAGE_TEMPLATE = """\
    +Thank you for taking the time to open this issue. Python is a community driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Please review and verify the information in your issue and make sure you can \
    +explain it in your own words. This helps us understand your issue and leaves \
    +more time to address other issues.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +ISSUE_COMMENT_MESSAGE = _ISSUE_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This issue appears to have been written with AI assistance. "
    +        "Please explain your issue in your own words and describe how you checked "
    +        "the information you provided."
    +    )
    +)
    +
    +ISSUE_CLOSE_MESSAGE = _ISSUE_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this issue because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your issue, please let us know. "
    +        "You're welcome to clarify it or ask questions about the guidelines."
    +    )
    +)
    +
    +
    +@router.register("issues", action="labeled")

    This is Bedevere's first handler for issues.

    @Mariatta Is the GH app already subscribed to issues, or do we need to add that in the app settings?

    hugovk hugovk approved these changes on Oct 23, 2026 21:12 UTC
    Approved Reviewer

    We'll obviously also need to add the labels to the CPython repo:

    https://github.com/python/cpython/labels

    And also to the devguide with brief instructions for use:

    https://devguide.python.org/triage/labels/

    zanieb zanieb commented on code on Oct 23, 2026 21:15 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triagers and core developers."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community \
    +driven project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +PR_COMMENT_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This contribution appears to have been authored with AI assistance. "
    +        "Please explain your contribution in your own words and describe how you "
    +        "checked its correctness."
    +    )
    +)
    +
    +PR_CLOSE_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this contribution because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your contribution, please let us know. "
    +        "You're welcome to explain your approach or ask questions about the guidelines."
    +    )
    +)
    +
    +_ISSUE_MESSAGE_TEMPLATE = """\
    +Thank you for taking the time to open this issue. Python is a community driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Please review and verify the information in your issue and make sure you can \
    +explain it in your own words. This helps us understand your issue and leaves \
    +more time to address other issues.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +ISSUE_COMMENT_MESSAGE = _ISSUE_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This issue appears to have been written with AI assistance. "
    +        "Please explain your issue in your own words and describe how you checked "
    +        "the information you provided."
    +    )
    +)
    +
    +ISSUE_CLOSE_MESSAGE = _ISSUE_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this issue because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your issue, please let us know. "
    +        "You're welcome to clarify it or ask questions about the guidelines."
    +    )
    +)
    +
    +
    +@router.register("issues", action="labeled")

    Wow! That's a good catch.

    We could also just do pull requests to start if you prefer, but I've found it useful in issues too.

    zware zware commented on Oct 23, 2026 21:16 UTC
    Contributor

    We'll obviously also need to add the labels to the CPython repo:

    See https://github.com/python/core-workflow/issues/611 for that. Not entirely sure the process on that; we all have GH permission to add them, but I'm not sure if there needs to be more formal approval (SC?).

    zanieb zanieb commented on Oct 23, 2026 21:17 UTC
    Author

    I'll draft a devguide change

    hugovk hugovk commented on code on Oct 23, 2026 21:18 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triagers and core developers."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community \
    +driven project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +PR_COMMENT_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This contribution appears to have been authored with AI assistance. "
    +        "Please explain your contribution in your own words and describe how you "
    +        "checked its correctness."
    +    )
    +)
    +
    +PR_CLOSE_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this contribution because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your contribution, please let us know. "
    +        "You're welcome to explain your approach or ask questions about the guidelines."
    +    )
    +)
    +
    +_ISSUE_MESSAGE_TEMPLATE = """\
    +Thank you for taking the time to open this issue. Python is a community driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Please review and verify the information in your issue and make sure you can \
    +explain it in your own words. This helps us understand your issue and leaves \
    +more time to address other issues.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +ISSUE_COMMENT_MESSAGE = _ISSUE_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This issue appears to have been written with AI assistance. "
    +        "Please explain your issue in your own words and describe how you checked "
    +        "the information you provided."
    +    )
    +)
    +
    +ISSUE_CLOSE_MESSAGE = _ISSUE_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this issue because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your issue, please let us know. "
    +        "You're welcome to clarify it or ask questions about the guidelines."
    +    )
    +)
    +
    +
    +@router.register("issues", action="labeled")

    Agreed, issues and PRs makes sense.

    Mariatta Mariatta commented on Oct 23, 2026 21:18 UTC
    Contributor

    Could we start with just the comment label, and we can close it ourselves if we find the pr author did not follow through?

    Eg we default to 'commenting' first.
    If we also think it is worth closing after the initial comment, then we close it ourselves.

    zanieb zanieb commented on Oct 23, 2026 21:21 UTC
    Author

    Given the data from our experience I'm a bit wary to drop a "close" action, but am certainly happy to do whatever people prefer here. We could always add a "close" action in the future if data in the CPython repository / feedback from maintainers indicates it is useful. I'm not sure what it costs us to add it now though (a bit of complexity in the devguide?).

    hugovk hugovk commented on Oct 23, 2026 21:34 UTC
    Contributor

    I think having an automated way to post a comment and close would be useful, it feels less personal.

    (And when dealing with unsalvageable LLM content, it's already not personal on their side, so let's make it easier on us.)

    hugovk hugovk commented on Oct 23, 2026 21:36 UTC
    Contributor

    > We'll obviously also need to add the labels to the CPython repo:

    > See python/core-workflow#611 for that. Not _entirely_ sure the process on that; we all have GH permission to add them, but I'm not sure if there needs to be more formal approval (SC?).

    I think the usual process is: open issue, wait a bit that there's consensus or no objections, create the labels. A merge here is good consensus to go ahead and create.

    zanieb zanieb commented on Oct 23, 2026 21:57 UTC
    Author
    StanFromIreland StanFromIreland commented on Oct 23, 2026 22:17 UTC
    Contributor

    more formal approval (SC?).

    I don't think we've ever needed that before, things like type-refactor were added based on consensus of the core team.

    willingc willingc commented on code on Oct 23, 2026 23:12 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triage and core teams."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +PR_COMMENT_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This contribution appears to have been authored with AI assistance. "
    +        "Please explain your contribution in your own words and describe how you "
    +        "checked its correctness."
    +    )
    +)
    +
    +PR_CLOSE_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this contribution because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your contribution, please let us know. "
    +        "You're welcome to explain your approach or ask questions about the guidelines."

            "We're closing this contribution because it does not meet our "
            "guidelines for using AI tools. "
            "Please review our guidelines. "
            "You're welcome to explain your approach or ask questions after reviewing them."
    

    willingc willingc commented on code on Oct 23, 2026 23:16 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triage and core teams."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}

    I would recommend swapping the paragraph on reading the guidelines and the {action}.

    willingc willingc commented on code on Oct 23, 2026 23:17 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triage and core teams."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +PR_COMMENT_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This contribution appears to have been authored with AI assistance. "
    +        "Please explain your contribution in your own words and describe how you "
    +        "checked its correctness."
    +    )
    +)
    +
    +PR_CLOSE_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this contribution because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your contribution, please let us know. "
    +        "You're welcome to explain your approach or ask questions about the guidelines."
    +    )
    +)
    +
    +_ISSUE_MESSAGE_TEMPLATE = """\
    +Thank you for taking the time to open this issue. Python is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Please review and verify the information in your issue and make sure you can \
    +explain it in your own words. This helps us understand your issue and leaves \
    +more time to address other issues.
    +
    +{action}

    Again I would swap the paragraphs on reading the guidelines and the action.

    willingc willingc commented on code on Oct 23, 2026 23:19 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triage and core teams."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +PR_COMMENT_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This contribution appears to have been authored with AI assistance. "
    +        "Please explain your contribution in your own words and describe how you "
    +        "checked its correctness."
    +    )
    +)
    +
    +PR_CLOSE_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this contribution because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your contribution, please let us know. "
    +        "You're welcome to explain your approach or ask questions about the guidelines."
    +    )
    +)
    +
    +_ISSUE_MESSAGE_TEMPLATE = """\
    +Thank you for taking the time to open this issue. Python is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Please review and verify the information in your issue and make sure you can \
    +explain it in your own words. This helps us understand your issue and leaves \
    +more time to address other issues.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +ISSUE_COMMENT_MESSAGE = _ISSUE_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This issue appears to have been written with AI assistance. "
    +        "Please explain your issue in your own words and describe how you checked "
    +        "the information you provided."
    +    )
    +)
    +
    +ISSUE_CLOSE_MESSAGE = _ISSUE_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this issue because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your issue, please let us know. "
    +        "You're welcome to clarify it or ask questions about the guidelines."

            "We're closing this issue because it does not meet our "
            "guidelines for using AI tools. "
            "After reviewing the guidelines, you're welcome to clarify the issue."
    

    willingc willingc commented on Oct 23, 2026 23:23 UTC
    Reviewer

    Thanks @zanieb. I love the spirit of this PR. I would recommend being a bit firmer on closing messages.

    zanieb zanieb commented on code on Oct 23, 2026 23:30 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triage and core teams."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +PR_COMMENT_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This contribution appears to have been authored with AI assistance. "
    +        "Please explain your contribution in your own words and describe how you "
    +        "checked its correctness."
    +    )
    +)
    +
    +PR_CLOSE_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this contribution because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your contribution, please let us know. "
    +        "You're welcome to explain your approach or ask questions about the guidelines."
    +    )
    +)
    +
    +_ISSUE_MESSAGE_TEMPLATE = """\
    +Thank you for taking the time to open this issue. Python is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Please review and verify the information in your issue and make sure you can \
    +explain it in your own words. This helps us understand your issue and leaves \
    +more time to address other issues.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +ISSUE_COMMENT_MESSAGE = _ISSUE_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This issue appears to have been written with AI assistance. "
    +        "Please explain your issue in your own words and describe how you checked "
    +        "the information you provided."
    +    )
    +)
    +
    +ISSUE_CLOSE_MESSAGE = _ISSUE_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this issue because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your issue, please let us know. "
    +        "You're welcome to clarify it or ask questions about the guidelines."

    hm I think "we believe" is important there. We don't _know_ if it meets our guidelines or not. I don't think being firmer is worth the risk of being off-putting to someone that wants to genuinely engage. I think the average fully autonomous contributor won't respond at all (from our experience / data thus far).

    zanieb zanieb commented on code on Oct 23, 2026 23:32 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triage and core teams."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}

    I like having a call to action at the end, but am not sure I feel strongly otherwise.

    zanieb zanieb commented on code on Oct 23, 2026 23:34 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triage and core teams."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +PR_COMMENT_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This contribution appears to have been authored with AI assistance. "
    +        "Please explain your contribution in your own words and describe how you "
    +        "checked its correctness."
    +    )
    +)
    +
    +PR_CLOSE_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this contribution because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your contribution, please let us know. "
    +        "You're welcome to explain your approach or ask questions about the guidelines."

    See also https://github.com/python/bedevere/pull/722#discussion_r4365070028

    Why do you think including "If you think we've misunderstood your contribution, please let us know." is not appropriate?

    willingc willingc commented on Oct 23, 2026 23:36 UTC
    Contributor

    @Mariatta @zanieb I added some suggestions to this PR and the devguide PR.

    I agree with Zanie that having "comment" and "close" makes sense.

    Mariatta, I hope my suggestions help new contributors by thoughtful use of "comment". For clear cases, "close" signals the need for respect of maintainers'/triagers' time.

    zanieb zanieb commented on Oct 23, 2026 23:46 UTC
    Author

    Note as I was looking at Carol's feedback I realized I didn't like the repetition in the issue comments and have edited them in https://github.com/python/bedevere/pull/722/commits/50699512230b74c9de95a4aeb906caeefc42daa8

    willingc willingc commented on code on Oct 23, 2026 23:58 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triage and core teams."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +PR_COMMENT_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This contribution appears to have been authored with AI assistance. "
    +        "Please explain your contribution in your own words and describe how you "
    +        "checked its correctness."
    +    )
    +)
    +
    +PR_CLOSE_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this contribution because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your contribution, please let us know. "
    +        "You're welcome to explain your approach or ask questions about the guidelines."

    It's appropriate if we think a human will respond to the comment.

    I think it opens the door for a debate. In practice, I've seen some pretty hostile responses IRL when the agent responds instead of a human. At the point that we are applying "close", I think we are pretty convinced that it should be closed. The burden should be on the contributor to respond respectfully. I think the more direct approach increases that likelihood.

    zanieb zanieb commented on code on Oct 24, 2026 00:03 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triage and core teams."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +PR_COMMENT_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This contribution appears to have been authored with AI assistance. "
    +        "Please explain your contribution in your own words and describe how you "
    +        "checked its correctness."
    +    )
    +)
    +
    +PR_CLOSE_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this contribution because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your contribution, please let us know. "
    +        "You're welcome to explain your approach or ask questions about the guidelines."

    My personal preference is to start with something a bit softer as we're exploring something new and if hostile responses are common we can adjust accordingly. (though I don't think the wording will save us from a bad faith / hostile actor and thus would rather focus my responses with the assumption someone is acting in good faith)

    willingc willingc commented on code on Oct 24, 2026 00:03 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triage and core teams."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}

    I think reading the guideline should be part of the call to action prior to commenting/questioning. We can't enforce that, but I think it signals that mutual respect is the culture that we want to foster.

    willingc willingc commented on code on Oct 24, 2026 00:08 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triage and core teams."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +PR_COMMENT_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This contribution appears to have been authored with AI assistance. "
    +        "Please explain your contribution in your own words and describe how you "
    +        "checked its correctness."
    +    )
    +)
    +
    +PR_CLOSE_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this contribution because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your contribution, please let us know. "
    +        "You're welcome to explain your approach or ask questions about the guidelines."

    @zanieb How about cause followed by effect?

    We believe this contribution does not meet our guidelines for using AI tools, so we're closing it.

    willingc willingc commented on code on Oct 24, 2026 00:09 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triage and core teams."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +PR_COMMENT_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This contribution appears to have been authored with AI assistance. "
    +        "Please explain your contribution in your own words and describe how you "
    +        "checked its correctness."
    +    )
    +)
    +
    +PR_CLOSE_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this contribution because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your contribution, please let us know. "
    +        "You're welcome to explain your approach or ask questions about the guidelines."
    +    )
    +)
    +
    +_ISSUE_MESSAGE_TEMPLATE = """\
    +Thank you for taking the time to open this issue. Python is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Please review and verify the information in your issue and make sure you can \
    +explain it in your own words. This helps us understand your issue and leaves \
    +more time to address other issues.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +ISSUE_COMMENT_MESSAGE = _ISSUE_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This issue appears to have been written with AI assistance. "
    +        "Please explain your issue in your own words and describe how you checked "
    +        "the information you provided."
    +    )
    +)
    +
    +ISSUE_CLOSE_MESSAGE = _ISSUE_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this issue because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your issue, please let us know. "
    +        "You're welcome to clarify it or ask questions about the guidelines."
    willingc willingc commented on code on Oct 24, 2026 00:11 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triage and core teams."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}

    In other words, I think we agree.

    zanieb zanieb commented on code on Oct 24, 2026 00:26 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triage and core teams."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +PR_COMMENT_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This contribution appears to have been authored with AI assistance. "
    +        "Please explain your contribution in your own words and describe how you "
    +        "checked its correctness."
    +    )
    +)
    +
    +PR_CLOSE_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this contribution because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your contribution, please let us know. "
    +        "You're welcome to explain your approach or ask questions about the guidelines."
    zanieb zanieb commented on code on Oct 24, 2026 00:43 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triage and core teams."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}

    I guess I see "going to another page" as the kind of call to action I'd have at the end :) I think it's actually more likely that someone does it when it's at the end of a message rather than in the middle.

    willingc willingc commented on code on Oct 24, 2026 02:23 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triage and core teams."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}

    You've convinced me @zanieb. Thanks for iterating. I'm happy with the PR in its current state. Thanks so much for doing this.

    willingc willingc approved these changes on Oct 24, 2026 02:23 UTC
    Approved Reviewer

    Thanks @zanieb.

    hugovk hugovk commented on code on Oct 24, 2026 16:50 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,117 @@
    +"""Respond to AI policy labels applied by triage and core teams."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"

    Little nit, we do capitalise initials like OS, C API, IDLE, IO, JIT, SSL, XML: https://github.com/python/cpython/labels

    COMMENT_LABEL = "AI policy comment"
    CLOSE_LABEL = "AI policy close"
    

    hugovk hugovk commented on code on Oct 24, 2026 16:50 UTC
    Code Review
    README.md:1
    @@ -20,6 +20,9 @@ description label is added to it.
     - ### Closes invalid PRs
     Closes PRs that try to merge a maintenance branch into the main branch, adds
     `invalid` label, and posts a relevant message.
    +- ### Responds to AI policy labels
    +Posts a reminder of the AI guidelines on issues and PRs labeled
    +`ai policy comment`. The `ai policy close` label also closes the contribution.

    `AI policy comment`. The `AI policy close` label also closes the contribution.
    

    hugovk hugovk approved these changes on Oct 24, 2026 16:50 UTC
    Approved Reviewer

    Approved these changes.

    Mariatta Mariatta commented on code on Oct 24, 2026 23:14 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,117 @@
    +"""Respond to AI policy labels applied by triage and core teams."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "AI policy comment"
    +CLOSE_LABEL = "AI policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +PR_COMMENT_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This contribution appears to have been authored with AI assistance. "
    +        "Please explain your contribution in your own words and describe how you "
    +        "checked its correctness."
    +    )
    +)
    +
    +PR_CLOSE_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We believe this contribution does not meet our guidelines for using AI "
    +        "tools, so we're closing it. "
    +        "If you think we've misunderstood your contribution, please let us know. "
    +        "You're welcome to explain your approach or ask questions about the guidelines."
    +    )
    +)
    +
    +_ISSUE_MESSAGE_TEMPLATE = """\
    +Thank you for taking the time to open this issue. Python is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +ISSUE_COMMENT_MESSAGE = _ISSUE_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This issue appears to have been written with AI assistance. "
    +        "Please explain your issue in your own words and describe how you checked "
    +        "the information you provided. This helps us understand your issue and "
    +        "leaves more time to address other issues."
    +    )
    +)
    +
    +ISSUE_CLOSE_MESSAGE = _ISSUE_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We expect issues to be explained in your own words. "
    +        "We believe this issue does not meet our guidelines for using AI tools, "
    +        "so we're closing it. "
    +        "If you think we've misunderstood, you're welcome to clarify the issue "
    +        "or ask questions about the guidelines."
    +    )
    +)
    +
    +
    +@router.register("issues", action="labeled")
    +@router.register("pull_request", action="labeled")
    +async def label_added(event, gh, *args, **kwargs):
    +    """Post a policy reminder and close the contribution when requested."""
    +    label = util.label_name(event.data)
    +    if label not in {COMMENT_LABEL, CLOSE_LABEL}:
    +        return
    +    if event.data["sender"]["type"] == "Bot":
    +        return
    +
    +    is_pr = "pull_request" in event.data
    +    target = event.data["pull_request" if is_pr else "issue"]

    Coding style nit. Could this be more like in the following pattern (matches more to the existing codebase pattern)

    if "pull_request" in event.data:  
        target = event.data["pull_request"]
        issue_url = target["issue_url"]
        comment_message, close_message = PR_COMMENT_MESSAGE, PR_CLOSE_MESSAGE
        close_data = {"state": "closed"}
    else:
        target = event.data["issue"]
        issue_url = target["url"]
        comment_message, close_message = ISSUE_COMMENT_MESSAGE, ISSUE_CLOSE_MESSAGE
        close_data = {"state": "closed", "state_reason": "not_planned"}
    

    Mariatta Mariatta commented on code on Oct 24, 2026 23:15 UTC
    Code Review
    README.md:1
    @@ -20,6 +20,9 @@ description label is added to it.
     - ### Closes invalid PRs
     Closes PRs that try to merge a maintenance branch into the main branch, adds
     `invalid` label, and posts a relevant message.
    +- ### Responds to AI policy labels

    - ### Remind Contributors about AI policy
    

    Mariatta Mariatta commented on code on Oct 24, 2026 23:22 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,117 @@
    +"""Respond to AI policy labels applied by triage and core teams."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "AI policy comment"
    +CLOSE_LABEL = "AI policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +PR_COMMENT_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This contribution appears to have been authored with AI assistance. "
    +        "Please explain your contribution in your own words and describe how you "
    +        "checked its correctness."
    +    )
    +)
    +
    +PR_CLOSE_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We believe this contribution does not meet our guidelines for using AI "
    +        "tools, so we're closing it. "
    +        "If you think we've misunderstood your contribution, please let us know. "
    +        "You're welcome to explain your approach or ask questions about the guidelines."
    +    )
    +)
    +
    +_ISSUE_MESSAGE_TEMPLATE = """\
    +Thank you for taking the time to open this issue. Python is a community-driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +ISSUE_COMMENT_MESSAGE = _ISSUE_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This issue appears to have been written with AI assistance. "
    +        "Please explain your issue in your own words and describe how you checked "
    +        "the information you provided. This helps us understand your issue and "
    +        "leaves more time to address other issues."
    +    )
    +)
    +
    +ISSUE_CLOSE_MESSAGE = _ISSUE_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We expect issues to be explained in your own words. "
    +        "We believe this issue does not meet our guidelines for using AI tools, "
    +        "so we're closing it. "
    +        "If you think we've misunderstood, you're welcome to clarify the issue "
    +        "or ask questions about the guidelines."
    +    )
    +)
    +
    +
    +@router.register("issues", action="labeled")
    +@router.register("pull_request", action="labeled")
    +async def label_added(event, gh, *args, **kwargs):
    +    """Post a policy reminder and close the contribution when requested."""
    +    label = util.label_name(event.data)
    +    if label not in {COMMENT_LABEL, CLOSE_LABEL}:
    +        return
    +    if event.data["sender"]["type"] == "Bot":
    +        return
    +
    +    is_pr = "pull_request" in event.data
    +    target = event.data["pull_request" if is_pr else "issue"]
    +    if target["state"] != "open":
    +        return
    +
    +    issue_url = target["issue_url"] if is_pr else target["url"]
    +    issue = await gh.getitem(issue_url)
    +    if issue["state"] != "open" or label not in util.labels(issue):
    +        return
    +
    +    marker = f"<!-- bedevere: {label} -->"
    +    app_id = os.environ["GH_APP_ID"]

    Not a big deal, but in other place we use os.environ.get("GH_APP_ID").

    Mariatta Mariatta commented on code on Oct 24, 2026 23:24 UTC
    Code Review
    bedevere/policy.py:1
    @@ -0,0 +1,119 @@
    +"""Respond to AI policy labels applied by triagers and core developers."""
    +
    +import os
    +
    +import gidgethub.routing
    +
    +from . import util
    +
    +router = gidgethub.routing.Router()
    +
    +COMMENT_LABEL = "ai policy comment"
    +CLOSE_LABEL = "ai policy close"
    +
    +_PR_MESSAGE_TEMPLATE = """\
    +Thank you for your interest in contributing to Python. This is a community \
    +driven project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Contributors are responsible for reviewing and \
    +understanding what they submit, checking its claims, and being able to explain \
    +changes in their own words. This helps reviewers focus on the contribution and \
    +leaves more time to support other contributors.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +PR_COMMENT_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This contribution appears to have been authored with AI assistance. "
    +        "Please explain your contribution in your own words and describe how you "
    +        "checked its correctness."
    +    )
    +)
    +
    +PR_CLOSE_MESSAGE = _PR_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this contribution because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your contribution, please let us know. "
    +        "You're welcome to explain your approach or ask questions about the guidelines."
    +    )
    +)
    +
    +_ISSUE_MESSAGE_TEMPLATE = """\
    +Thank you for taking the time to open this issue. Python is a community driven \
    +project, and we want it to be a welcoming place to learn and collaborate.
    +
    +Please review and verify the information in your issue and make sure you can \
    +explain it in your own words. This helps us understand your issue and leaves \
    +more time to address other issues.
    +
    +{action}
    +
    +Please read our [guidelines for using AI tools]\
    +(https://devguide.python.org/getting-started/ai-tools/index.html)."""
    +
    +ISSUE_COMMENT_MESSAGE = _ISSUE_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "This issue appears to have been written with AI assistance. "
    +        "Please explain your issue in your own words and describe how you checked "
    +        "the information you provided."
    +    )
    +)
    +
    +ISSUE_CLOSE_MESSAGE = _ISSUE_MESSAGE_TEMPLATE.format(
    +    action=(
    +        "We're closing this issue because we believe it does not meet our "
    +        "guidelines for using AI tools. "
    +        "If you think we've misunderstood your issue, please let us know. "
    +        "You're welcome to clarify it or ask questions about the guidelines."
    +    )
    +)
    +
    +
    +@router.register("issues", action="labeled")

    I checked the setting, and the issues event is already subscribed now.

    zanieb zanieb commented on Oct 26, 2026 18:27 UTC
    Author

    If someone could own merging this (and the related pulls) that'd be great :)

    zware zware commented on Oct 26, 2026 18:36 UTC
    Contributor

    I'd like to give @Mariatta at least a few more hours to register agreement with the response to her comments, but if it's still sitting here in my morning I'll be happy to merge :)

    willingc willingc commented on Oct 27, 2026 00:39 UTC
    Contributor

    Just an FYI that @Mariatta is returning from a conference. As a courtesy, I would give her a full day to respond (Tuesday end of day).

    Mariatta Mariatta commented on Oct 27, 2026 03:36 UTC
    Contributor

    Thanks everyone. I think the technical implementation here is good.
    But I just find the labels themselves to sound odd.

    What about the following:

  • replace ai policy comment with AI-needs-explanation (it means we're requesting follow up)

  • replace ai policy close with AI-not-acceptable (so it will automatically be closed)
  • These would match more with existing label patterns like needs backport to which signifies this pr/issue is pending some follow up action. or stale label which explains the state of the pr/issue.

    If we agree with the new labels, then I can go ahead to create these labels, merge, and deploy. (Auto deployment to cabotage still seem broken, so I'll have to do it manually).

    Mariatta Mariatta commented on Oct 27, 2026 04:44 UTC
    Contributor

    Also, I think this update is worth announcing on Discourse, so you might want to prepare such announcement @zanieb

    zanieb zanieb commented on Oct 27, 2026 18:02 UTC
    Author

    Oh I'm afraid of Discourse, would you like to? :D

    Mariatta Mariatta commented on Oct 27, 2026 20:48 UTC
    Contributor

    I'm going to start creating the labels using the AI-... prefix on the CPython repo, and deploy this. I might have follow up PR on this to make it work on other repos as well, eg on the devguide because we seem to start receiving more llm-assisted contributions there. That needs a larger refactoring, but we can start with the CPython repo for today.

    Thank you for the work.

    Mariatta Mariatta approved these changes on Oct 27, 2026 20:58 UTC
    Approved Reviewer

    Approved these changes.

    Mariatta Mariatta commented on Oct 27, 2026 20:59 UTC
    Contributor

    I ended up with the labels AI-needs-explanation and AI-guidelines-not-met (as opposed to `AI-not-acceptable).

    Reviewers
    Assignees
    zanieb zanieb
    Labels
    risk: low confidence: 88.2% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.2% (MEDIUM) · Higher = larger blast radius
    42.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 88.2% · Lower = rushed or shallow review
    88.2%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 5.0% · Safe to merge
    5.0%