Skip to content

docs: add AI usage policy for contributors#2111

Merged
asyncapi-bot merged 10 commits into
asyncapi:masterfrom
derberg:aipolicy
Jun 17, 2026
Merged

docs: add AI usage policy for contributors#2111
asyncapi-bot merged 10 commits into
asyncapi:masterfrom
derberg:aipolicy

Conversation

@derberg

@derberg derberg commented Jun 1, 2026

Copy link
Copy Markdown
Member

Resolves #2094

Description

Adds an AI usage policy for contributors:

  • AI-POLICY.md — human authorship/accountability, contributor responsibilities, required Generated-by: disclosure, functions off-limits for automation, and consequences.
  • PR template — AI-assistance section (Generated-by: line + "no AI" checkbox).
  • verify-ai-disclosure workflow — checks each PR declares one of the two and comments with fix instructions when it doesn't.

AI assistance

  • This PR was created with AI assistance — Generated-by: Claude Code (Opus 4.8)
  • No AI assistance was used

Summary by CodeRabbit

  • Documentation
    • Added an AI usage policy covering permitted use, disclosure expectations, verification responsibilities, and non-compliance consequences
    • Updated contributing guidance, README, and the PR template to require clear AI-assistance disclosure
  • Chores
    • Added an automated workflow that verifies PR descriptions include exactly one required AI disclosure option and flags non-compliant submissions
  • Configuration
    • Updated ownership rules for AI agent instruction documents in CODEOWNERS

@changeset-bot

changeset-bot Bot commented Jun 1, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 79e8fc6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@asyncapi-bot

Copy link
Copy Markdown
Contributor

What reviewer looks at during PR review

The following are ideal points maintainers look for during review. Reviewing these points yourself beforehand can help streamline the review process and reduce time to merge.

  1. PR Title: Use a concise title that follows our Conventional Commits guidelines and clearly summarizes the change using imperative mood (it means spoken or written as if giving a command or instruction, like "add new helper for listing operations")

    Note - In Generator, prepend feat: or fix: in PR title only when PATCH/MINOR release must be triggered.

  2. PR Description: Clearly explain the issue being solved, summarize the changes made, and mention the related issue.

    Note - In Generator, we use Maintainers Work board to track progress. Ensure the PR Description includes Resolves #<issue-number> or Fixes #<issue-number> this will automatically close the linked issue when the PR is merged and helps automate the maintainers workflow.

  3. Documentation: Update the relevant Generator documentation to accurately reflect the changes introduced in the PR, ensuring users and contributors have up-to-date guidance.

  4. Comments and JSDoc: Write clear and consistent JSDoc comments for functions, including parameter types, return values, and error conditions, so others can easily understand and use the code.

  5. DRY Code: Ensure the code follows the Don't Repeat Yourself principle. Look out for duplicate logic that can be reused.

  6. Test Coverage: Ensure the new code is well-tested with meaningful test cases that pass consistently and cover all relevant edge cases.

  7. Commit History: Contributors should avoid force-pushing as much as possible. It makes it harder to track incremental changes and review the latest updates.

  8. Template Design Principles Alignment: While reviewing template-related changes in the packages/ directory, ensure they align with the Assumptions and Principles. If any principle feels outdated or no longer applicable, start a discussion these principles are meant to evolve with the project.

  9. Reduce Scope When Needed: If an issue or PR feels too large or complex, consider splitting it and creating follow-up issues. Smaller, focused PRs are easier to review and merge.

  10. Bot Comments: As reviewers, check that contributors have appropriately addressed comments or suggestions made by automated bots. If there are bot comments the reviewer disagrees with, react to them or mark them as resolved, so the review history remains clear and accurate.

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR establishes an AI disclosure policy and enforcement system: adds AI-POLICY.md, updates CONTRIBUTING.md and README, adds AI-assistance checkboxes to the PR template, and implements a GitHub Actions workflow that verifies PR disclosure compliance.

Changes

AI Disclosure Policy and Enforcement

Layer / File(s) Summary
Policy definition and contributor guidance
AI-POLICY.md, CONTRIBUTING.md, README.md, CODEOWNERS
AI-POLICY.md defines AI usage scope, contributor responsibilities, disclosure requirements, and enforcement. CONTRIBUTING.md adds an "AI-Assisted Contributions" section with disclosure expectations and links to the full policy. README.md instructs contributors to review the AI usage policy. CODEOWNERS designates ownership for AGENTS.md and CLAUDE.md.
PR template AI disclosure section
.github/pull-request-template.md
PR template adds an "AI assistance" section with a policy link, instruction to check exactly one option, a Generated-by: placeholder for materially AI-assisted PRs, and reformats the Related issue(s) HTML comment closing marker onto its own line.
Automated CI disclosure verification
.github/workflows/verify-ai-disclosure.yml
New verify-ai-disclosure workflow runs on PR lifecycle events, strips HTML comments, checks for the "No AI assistance" checkbox or a non-empty Generated-by: declaration, deletes prior failure comments for compliant PRs, posts or updates a failure comment for non-compliant PRs, and fails the workflow when disclosure is missing.

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'docs: add AI usage policy for contributors' follows Conventional Commits guidelines with the 'docs:' prefix, uses imperative mood ('add'), and clearly summarizes the main change introduced in this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/verify-ai-disclosure.yml (1)

