Mingyu's Library主页
AI Daily · 2026-08-08 · 深度学习AI Daily · 2026-08-08 · Deep dive

开源项目的 AI 贡献政策:从 OpenJDK 全面禁止到 Rust“披露 + 更高门槛”

Open-Source AI Contribution Policies: from OpenJDK’s ban to Rust’s “disclose and raise the bar”

基于 OpenJDK、Rust、Linux 内核等项目的政策文本与报道整理。读完你会知道:各项目为什么立规矩、规矩差在哪、用编码 agent 提 PR 时该怎么做。

Based on policy texts and coverage from OpenJDK, Rust, the Linux kernel and others. You will learn why projects are setting rules, how the rules differ, and what to do when you send PRs written with a coding agent.

130 秒速览

1The 30-second version

一句话:2026 年 8 月第一周,两个重量级开源项目给出了截然不同的答案——OpenJDK 临时禁止任何“部分或全部由大模型生成”的贡献;Rust(rust-lang/rust 仓库)则允许有限使用,但必须披露、必须带测试、关键代码不许生成。两者都在保护同一样稀缺资源:维护者的审阅注意力。

In one sentence: in the first week of August 2026 two heavyweight open-source projects gave opposite answers. OpenJDK temporarily bans any contribution “generated, in part or in full, by large language models”; Rust (the rust-lang/rust repository) allows limited use but requires disclosure, tests, and no generated soundness-critical code. Both protect the same scarce resource: maintainers’ review attention.

先说名词:贡献(contribution)是外部开发者向开源项目提交的代码、文档或问题报告;PR(拉取请求)是提交改动、请维护者审阅合并的方式;披露就是在提交里写明“这里用了 AI”。

Quick vocabulary: a contribution is code, docs or an issue report that an outside developer submits to an open-source project; a PR (pull request) is how you propose a change for maintainers to review and merge; disclosure means stating in the submission that AI was used.

← 更严更宽 →NetBSD·Gentoo2024 视为受污染QEMU2025 禁止OpenJDK部分生成也禁Godot禁实质性生成Rust披露 + 必带测试Linux 内核Assisted-byFedora鼓励披露Debian*鼓励披露禁止提交 AI 生成内容限制范围 + 必须披露允许使用,人负全责* Debian 投票 08-15 至 08-28,结果晚于本文日期;位置为作者据各政策文本归纳的示意
图 1 · 主要开源项目的 AI 贡献政策光谱(作者据各政策文本归纳的示意,非官方分级)
← stricterlooser →NetBSD·Gentoo2024: “tainted”QEMU2025 banOpenJDKno partial AIGodotno substantial AIRustdisclose + testsLinux kernelAssisted-byFedoradisclosure urgedDebian*disclosure urgedNo AI-generated contentRestricted + must discloseAllowed; human accountable* Debian voted Aug 15–28, after this article’s date; placement is the author’s sketch from each policy text
Figure 1 · Spectrum of AI contribution policies across major projects (author’s sketch from the policy texts, not an official ranking)
为什么值得读:如果你每天用 Claude Code、Codex 这类编码 agent,并且会给开源项目提 PR,那么“这个项目能不能提 AI 写的代码、要不要写明、怎么写”已经是提交前必须回答的问题。答错的代价是 PR 被直接关闭,甚至被举报给项目管理者。
Why read this: if you use coding agents such as Claude Code or Codex every day and send PRs to open-source projects, “may I submit AI-written code here, must I say so, and how” is now a question to answer before you submit. Getting it wrong means a closed PR or even an escalation to the project lead.

2背景:为什么是现在

2Background: why now

各项目给出的理由高度一致,可以归成三类:

