From e57fb3c5dfea0c520491a14dd7a1d5af720b3c00 Mon Sep 17 00:00:00 2001 From: fallenbagel <98979876+Fallenbagel@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:12:35 +0800 Subject: [PATCH] chore: make the AI policy harder to miss on PRs and issues The AI checkbox in the PR template was ticked without any disclosure, and nothing told issue reporters the policy applies to them. PRs now need a written AI Disclosure section, the issue forms ask for one with a notice and policy checkbox, and an ai-disclosure label posts the policy on issues. --- .github/ISSUE_TEMPLATE/bug.yml | 17 +++++ .github/ISSUE_TEMPLATE/documentation.yml | 17 +++++ .github/ISSUE_TEMPLATE/enhancement.yml | 17 +++++ .github/ISSUE_TEMPLATE/maintenance.yml | 17 +++++ .github/PULL_REQUEST_TEMPLATE.md | 6 +- .github/workflows/actions.lock | 3 +- .github/workflows/seerr-labeller.yml | 83 +++++++++++++++++++++++- CONTRIBUTING.md | 16 ++++- bin/check-pr-template.mjs | 28 +++++--- 9 files changed, 189 insertions(+), 15 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 09caf30362..b92199824d 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -9,6 +9,9 @@ body: Thanks for taking the time to fill out this bug report! Please note that we use GitHub issues exclusively for bug reports and feature requests. For support requests, please use our other support channels to get help. + + > [!IMPORTANT] + > Our [AI policy](https://github.com/seerr-team/seerr/blob/develop/CONTRIBUTING.md#issues) applies to issues too. Write this issue yourself and disclose any AI use below. Issues that read as unreviewed AI output will be closed and locked. - type: textarea id: description attributes: @@ -16,6 +19,13 @@ body: description: Please provide a clear and concise description of the bug or issue. validations: required: true + - type: textarea + id: ai-disclosure + attributes: + label: AI Disclosure + description: How did you use AI to find or write up this issue, if at all? Write "None" if you didn't. + validations: + required: true - type: input id: version attributes: @@ -100,6 +110,13 @@ body: options: - label: Yes, I have searched existing issues. required: true + - type: checkboxes + id: ai-policy + attributes: + label: AI Policy + options: + - label: I have read the [AI policy](https://github.com/seerr-team/seerr/blob/develop/CONTRIBUTING.md#ai-assistance-notice) and this issue follows it. + required: true - type: checkboxes id: terms attributes: diff --git a/.github/ISSUE_TEMPLATE/documentation.yml b/.github/ISSUE_TEMPLATE/documentation.yml index 8d380a4931..498c446973 100644 --- a/.github/ISSUE_TEMPLATE/documentation.yml +++ b/.github/ISSUE_TEMPLATE/documentation.yml @@ -11,6 +11,9 @@ body: Use this template for documentation issues (typos, unclear steps, missing info, outdated screenshots). For app bugs or feature ideas, please use the other templates. + + > [!IMPORTANT] + > Our [AI policy](https://github.com/seerr-team/seerr/blob/develop/CONTRIBUTING.md#issues) applies to issues too. Write this issue yourself and disclose any AI use below. Issues that read as unreviewed AI output will be closed and locked. - type: input id: doc-location attributes: @@ -38,6 +41,13 @@ body: description: Describe the issue in the docs. validations: required: true + - type: textarea + id: ai-disclosure + attributes: + label: AI Disclosure + description: How did you use AI to find or write up this issue, if at all? Write "None" if you didn't. + validations: + required: true - type: textarea id: suggested-fix attributes: @@ -53,6 +63,13 @@ body: options: - label: Yes, I have searched existing issues. required: true + - type: checkboxes + id: ai-policy + attributes: + label: AI Policy + options: + - label: I have read the [AI policy](https://github.com/seerr-team/seerr/blob/develop/CONTRIBUTING.md#ai-assistance-notice) and this issue follows it. + required: true - type: checkboxes id: terms attributes: diff --git a/.github/ISSUE_TEMPLATE/enhancement.yml b/.github/ISSUE_TEMPLATE/enhancement.yml index 28d0e59877..66a54d1783 100644 --- a/.github/ISSUE_TEMPLATE/enhancement.yml +++ b/.github/ISSUE_TEMPLATE/enhancement.yml @@ -9,6 +9,9 @@ body: Thanks for taking the time to fill out this feature request! Please note that we use GitHub issues exclusively for bug reports and feature requests. For support requests, please use our other support channels to get help. + + > [!IMPORTANT] + > Our [AI policy](https://github.com/seerr-team/seerr/blob/develop/CONTRIBUTING.md#issues) applies to issues too. Write this issue yourself and disclose any AI use below. Issues that read as unreviewed AI output will be closed and locked. - type: textarea id: description attributes: @@ -16,6 +19,13 @@ body: description: Is your feature request related to a problem? If so, please provide a clear and concise description of the problem; e.g., "I'm always frustrated when [...]." validations: required: true + - type: textarea + id: ai-disclosure + attributes: + label: AI Disclosure + description: How did you use AI to find or write up this issue, if at all? Write "None" if you didn't. + validations: + required: true - type: textarea id: desired-behavior attributes: @@ -36,6 +46,13 @@ body: options: - label: Yes, I have searched existing issues. required: true + - type: checkboxes + id: ai-policy + attributes: + label: AI Policy + options: + - label: I have read the [AI policy](https://github.com/seerr-team/seerr/blob/develop/CONTRIBUTING.md#ai-assistance-notice) and this issue follows it. + required: true - type: checkboxes id: terms attributes: diff --git a/.github/ISSUE_TEMPLATE/maintenance.yml b/.github/ISSUE_TEMPLATE/maintenance.yml index 061d4ec98c..9a7bf553b7 100644 --- a/.github/ISSUE_TEMPLATE/maintenance.yml +++ b/.github/ISSUE_TEMPLATE/maintenance.yml @@ -9,6 +9,9 @@ body: value: | Maintainers / contributors: use this for internal tasks (CI, workflows, tooling, refactors). If you're reporting a user-facing bug or requesting a feature, use the other templates. + + > [!IMPORTANT] + > Our [AI policy](https://github.com/seerr-team/seerr/blob/develop/CONTRIBUTING.md#issues) applies to issues too. Write this issue yourself and disclose any AI use below. Issues that read as unreviewed AI output will be closed and locked. - type: dropdown id: area attributes: @@ -30,6 +33,13 @@ body: description: What needs doing and why? validations: required: true + - type: textarea + id: ai-disclosure + attributes: + label: AI Disclosure + description: How did you use AI to find or write up this issue, if at all? Write "None" if you didn't. + validations: + required: true - type: textarea id: acceptance attributes: @@ -55,6 +65,13 @@ body: options: - label: Yes, I have searched existing issues. required: true + - type: checkboxes + id: ai-policy + attributes: + label: AI Policy + options: + - label: I have read the [AI policy](https://github.com/seerr-team/seerr/blob/develop/CONTRIBUTING.md#ai-assistance-notice) and this issue follows it. + required: true - type: checkboxes id: terms attributes: diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 41a153440f..b7595a039f 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -11,6 +11,11 @@ - Fixes #XXXX +## AI Disclosure + + + + ## How Has This Been Tested? @@ -25,7 +30,6 @@ - [ ] I have read and followed the contribution [guidelines](https://github.com/seerr-team/seerr/blob/develop/CONTRIBUTING.md). -- [ ] Disclosed any use of AI (see our [policy](https://github.com/seerr-team/seerr/blob/develop/CONTRIBUTING.md#ai-assistance-notice)) - [ ] I have updated the documentation accordingly. - [ ] All new and existing tests passed. - [ ] Successful build `pnpm build` diff --git a/.github/workflows/actions.lock b/.github/workflows/actions.lock index b83aea8ca6..4bad3a2b4d 100644 --- a/.github/workflows/actions.lock +++ b/.github/workflows/actions.lock @@ -89,7 +89,8 @@ workflows: - 'actions/checkout@v7.0.1' - 'actions/create-github-app-token@v3.3.0' - 'helm/chart-testing-action@v2.9.0' - '.github/workflows/seerr-labeller.yml': [] + '.github/workflows/seerr-labeller.yml': + - 'actions/github-script@v9.0.0' '.github/workflows/stale.yml': - 'actions/stale@v11.0.0' '.github/workflows/test-docs.yml': diff --git a/.github/workflows/seerr-labeller.yml b/.github/workflows/seerr-labeller.yml index 7a4f41d2df..9e1d15d85e 100644 --- a/.github/workflows/seerr-labeller.yml +++ b/.github/workflows/seerr-labeller.yml @@ -6,7 +6,7 @@ on: pull_request_target: types: [labeled, unlabeled, reopened] issues: - types: [labeled, unlabeled, reopened] + types: [opened, labeled, unlabeled, reopened] permissions: {} @@ -111,3 +111,84 @@ jobs: run: | gh issue edit "$NUMBER" -R "$GH_REPO" --remove-label "support" || true gh issue unlock "$NUMBER" -R "$GH_REPO" || true + + ai-disclosure: + if: > + github.event_name == 'issues' && + github.event.issue.user.type != 'Bot' && + (github.event.action == 'opened' || + (github.event.action == 'labeled' && github.event.label.name == 'ai-disclosure')) + runs-on: ubuntu-26.04 + concurrency: + group: ai-disclosure-${{ github.event.issue.number }} + permissions: + issues: write + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + NUMBER: ${{ github.event.issue.number }} + ISSUE_AUTHOR: ${{ github.event.issue.user.login }} + steps: + - name: Detect a missing or contradicted AI disclosure + id: detect + if: github.event.action == 'opened' + uses: actions/github-script@v9.0.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + result-encoding: string + script: | + const SIGNATURES = [ + 'utm_source=chatgpt.com', + 'Generated with [Claude Code]', + 'chatgpt.com/share/', + 'chat.openai.com/share/', + 'claude.ai/share/', + 'gemini.google.com/share/', + 'g.co/gemini/share/', + 'perplexity.ai/search/', + 'grok.com/share/', + ]; + const TOOLS = /chatgpt|claude|copilot|gemini|gpt|llm|cursor|perplexity|deepseek|grok|translat/i; + const issue = context.payload.issue; + + let permission = 'none'; + try { + const { data } = await github.rest.repos.getCollaboratorPermissionLevel({ + owner: context.repo.owner, + repo: context.repo.repo, + username: issue.user.login, + }); + permission = data.permission; + } catch (e) { + console.log('Could not look up author permission:', e.message); + } + if (['admin', 'write'].includes(permission)) return 'false'; + + const body = (issue.body ?? '').replace(/\r\n?/g, '\n'); + const match = body.match(/(?:^|\n)### AI Disclosure[ \t]*(?=\n|$)([\s\S]*?)(?=\n### |$)/); + const answer = match ? match[1].trim() : ''; + if (!answer) return 'true'; + return String( + /^(none|no|n\/?a)\b/i.test(answer) && + !TOOLS.test(answer) && + SIGNATURES.some((s) => body.includes(s)) + ); + + - name: Ask for an AI disclosure + if: github.event.action == 'labeled' || steps.detect.outputs.result == 'true' + shell: bash + env: + BODY: > + :wave: @${{ env.ISSUE_AUTHOR }}, issues are a contribution as well, and they fall under our [AI policy](https://github.com/seerr-team/seerr/blob/develop/CONTRIBUTING.md#ai-assistance-notice). + + Please update the AI Disclosure in this issue, or add one if it's missing, to say how you used AI to find or write it up, if at all. Issues must be written in your own words. AI-assisted translation is fine, but please note it. + run: | + retry() { n=0; until "$@"; do n=$((n+1)); [ $n -ge 3 ] && break; echo "retry $n: $*" >&2; sleep 2; done; } + retry gh issue comment "$NUMBER" -R "$GH_REPO" -b "$BODY" || true + + - name: Label the issue + if: steps.detect.outputs.result == 'true' + shell: bash + run: | + retry() { n=0; until "$@"; do n=$((n+1)); [ $n -ge 3 ] && break; echo "retry $n: $*" >&2; sleep 2; done; } + retry gh issue edit "$NUMBER" -R "$GH_REPO" --add-label ai-disclosure || true diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 879f57239a..7c9a55ae5b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,6 +20,8 @@ Depending on maintainer availability and how much review a change needs, it can > [!IMPORTANT] > +> Issues and comments are contributions as well, and this policy covers them. +> > AI-driven contributions are not allowed and will be rejected, even if you reviewed and tested them. This is an open-source project maintained by volunteers, and our time goes to reviewing your work, not your AI's. We have no issue with contributors using AI tools as an aid, but the contribution has to be yours, and it is your responsibility to make sure it meets our quality standards. > > **We expect AI-assisted development, not AI-driven development.** Use AI as a tool to help you understand the codebase, debug, or scaffold something you then write yourself. If an AI wrote the change, reviewing it, testing it, and submitting it yourself does not make it AI-assisted. The approach and the implementation have to be yours, and you have to understand every line of it. Whether a PR is AI-assisted or AI-driven is the maintainers' call, based on how the contribution reads and how you handle review, and claiming you drove it doesn't override that. We have been increasingly receiving low-effort, fully AI-generated PRs and will not tolerate them. Contributors who repeatedly submit AI-driven work may be banned. @@ -37,13 +39,21 @@ Depending on maintainer availability and how much review a change needs, it can > **Read and follow the [Contributing Guide](CONTRIBUTING.md) before submitting.** > If your AI tool generates its own PR description format, it is your responsibility to rewrite it to follow our template before submitting, and rewrite means write the content yourself, not relabel the AI's output under our section headers. An incomplete PR template tells maintainers that insufficient review has been performed on the submission, regardless of the actual code quality. We may close such PRs without review. > -> If you are using **any kind of AI assistance** to contribute to Seerr, it must be disclosed in the pull request. +> If you are using **any kind of AI assistance** to contribute to Seerr, it must be disclosed in the pull request or issue. + +### Issues + +Write your issue yourself, using the issue form. Bypassing the form breaks this policy on its own. Moving AI output under the form's headings doesn't count as filling it in. + +For bug reports, describe what happened, how to reproduce it, your logs and your setup. Don't include a root cause or diagnosis that came from AI, as that's where wrong details creep in. If you found the cause yourself and understand it, put it under Additional Context. + +AI-generated issues will be closed and locked. ### Disclosure Requirements -If you are using any kind of AI assistance while contributing to Seerr, **this must be disclosed in the pull request description**, along with the extent to which AI assistance was used (e.g., docs only vs. code generation). +If you are using any kind of AI assistance while contributing to Seerr, **this must be disclosed in the AI Disclosure section of your pull request or issue**, along with the extent to which AI assistance was used (e.g., docs only vs. code generation). -PR responses (comments, review replies) must be written in your own words, per the Expectations below. The one exception is AI-assisted translation, if you use AI to translate a response into English, disclose that here too. +Issue comments and PR responses (comments, review replies) must be written in your own words, per the Expectations below. The one exception is AI-assisted translation, if you use AI to translate a response into English, disclose that here too. As a small exception, trivial tab-completion doesn't need to be disclosed, so long as it is limited to single keywords or short phrases. diff --git a/bin/check-pr-template.mjs b/bin/check-pr-template.mjs index 2362fc2a3b..bf24c4a185 100644 --- a/bin/check-pr-template.mjs +++ b/bin/check-pr-template.mjs @@ -13,7 +13,7 @@ if (!bodyFile) { process.exit(2); } -const body = readFileSync(resolve(bodyFile), 'utf8'); +const body = readFileSync(resolve(bodyFile), 'utf8').replace(/\r\n?/g, '\n'); const issues = []; const MAINTAINER_PERMISSIONS = ['admin', 'write']; @@ -33,7 +33,9 @@ const stripComments = (s) => { const stripFixesPlaceholder = (s) => s.replace(/-\s*Fixes\s*`?#XXXX`?/gi, ''); -const descriptionMatch = body.match(/## Description\s*\n([\s\S]*?)(?=\n## |$)/); +const descriptionMatch = body.match( + /(?:^|\n) {0,3}## Description[ \t]*(?=\n|$)([\s\S]*?)(?=\n {0,3}## |$)/ +); const descriptionContent = descriptionMatch ? stripFixesPlaceholder(stripComments(descriptionMatch[1])).trim() : ''; @@ -45,7 +47,7 @@ if (!descriptionContent) { } const testingMatch = body.match( - /## How Has This Been Tested\?\s*\n([\s\S]*?)(?=\n## |$)/ + /(?:^|\n) {0,3}## How Has This Been Tested\?[ \t]*(?=\n|$)([\s\S]*?)(?=\n {0,3}## |$)/ ); const testingContent = testingMatch ? stripComments(testingMatch[1]).trim() @@ -55,7 +57,9 @@ if (!testingContent) { issues.push('**How Has This Been Tested?** section is empty.'); } -const checklistMatch = body.match(/## Checklist:\s*\n([\s\S]*?)$/); +const checklistMatch = body.match( + /(?:^|\n) {0,3}## Checklist:[ \t]*\n([\s\S]*?)$/ +); const checklistContent = checklistMatch ? checklistMatch[1] : ''; const totalBoxes = (checklistContent.match(/- \[[ x]\]/gi) || []).length; @@ -75,11 +79,17 @@ if ( issues.push('The **contribution guidelines** checkbox has not been checked.'); } -if ( - !isMaintainer && - !/- \[x\] Disclosed any use of AI/i.test(checklistContent) -) { - issues.push('The **AI disclosure** checkbox has not been checked.'); +const aiMatch = body.match( + /(?:^|\n) {0,3}## AI Disclosure[ \t]*(?=\n|$)([\s\S]*?)(?=\n {0,3}## |$)/ +); +const aiContent = aiMatch ? stripComments(aiMatch[1]).trim() : ''; +const legacyAiBox = + !aiMatch && /- \[x\] Disclosed any use of AI/i.test(checklistContent); + +if (!isMaintainer && !aiContent && !legacyAiBox) { + issues.push( + '**AI Disclosure** section is empty. Describe how you used AI, or write "None".' + ); } if (/-\s*Fixes\s*`?#XXXX`?/i.test(body)) {