diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 615e91bad..c12b45949 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -31,9 +31,19 @@ body: value: | #### 🤖 Use of AI tools - If this report was generated, in whole or in part, by an AI tool or agent you **must** clearly say so in the description below. Failing to clearly disclose this is a violation of our [Code of Conduct](https://github.com/paperless-ngx/paperless-ngx/blob/main/CODE_OF_CONDUCT.md). + If this report was generated, in whole or in part, by an AI tool or agent you **must** say so using the field below. Failing to clearly disclose this is a violation of our [Code of Conduct](https://github.com/paperless-ngx/paperless-ngx/blob/main/CODE_OF_CONDUCT.md). Reports written by an AI agent must describe the _observed behavior only_: what happened, how to reproduce it, logs etc. Do **not** include code analysis, speculation about the root cause, or suggest code fixes. + - type: dropdown + id: ai-usage + attributes: + label: AI usage + description: Was any part of this report written by an AI tool or agent? + options: + - No AI tools were used + - Yes, AI tools helped write this report + validations: + required: true - type: textarea id: description attributes: diff --git a/.github/workflows/issue-bot.yml b/.github/workflows/issue-bot.yml index 83ddba7b1..363ee6892 100644 --- a/.github/workflows/issue-bot.yml +++ b/.github/workflows/issue-bot.yml @@ -43,6 +43,12 @@ jobs: const haystack = `${issue.title}\n${issue.body ?? ''}`; const honeypot = haystack.toUpperCase().includes('ASLOP-PR-VERIFY'); + // The form's required "AI usage" dropdown renders as a `### AI usage` section. An agent + // that follows the template trips the honeypot even when it discloses, so only treat + // the honeypot as undisclosed AI use when the reporter did not answer "Yes" here. + const aiUsage = (issue.body ?? '').match(/^###\s+AI usage\s*\n+\s*(.+?)\s*$/m)?.[1] ?? ''; + const disclosedAI = aiUsage.toLowerCase().startsWith('yes'); + // Issues opened through the form always get the template's default labels. GitHub // applies them a second or two *after* creation, so re-read them instead of trusting // the webhook payload, and retry before concluding that there are none. @@ -55,19 +61,29 @@ jobs: if (labels.some((label) => templateLabels.includes(label))) break; } const bypassedTemplate = !labels.some((label) => templateLabels.includes(label)); - core.info(`Labels: [${labels.join(', ')}], honeypot: ${honeypot}, bypassed template: ${bypassedTemplate}`); + core.info( + `Labels: [${labels.join(', ')}], honeypot: ${honeypot}, AI usage: "${aiUsage}", ` + + `bypassed template: ${bypassedTemplate}` + ); - if (!honeypot && !bypassedTemplate) { - core.info('No slop signals found'); + if (!bypassedTemplate && (disclosedAI || !honeypot)) { + if (disclosedAI) { + core.info('AI use disclosed, labeling only'); + await github.rest.issues.addLabels({ ...common, labels: ['ai'] }); + } else { + core.info('No slop signals found'); + } return; } - // The honeypot is only ever tripped deliberately, so that message can name the cause. + // Reaching here with the honeypot means AI usage was not disclosed in the form, so that + // message can name the cause. // A missing template label only tells us the issue did not come from the form, which // is reason enough to close it, but not proof of how it was written. const body = honeypot ? 'This issue was automatically closed because it contains a marker that is only visible to ' + - 'automated tools, which indicates it was generated by an AI agent without being disclosed as such.\n\n' + + 'automated tools, which indicates it was generated by an AI agent, but the "AI usage" field does not ' + + 'disclose this.\n\n' + `Please see our [contributing guidelines](${contributing}) and [Code of Conduct](${codeOfConduct}). ` + 'You are welcome to open a new issue that describes the problem you observed in your own words.' : 'This issue was automatically closed because it was not opened using our bug report form. ' +