The reasons projects give are strikingly similar and fall into three groups:

  1. 审阅负担:Rust 政策作者 Jynn Nelson 写道,LLM 让 PR 数量上升,加剧了本已短缺的审阅带宽;而“打磨精致的 PR 不再可靠地代表投入与理解”。Godot 维护者称积压的 PR 中很多由 AI 撰写,“AI 贡献还额外令人沮丧”。
  2. 质量与安全:OpenJDK 称它支撑着关键任务系统,“看似合理但不正确的代码会危及这些关键属性”。
  3. 法律不确定性:OpenJDK 的贡献受 Oracle Contributor Agreement(OCA)约束,要求贡献者保证拥有必要的知识产权;而 AI 输出的权利归属尚在诉讼中。NetBSD(2024)和 QEMU 也是出于版权与 DCO 合规的担忧。
  1. Review burden: Rust policy author Jynn Nelson writes that LLMs raise PR volume and worsen an existing shortage of review bandwidth, and that “polished PRs no longer reliably signal effort or understanding.” Godot maintainers say much of their PR backlog is AI-authored and that “AI contributions have the added pain of being demoralizing.”
  2. Quality and safety: OpenJDK says it underpins mission-critical systems and that “plausible-looking but incorrect code would put these critical properties at risk.”
  3. Legal uncertainty: OpenJDK contributions fall under the Oracle Contributor Agreement (OCA), which requires contributors to guarantee they hold the necessary IP rights, while rights in model output are still being litigated. NetBSD (2024) and QEMU acted on similar copyright and DCO concerns.

还有一个常被忽略的理由来自 Godot:代码审阅历来是培养下一代维护者的途径,而对 AI 给出的反馈不会让模型下次改进,这部分“导师价值”就被机器吸收掉了。

A less obvious reason comes from Godot: code review has long been how projects mentor future maintainers, and feedback given to an AI does not change how the model behaves next time, so that mentoring value is “absorbed by a machine.”

474OpenJDK 政策 HN 帖得分
338 条评论
5采纳 Rust 政策的团队数
仅限 rust-lang/rust
8 + 1Debian 投票选项
(8-15 至 8-28)
≤ 20 行QEMU 放宽提案里
允许 AI 的 bug 修复规模
474HN points on the OpenJDK thread
338 comments
5Rust teams adopting the policy
rust-lang/rust only
8 + 1Debian ballot options
(Aug 15–28)
≤ 20 linesbug-fix size QEMU’s relaxation
proposal would allow with AI

数据来源:Developers Digest 08-08 简报(HN 数据)、Rust Inside 博客、it-connect(Debian)、WebProNews(QEMU)。

Data: Developers Digest brief of Aug 8 (HN figures), Rust Inside blog, it-connect (Debian), WebProNews (QEMU).

3核心概念

3Core concepts

DCO 与 Signed-off-by
Developer Certificate of Origin:贡献者在提交里加一行 Signed-off-by: 姓名 <邮箱>,声明自己有权以项目许可证提交这段代码。Linux 内核明确规定 AI agent 不得添加 Signed-off-by,只有人能做这个认证。
CLA / OCA
贡献者许可协议。OpenJDK 用的是 Oracle Contributor Agreement,要求贡献者保证拥有相关知识产权——这正是 AI 输出难以保证的地方。
Trailer(提交尾注)
写在提交信息末尾的“键: 值”行。和 AI 相关的有三种:Co-Authored-By(很多编码 agent 默认添加)、Assisted-by(Linux 内核、Fedora)、AI-used-for(QEMU 放宽提案)。
Soundness-critical(健全性关键)
Rust 术语,指一旦写错就可能破坏类型系统/内存安全保证的代码。Rust 政策禁止由 LLM 生成这类改动(除非作者本身是该领域专家,且仍强烈不建议)。
“受污染代码”(tainted)
NetBSD 2024 年的说法:由 LLM 等工具生成的代码被推定为受污染,未经核心团队书面批准不得提交。
披露 vs 禁止
披露型政策允许使用但要求写明;禁止型政策连“改过的 AI 输出”也不收。两者都把“隐瞒”视为违规。
DCO and Signed-off-by
Developer Certificate of Origin: the contributor adds Signed-off-by: Name <email> to a commit, certifying the right to submit it under the project’s licence. The Linux kernel states that AI agents must not add Signed-off-by; only a human can certify.
CLA / OCA
Contributor licence agreement. OpenJDK uses the Oracle Contributor Agreement, which requires contributors to guarantee they hold the relevant IP rights — exactly what is hard to guarantee for AI output.
Trailer
A “Key: value” line at the end of a commit message. Three AI-related ones appear: Co-Authored-By (added by default by many coding agents), Assisted-by (Linux kernel, Fedora) and AI-used-for (QEMU’s relaxation proposal).
Soundness-critical
Rust term for code whose mistakes can break type-system or memory-safety guarantees. Rust’s policy forbids LLM-generated changes of this kind (unless the author is already a domain expert, and even then it is strongly discouraged).
“Tainted” code
NetBSD’s 2024 wording: code generated by LLMs and similar tools is presumed tainted and may not be committed without written approval from core.
Disclosure vs ban
Disclosure policies allow use but require you to say so; ban policies reject even edited AI output. Both treat concealment as a violation.

