-
-
Notifications
You must be signed in to change notification settings - Fork 35k
doc: create ai-guidelines and include to CONTRIBUTING #62105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,6 +19,7 @@ works. | |||||||||
| * [Code of Conduct](#code-of-conduct) | ||||||||||
| * [Issues](#issues) | ||||||||||
| * [Pull Requests](#pull-requests) | ||||||||||
| * [AI Use Policy and Guidelines](#ai-use-policy-and-guidelines) | ||||||||||
| * [Developer's Certificate of Origin 1.1](#developers-certificate-of-origin-11) | ||||||||||
|
|
||||||||||
| ## [Code of Conduct](./doc/contributing/code-of-conduct.md) | ||||||||||
|
|
@@ -47,6 +48,15 @@ dependencies, and tools contained in the `nodejs/node` repository. | |||||||||
| * [Reviewing Pull Requests](./doc/contributing/pull-requests.md#reviewing-pull-requests) | ||||||||||
| * [Notes](./doc/contributing/pull-requests.md#notes) | ||||||||||
|
|
||||||||||
| ## [AI Use Policy and Guidelines](./doc/contributing/ai-guidelines.md) | ||||||||||
|
|
||||||||||
| Node.js expects contributors to understand and take full responsibility for | ||||||||||
| every change they propose. Pull requests consisting of AI-generated code the | ||||||||||
| contributor has not personally understood, tested, and verified will be closed | ||||||||||
| without review. | ||||||||||
|
Comment on lines
+55
to
+56
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
|
||||||||||
| See [details on our AI use policy and guidelines](./doc/contributing/ai-guidelines.md). | ||||||||||
|
|
||||||||||
| ## Developer's Certificate of Origin 1.1 | ||||||||||
|
|
||||||||||
| ```text | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,61 @@ | ||||||||||||||||||||||
| # AI use policy and guidelines | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| * [Core principle](#core-principle) | ||||||||||||||||||||||
| * [Using AI for code contributions](#using-ai-for-code-contributions) | ||||||||||||||||||||||
| * [Using AI for communication](#using-ai-for-communication) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Core principle | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Node.js expects contributors to understand and take full responsibility for | ||||||||||||||||||||||
| every change they propose. The answer to "Why is X an improvement?" should | ||||||||||||||||||||||
| never be "I'm not sure. The AI did it." | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Pull requests that consist of AI-generated code the contributor has not | ||||||||||||||||||||||
| personally understood, tested, and verified waste collaborator time and | ||||||||||||||||||||||
| will be closed without review. | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Using AI for code contributions | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| AI tools may assist contributors, but must not replace contributor judgment. | ||||||||||||||||||||||
| When using AI as a coding assistant: | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| * **Understand the codebase first.** Do not skip familiarizing yourself with | ||||||||||||||||||||||
| the relevant subsystem. LLMs frequently produce inaccurate descriptions of | ||||||||||||||||||||||
| Node.js internals — always verify against the actual source. When using an AI | ||||||||||||||||||||||
| tool, ask it to cite the exact source files/PRs/docs it’s relying on, and then | ||||||||||||||||||||||
| match the claim against that resource to verify if it holds up in the current | ||||||||||||||||||||||
| code. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| * **Own every line you submit.** You are responsible for all code in your | ||||||||||||||||||||||
| pull request, regardless of how it was generated. Be prepared to explain | ||||||||||||||||||||||
| any change in detail during review. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| * **Keep logical commits.** Structure commits coherently even when an LLM | ||||||||||||||||||||||
| generates multiple changes at once. Follow the existing | ||||||||||||||||||||||
| [commit message guidelines][]. | ||||||||||||||||||||||
RafaelGSS marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| * **Test thoroughly.** AI-generated code must pass the full test suite and | ||||||||||||||||||||||
| any manually written tests relevant to the change. Existing Tests should not | ||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
| be removed or modified without human verification. Do not rely on the LLM | ||||||||||||||||||||||
| to assess correctness. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| * **Edit generated comments critically.** LLM-produced comments are often | ||||||||||||||||||||||
| verbose or inaccurate. Remove comments that simply restate what the code | ||||||||||||||||||||||
| does; add comments only where the logic is non-obvious. | ||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would add a "do not disappear" section. Fly-by PRs are problematic. It's ok to close PRs if one cannot pursue them further, while stalling block progress. |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Using AI for communication | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Node.js values concise, precise communication that respects collaborator time. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| * **Do not post AI-generated messages** in pull requests, issues, or the | ||||||||||||||||||||||
| project's communication channels. | ||||||||||||||||||||||
|
Comment on lines
+50
to
+51
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the intended action to take when this occurs? This currently comprises a significant proportion of GH traffic on the core repo; if we are making this a guideline, I would anticipate it applying to a lot of issues/PRs.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If that recurring, we should ping the author to stop that, if that doesn't work, we escalate it to TSC/Moderation.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would recommend allowing pull requests descriptions and commit messages. It's quite useful for those. I would limit this to "when responding to humans".
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I generally disagree with pull requests descriptions. I find them too verbose and stating the obvious.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit
Suggested change
EDIT: hum I guess that's already covered by the last item. What I find weird is that we start by saying "Don't send AI-generated messages", while we're still accepting AI-generated content 🤔
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about something like:
Suggested change
So it emphasizes it is fully AI generated, extremely verbose descriptions that suck. |
||||||||||||||||||||||
| * **Verify accuracy** of any LLM-generated content before including it in a | ||||||||||||||||||||||
| PR description or comment. | ||||||||||||||||||||||
| * **Complete pull request templates fully** rather than replacing them with | ||||||||||||||||||||||
| LLM-generated summaries. | ||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have a template? I thought those are for issues, not PRs.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not strictly a template: https://github.com/nodejs/node/blob/main/.github/PULL_REQUEST_TEMPLATE.md?plain=1 |
||||||||||||||||||||||
| * **Link to primary sources** — code, documentation, specifications — rather | ||||||||||||||||||||||
| than quoting LLM answers. | ||||||||||||||||||||||
| * Grammar and spell-check tools are acceptable when they improve clarity and | ||||||||||||||||||||||
| conciseness. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| [commit message guidelines]: ./pull-requests.md#commit-message-guidelines | ||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing it from "will" to "shall" makes it mandatory.
"will" is however fine in everyday language as a statement of intention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I'm trying to convey is that we cannot guarantee that such PR will definitely be closed, but it's the intention. I guess we could use
mightinstead:Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand your intentions and I've made an alternative suggestion in #62105 (comment) which should indicate that the likely outcome is for the PR to be closed, without actually guaranteeing this action.