65-76: ⚡ Quick win

Enforce mutually exclusive declarations to match template intent.

Current logic accepts both “No AI assistance” and a non-empty Generated-by, but the template requires exactly one declaration. Consider failing when both are present and guiding the author to choose one.

Suggested fix
-            if (noAiChecked || hasGeneratedBy) {
+            if (noAiChecked && hasGeneratedBy) {
+              const conflictMessage = [
+                MARKER,
+                '### ⚠️ Conflicting AI-assistance disclosure',
+                '',
+                'Please choose exactly one option:',
+                '- either check **"No AI assistance was used"**',
+                '- or provide a non-empty `Generated-by:` declaration.',
+              ].join('\n');
+              if (existing) {
+                await github.rest.issues.updateComment({ owner, repo, comment_id: existing.id, body: conflictMessage });
+              } else {
+                await github.rest.issues.createComment({ owner, repo, issue_number, body: conflictMessage });
+              }
+              core.setFailed(`Conflicting AI-assistance disclosure. See ${policyUrl}`);
+              return;
+            }
+
+            if (noAiChecked || hasGeneratedBy) {
               core.info(
                 hasGeneratedBy
                   ? `AI assistance disclosed: Generated-by: ${generatedByValue}`
                   : 'Declared: no AI assistance used.'
               );

Also applies to: 93-100

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

In @.github/workflows/verify-ai-disclosure.yml around lines 65 - 76, Update the
acceptance logic so the declarations are mutually exclusive: replace the current
if check that allows noAiChecked OR hasGeneratedBy with an exclusive condition
that requires exactly one to be true (XOR between noAiChecked and
hasGeneratedBy); if both are present (noAiChecked && hasGeneratedBy) treat it as
a failure path that posts/retains a guidance comment instructing the author to
choose either “No AI assistance” or a single non-empty Generated-by value (use
generatedByValue for the message) and do not delete existing failure comments;
apply the same XOR enforcement change to the duplicate block that currently
mirrors this logic (the block around the later occurrence referenced in the
review).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AI-POLICY.md`:
- Around line 41-44: The fenced code block containing the lines "Generated-by:
Claude Code 1.x" and "Generated-by: GitHub Copilot" is missing a language tag
and triggers markdownlint MD040; update the opening fence (the triple backticks
before those lines) to include a language identifier such as text (i.e., change
``` to ```text) so the block is properly tagged and linting passes.

---

Nitpick comments:
In @.github/workflows/verify-ai-disclosure.yml:
- Around line 65-76: Update the acceptance logic so the declarations are
mutually exclusive: replace the current if check that allows noAiChecked OR
hasGeneratedBy with an exclusive condition that requires exactly one to be true
(XOR between noAiChecked and hasGeneratedBy); if both are present (noAiChecked
&& hasGeneratedBy) treat it as a failure path that posts/retains a guidance
comment instructing the author to choose either “No AI assistance” or a single
non-empty Generated-by value (use generatedByValue for the message) and do not
delete existing failure comments; apply the same XOR enforcement change to the
duplicate block that currently mirrors this logic (the block around the later
occurrence referenced in the review).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d63dfab8-6028-4323-880e-a429eb84b651

📥 Commits

Reviewing files that changed from the base of the PR and between 09f31e8 and 9dc703b.

📒 Files selected for processing (5)
  • .github/pull-request-template.md
  • .github/workflows/verify-ai-disclosure.yml
  • AI-POLICY.md
  • CONTRIBUTING.md
  • README.md

Comment thread AI-POLICY.md Outdated

@Adi-204 Adi-204 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@derberg love it! only left one comment

Comment thread CONTRIBUTING.md Outdated
Adi-204
Adi-204 previously approved these changes Jun 6, 2026
@Adi-204

Adi-204 commented Jun 6, 2026

Copy link
Copy Markdown
Member

@derberg I can't merge the PR needs your or other maintainer review.

magicmatatjahu
magicmatatjahu previously approved these changes Jun 16, 2026
@derberg
derberg dismissed stale reviews from magicmatatjahu and Adi-204 via ec773ea June 16, 2026 07:08

@Florence-Njeri Florence-Njeri left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM :)

@derberg derberg moved this to In Progress in Maintainers work Jun 17, 2026
@derberg derberg self-assigned this Jun 17, 2026
@sonarqubecloud

Copy link
Copy Markdown

@derberg

derberg commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

/rtm

@asyncapi-bot
asyncapi-bot merged commit 13d0f89 into asyncapi:master Jun 17, 2026
32 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Maintainers work Jun 17, 2026
@Adi-204 Adi-204 moved this from Done to Archive in Maintainers work Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Archive

Development

Successfully merging this pull request may close these issues.

add ai policy

5 participants