4光谱:主要项目怎么规定

4The spectrum: what major projects require

下表按“从严到宽”排列。日期为政策发布或报道日期;状态以各来源描述为准。

The table runs from strictest to loosest. Dates are when each policy was published or reported; status is as each source describes it.

项目时间核心规则披露方式
NetBSD2024-05LLM 生成代码推定为“受污染”,未经核心团队书面批准不得提交—
Gentoo2024-04理事会决定禁止 AI 辅助贡献(据 Linuxiac 转述)—
QEMU2025 禁止;2026-05-28 提议放宽原因为 DCO/版权;放宽提案允许测试、文档、机械重构与 ≤20 行 bug 修复,核心代码仍需维护者明确批准(讨论中)AI-used-for:(提案)
OpenJDK2026-08(临时)禁止部分或全部由 LLM/扩散模型生成的代码、文本、图片;覆盖仓库、PR、邮件、wiki、JBS;允许私下用于理解、调试、审阅PR 勾选声明合规(Skara,计划中)
Zig2026-04“零容忍”(据 The New Stack 一句提及)—
Godot2026-07(修订中)禁止自主 agent 与“氛围编程”PR;任何实质性代码不得由 AI 生成;小任务(补全、正则、替换)可用但须披露;合并 PR ≤3 个的新人提新功能/大重构须先获批PR 中说明
Rust(rust-lang/rust)2026-08-05可用于回答、分析、提炼、检查、建议、审阅,原则上不用于“创作”;事先约定的非关键改动可由 LLM 生成;LLM PR 必须带测试;禁止生成 soundness 关键改动必须披露;PR 模板将询问
Linux 内核现行文档AI 不得加 Signed-off-by;人审阅全部代码、确认 GPL-2.0 兼容并负全责;AI 找 bug 时不得自行发报告Assisted-by:
Fedora2025-10允许 AI 辅助,贡献者是真正作者并负全责;审阅可借助 AI,但最终决定须由人做;产品内 AI 功能须 opt-in鼓励 Assisted-by:
Debian投票 2026-08-15 至 08-28(晚于本文日期)胜出选项“负责任地使用生成式 AI”:不禁止也不背书;须审阅、测试、修正;非公开信息不得发给第三方 AI;批量改动须事先讨论鼓励但不强制
ProjectWhenCore ruleDisclosure
NetBSD2024-05LLM-generated code presumed “tainted”; no commit without written approval from core—
Gentoo2024-04Council banned AI-assisted contributions (as relayed by Linuxiac)—
QEMUBanned 2025; relaxation proposed 2026-05-28Motivated by DCO/copyright; the proposal would allow tests, docs, mechanical refactors and bug fixes of ≤20 lines, with core code still needing explicit maintainer approval (under discussion)AI-used-for: (proposed)
OpenJDK2026-08 (interim)Bans code, text and images generated in part or in full by LLMs/diffusion models, across repos, PRs, email, wiki and JBS; private use to understand, debug and review is allowedCompliance checkbox on PRs (Skara, planned)
Zig2026-04“Zero tolerance” (mentioned in one line by The New Stack)—
Godot2026-07 (being revised)Bans autonomous agents and “vibe-coded” PRs; no substantial code may be AI-generated; narrow tasks (completion, regex, find-and-replace) allowed with disclosure; contributors with ≤3 merged PRs need sign-off before new features or big refactorsStated in the PR
Rust (rust-lang/rust)2026-08-05Fine to answer, analyse, distil, refine, check, suggest, review; not, in principle, to create; pre-arranged non-critical changes may be LLM-generated; LLM PRs must have tests; no generated soundness-critical changesMandatory; PR template will ask
Linux kernelCurrent docsAI must not add Signed-off-by; a human reviews everything, confirms GPL-2.0 compatibility and takes full responsibility; an AI that finds a bug must not send the report itselfAssisted-by:
Fedora2025-10AI assistance allowed; the contributor is the true author and fully accountable; reviewers may use AI but a human makes the final call; AI features in products must be opt-inAssisted-by: encouraged
DebianVote Aug 15–28, 2026 (after this article’s date)Winning option “Responsible Use of Generative AI”: neither banned nor endorsed; review, test and correct; no non-public information to third-party AI; mass changes discussed in advanceEncouraged, not required
注意时间:Debian 的投票结果(8-28)晚于本文日期 8-08,放在这里是为了让光谱完整,当时它仍在筹备投票。QEMU 的放宽提案在本文检索到的报道中仍处于讨论阶段。
Mind the dates: Debian’s result (Aug 28) came after this article’s date of Aug 8; it is included to complete the spectrum, and at the time the vote was still being prepared. QEMU’s relaxation proposal was still under discussion in the coverage found.

5两种思路的细节:OpenJDK 对 Rust

5Two approaches in detail: OpenJDK vs Rust

OpenJDK:按“内容来源”一刀切。据 Developers Digest 对其 FAQ 的整理:100 行 AI 代码里手工改了 10 行,结果“仍然部分包含 AI 生成的代码”,照样不收;IDE 里的拼写/语法检查、自动补全、重构工具可以用,但前提是它们不基于 LLM——也就是说,基于模型的自动补全在写贡献代码时要关掉。执行上计划在 Skara 的每个 PR 里加一个确认勾选。FAQ 也承认“可靠地区分人写与 AI 写是不可能的”,列出的线索全是行为特征:提交里有给工具记功的 Co-Authored-By、与作者以往风格不符的啰嗦、过度结构化的注释、防御式代码、表情符号。

OpenJDK: a blanket rule based on where the content came from. Per Developers Digest’s reading of its FAQ, if you hand-edit 10 of 100 AI-generated lines the result “would still include, in part, AI-generated code” and is still barred. Spell-checking, grammar checking, auto-completion and refactoring in the IDE are allowed only if they are not based on LLMs, so model-powered autocomplete must be off when writing contributed code. A compliance checkbox on every PR is planned via Skara tooling. The FAQ concedes that “reliably distinguishing human-generated content from AI-generated content is impossible”; its listed signals are all behavioural: a Co-Authored-By trailer crediting a tool, verbosity unlike the author’s past work, over-structured comments, defensive code, emoji.

Rust:按“用途 + 风险”分层。可以用 LLM 帮你理解、检查、审阅,但不应让它“创作”;例外是事先约定、非关键、高质量、测试充分、审阅充分的改动。机器翻译、“小改动”、用 LLM 发现的 bug、用 LLM 做的审阅,同样都要披露。审阅者可以“不问理由”关闭不合规 PR,并引导作者去 Zulip 的 #llm-mentoring 频道;审阅者不负责判断代码是否由 LLM 生成,拿不准就私下报告给管理团队,而不是公开指责——“风格不是证据”。

Rust: layered by use and risk. You may use LLMs to understand, check and review, but not to “create”; the exception is pre-arranged, non-critical, high-quality, well-tested, well-reviewed changes. Machine translation, “trivial” changes, bugs found with an LLM and reviews done with an LLM must all be disclosed. Reviewers may close non-compliant PRs “no questions asked” and point authors to the #llm-mentoring Zulip channel; reviewers are not responsible for deciding whether code is LLM-generated, and if unsure they report privately to moderation rather than accuse anyone — “style is not evidence.”

共同点比差异更重要:两者都允许私下用 AI 理解和审阅代码;都把“隐瞒 AI 参与”视为违规;都不靠检测器执法,而是一份社会契约——HN 讨论的主流看法正是如此。区别只在于“生成的内容能不能进仓库”。
The overlap matters more than the difference: both allow private use of AI to understand and review code; both treat hiding AI involvement as a violation; neither relies on a detector — each is a social contract, which is also the prevailing view in the HN discussion. They differ only on whether generated content may enter the repository.

6怎么做:给编码 agent 用户的实操清单

6What to do: a checklist for coding-agent users

准备提交一个 AI 参与过的改动先查项目政策:CONTRIBUTING / AI 政策 / PR 模板禁止生成AI 只用于理解、调试、审阅提交的内容自己写OpenJDK · Godot · QEMU 核心允许但须披露加 trailer + 自己审阅LLM PR 必带测试Rust · Linux 内核 · Fedora没有明确政策默认披露,先问维护者小步提交,别批量刷 PR保守优于事后被关无论哪条:人对每一行负责;AI 不能代签 DCO(Signed-off-by)不要把审阅意见粘进 LLM 再把回复贴回去(Rust 政策明确禁止)作者据各项目政策归纳的示意流程,不是任何项目的官方流程
图 2 · 提交 AI 参与改动前的决策流程(作者据各项目政策归纳)
About to submit an AI-assisted changeCheck the policy first: CONTRIBUTING / AI policy / PR templateGeneration bannedAI only to read/debug/reviewWrite the submission yourselfOpenJDK · Godot · QEMU coreAllowed with disclosureAdd a trailer; self-reviewLLM PRs must have testsRust · Linux kernel · FedoraNo explicit policyDisclose by default; ask firstSmall PRs, no bulk drive-bysCaution beats being closedEither way: a human owns every line; AI cannot sign the DCO (Signed-off-by)Do not paste review comments into an LLM and post its reply back (Rust bans this)The author’s sketch from the policies, not any project’s official flow
Figure 2 · Decision flow before submitting an AI-assisted change (author’s summary of the policies)

以下为作者据上述政策给出的做法建议,不代表任何项目的官方要求:

The following are the author’s recommendations derived from these policies, not any project’s official requirements:

  1. 先读政策再动手:看 CONTRIBUTING、项目的 AI 政策页与 PR 模板。可以把“遇到外部项目先查 AI 政策”写进你的 CLAUDE.md,让 agent 也遵守。
  2. 让提交尾注说真话:很多编码 agent 默认给提交加 Co-Authored-By,这恰好是 OpenJDK FAQ 列出的线索之一。不要为了“过关”删掉它去提交禁止 AI 的项目——那是隐瞒;正确做法是不在这类项目提交 AI 生成内容。对要求 Assisted-by 的项目,把尾注改成项目要求的格式。
  3. Signed-off-by 必须由你本人加:读懂每一行,确认许可证兼容,再签。
  4. LLM 写的改动自带测试:Rust 是硬性要求,其他项目也能显著降低审阅成本。
  5. 不要外包对话:不要把审阅意见粘进 LLM 再把回复贴回去(Rust 明确禁止);Godot 也禁止在与维护者的讨论中使用 AI 生成文本(人写内容的机器翻译除外)。
  1. Read the policy before you start: check CONTRIBUTING, the project’s AI policy page and the PR template. You can add “check the AI policy before contributing to an external project” to your CLAUDE.md so the agent follows it too.
  2. Keep trailers honest: many coding agents add Co-Authored-By to commits by default, which is one of the signals in OpenJDK’s FAQ. Do not strip it to slip past a project that bans AI — that is concealment; the right move is not to submit AI-generated content there. For projects that want Assisted-by, switch the trailer to their format.
  3. Add Signed-off-by yourself: understand every line and confirm licence compatibility before you sign.
  4. Ship tests with LLM-written changes: mandatory in Rust, and a big reduction in review cost anywhere else.
  5. Don’t outsource the conversation: never paste review comments into an LLM and post its answer back (Rust bans this); Godot also bans AI-generated text in discussions with maintainers (machine translation of human text excepted).

示例:按项目调整 Claude Code 的提交署名。据 Classmethod(2026-09-22,v2.1.267 实测)对官方设置文档的整理,attribution.commit / attribution.pr 接受字符串,可改成项目要求的尾注;放在该项目的 .claude/settings.local.json 里只影响这个仓库。注意:该写法来自晚于本文日期的文档,请以你所用版本的设置参考为准。

Example: adjust Claude Code’s commit attribution per project. According to Classmethod’s write-up of the official settings docs (2026-09-22, tested on v2.1.267), attribution.commit / attribution.pr take strings, so you can switch to the trailer a project wants; putting it in that project’s .claude/settings.local.json affects only that repository. Note this comes from documentation later than this article’s date, so check the settings reference for your version.

// 内核类项目:<repo>/.claude/settings.local.json
{
  "attribution": {
    "commit": "Assisted-by: LLM sparse",
    "pr": ""
  }
}

# 提交时由你本人签名(DCO)
git commit -s -m "fix: ..."
// Kernel-style project: <repo>/.claude/settings.local.json
{
  "attribution": {
    "commit": "Assisted-by: LLM sparse",
    "pr": ""
  }
}

# Sign the DCO yourself when committing
git commit -s -m "fix: ..."

Linux 内核文档给出的格式是 Assisted-by: LLM [TOOL1] [TOOL2],方括号里只写 coccinelle、sparse、smatch、clang-tidy 这类专门分析工具,不写 git、gcc、编辑器等常规工具(以检索时的现行文档为准)。

The Linux kernel docs give the format Assisted-by: LLM [TOOL1] [TOOL2], where the brackets list only specialised analysis tools such as coccinelle, sparse, smatch or clang-tidy, not routine tools like git, gcc or editors (per the current docs at research time).

7坑与争议

7Pitfalls and controversies

执法几乎不可能靠技术:OpenJDK FAQ 自己承认无法可靠区分;NetBSD 2024 年的报道同样指出无法证明代码由人还是 AI 写成。因此这些政策本质是“设定预期 + 把隐瞒定性为违规”。对贡献者而言,风险不在被检测出来,而在失去信任。
Technical enforcement is close to impossible: OpenJDK’s FAQ admits it cannot reliably tell the difference, and 2024 coverage of NetBSD said the same. These policies therefore set expectations and make concealment the violation. For contributors the risk is not detection but lost trust.
“双重标准”的批评:The Register 与 Techzine 都指出,Oracle 高层公开说自家代码大量由 AI 编写,却在 OpenJDK 禁止 AI 贡献;The Register 称已向 Oracle 询问内部如何保障 AI 代码安全,截至报道未获回复。Developers Digest 的解读是:内部代码由领薪员工审阅,社区贡献者没有雇佣与问责链。这是评论观点,不是 Oracle 的官方解释。
The “double standard” critique: The Register and Techzine both note that Oracle’s leadership says much of its own code is AI-written while OpenJDK bans AI contributions; The Register says it asked Oracle how it makes internal AI code safe and had no answer at publication. Developers Digest’s reading is that internal code is reviewed by paid employees whereas community contributors have no employment or accountability chain. That is commentary, not Oracle’s official explanation.
Rust 内部也无共识:政策作者明言“这不是对 LLM 的官方立场”,只适用于 rust-lang/rust 仓库,项目内部“没有共识”;领导委员会在考虑设一个专门处理 LLM 政策的子团队,并刻意让政策“比采纳时更容易修改”。
No consensus inside Rust either: the author says plainly that it is “not an official stance on LLMs,” applies only to the rust-lang/rust repository, and that “there is not a consensus within the Rust project”; the leadership council is considering a sub-team for LLM policy, and the policy is deliberately easier to change than it was to adopt.
常见误解:“禁止 AI”不等于“禁止用 AI 学习代码”。OpenJDK、Rust、Godot 都允许你用 AI 理解代码、调试、做私下审阅;被限制的是把生成内容提交进去,以及用生成文本替代你和维护者的对话。
A common misreading: “banning AI” does not mean banning AI for learning the code. OpenJDK, Rust and Godot all let you use AI to understand code, debug and review privately; what is restricted is submitting generated content and replacing your own conversation with maintainers with generated text.

8资源与来源

8Resources and sources