跳到主内容
精选85GitHub 博客(RSS)技巧与观点

AutoGPT 如何管理 AI 生成的 PR:从拒绝到引导

Your contributors are AI-first now. Is your project?

原文
推荐理由

维护开源项目的同学必看,AutoGPT 这套应对 AI 生成 PR 的门禁和技巧非常实用,照着做能大幅减少审查负担,赶紧去调整你的仓库配置。

The same question keeps coming up in maintainer conversations: what do you do when the pull request queue fills with work written by agents?

维护者对话中反复出现同一个问题:当拉取请求队列里堆满了由代理编写的工作时,你该怎么办?

It’s something Nicholas Tindle, founding AI engineer at AutoGPT, also deals with every day. I spoke with him in May for Maintainer Month. At the time of the interview, AutoGPT had over 180,000 stars and around 150 open pull requests. A big chunk of those pull requests were written by agents, including Copilot, OpenClaw, and AutoGPT’s own internal tooling, among others. Most maintainers I talk to have the same reaction: close the door. Turn off pull requests. Don’t tax the team with reviewing slop.

这也是 AutoGPT 的创始 AI 工程师 Nicholas Tindle 每天都要面对的事情。我在五月份的维护者月期间与他进行了交谈。在采访之时,AutoGPT 拥有超过 18 万颗星和大约 150 个开放的拉取请求。其中很大一部分拉取请求是由代理编写的,包括 Copilot、OpenClaw 以及 AutoGPT 自己的内部工具等。我交谈过的大多数维护者都有同样的反应:关门。关闭拉取请求。不要让团队审查垃圾内容。

Nicholas saw an upside:

Nicholas 看到了好的一面:

It’s basically somebody else paying for your compute.

这基本上就是别人在为你支付计算费用。

Nicholas Tindle, founding AI engineer at AutoGPT

Nicholas Tindle,AutoGPT 创始 AI 工程师

The way he sees it, if a contributor wants to spend their tokens improving your project, let them. Just make it so the only way through the door is the way that works for you.

在他看来,如果贡献者想花他们的令牌来改进你的项目,那就让他们花吧。只要确保唯一能进门的方式是对你有效的方式。

Your docs aren’t the problem. Discovery is.

你的文档不是问题所在。发现才是。

AutoGPT tried the obvious thing first. Better contributor guidelines. Better docs. A whole wiki dedicated to working with the repo.

AutoGPT 首先尝试了显而易见的方法。更好的贡献者指南。更好的文档。一个专门用于与仓库协作的完整 wiki。

None of it moved the needle. It turns out the tools aren’t going to go read your docs unless they’re told to. That’s the part a lot of us get wrong. We treat documentation like the agent will go find it. It won’t. Agents read what’s in front of them, at the level of the directory they’re working in.

这些都没有起到作用。事实证明,除非被明确告知,否则这些工具不会去阅读你的文档。这是我们很多人都会犯的错误。我们把文档当作代理会主动去找它。它不会。代理只会阅读它们面前的内容,即它们工作目录层级的内容。

So AutoGPT started putting instructions where agents look. First CLAUDE.md files, because laude was generating pull requests without enough repository-specific context. The commit trailer made each one easy to spot, because they announced themselves in the commit trailer. Then they hit the next wall: Copilot and Codex ignore Claude files, because they’re not Claude. So they centralized the standard AGENTS.md and pointed Claude files at it.

所以 AutoGPT 开始把指令放在代理会看的地方。首先是 CLAUDE.md 文件,因为 Claude 在生成拉取请求时没有足够的仓库特定上下文。提交尾注让每个请求都容易被识别,因为它们会在提交尾注中自我声明。然后他们遇到了下一堵墙:Copilot 和 Codex 会忽略 Claude 文件,因为它们不是 Claude。所以他们集中了标准的 AGENTS.md,并让 Claude 文件指向它。

Here’s the nuance I found most useful. AGENTS.md is scoped to a directory. A skill can be discovered outside that directory. (If you haven’t shipped one: a skill is an instruction file with a description that tells the agent when to load it. The agent scans descriptions up front and pulls in the full instructions when the task matches.)

这里有一个我觉得最有用的细微差别。AGENTS.md 的作用范围限定在某个目录内。而技能可以在该目录之外被发现。(如果你还没有发布过技能:技能是一个指令文件,带有一个描述,告诉代理何时加载它。代理会预先扫描描述,并在任务匹配时拉取完整的指令。)

AutoGPT’s AGENTS.md sits beside the code it governs. That placement matters as much as the instructions themselves.

AutoGPT 的 AGENTS.md 位于它所管理的代码旁边。这个位置和指令本身一样重要。

If you’re writing backend tests and you think about doing front-end stuff, a skill may load dynamically. It’s not going to know what directory to go look in for an AGENTS.md file, but the skill can tell it that.

如果你在编写后端测试时考虑做前端的事情,技能可能会动态加载。它不会知道去哪个目录查找AGENTS.md文件,但技能可以告诉它。

Their front-end engineer got tired of the same class of broken pull request, so they wrote a guide, and shipped it as a skill in the repo. The description contained trigger phrasing: write a Storybook test if your component lives in these folders. Now every harness that touches the repo discovers it automatically. The backend enforces its own version of the rule the same way: hit 80% coverage or don’t open the pull request.

他们的前端工程师厌倦了同一类损坏的拉取请求,所以他们编写了一份指南,并将其作为技能发布在仓库中。描述中包含触发短语:如果你的组件位于这些文件夹中,请编写Storybook测试。现在,每个接触该仓库的工具都会自动发现它。后端以同样的方式强制执行自己的规则:达到80%的覆盖率,否则不要打开拉取请求。

Gates that actually work

真正有效的门禁

These are the gates you can adapt for your project.

这些是你可以为项目调整的门禁。

Enforce the pull request template, loudly. AutoGPT tells agents that pull requests not matching the template get closed automatically with zero hesitation. They built the tooling to actually do it, then found they didn’t need to run it. At AutoGPT, the rule changed agent behavior before the automation ever ran. The agents followed the template. Human contributors sometimes needed more room, which Nicholas treats as a feature:

大声执行拉取请求模板。AutoGPT告诉代理,不符合模板的拉取请求会被自动关闭,毫不犹豫。他们构建了实际执行此操作的工具,然后发现他们不需要运行它。在AutoGPT,规则在自动化运行之前就改变了代理的行为。代理遵循了模板。人类贡献者有时需要更多空间,Nicholas将此视为一个特性:

If you don’t follow the template, I know you’re probably a person, and I’m going to be kinder.

如果你不遵循模板,我知道你可能是一个人,我会更友善。

The test plan trick. The template requires a test plan, and its wording casually mentions testing the pull request. That phrase triggers a skill called test PR, which installs agent browser (with permission), spins up the app, and executes the change. The agent set out to fill in a checkbox and ended up running the code.

测试计划技巧。模板要求提供测试计划,其措辞随意提到测试拉取请求。该短语触发一个名为test PR的技能,该技能安装代理浏览器(经许可),启动应用程序,并执行更改。代理本意是填写复选框,结果却运行了代码。

They almost never get pull requests that don’t work anymore. What they get now is pull requests that work but don’t fit the roadmap, which is a much better problem to have.

他们几乎再也收不到无法工作的拉取请求了。他们现在收到的是能工作但不符合路线图的拉取请求,这是一个更好的问题。

Make CI a wall, not a suggestion. Codecov coverage thresholds are required checks. The agent opens the pull request, checks back a few minutes later, sees it can’t merge, loads the testing skill, and writes the tests. Nobody had to ask.

让CI成为一堵墙,而不是一个建议。Codecov覆盖率阈值是必需的检查。代理打开拉取请求,几分钟后回来查看,发现无法合并,加载测试技能,并编写测试。没有人需要要求。

Use the CLA as a human detector. AutoGPT is dual licensed, but Nicholas argues every project should do this, MIT included. Signing requires a browser and a GitHub OAuth flow on a separate domain. Agents are bad at that today, and for good reason: most maintainers do not want an agent logged into GitHub in a browser with broad account access.

使用CLA作为人类检测器。AutoGPT是双重许可的,但Nicholas认为每个项目都应该这样做,包括MIT。签署需要浏览器和GitHub OAuth流程,在单独的域上进行。代理目前不擅长这一点,这是有充分理由的:大多数维护者不希望代理在浏览器中登录GitHub并拥有广泛的账户访问权限。

If your CLA is not signed after a week, we close the pull request with a comment that says sign the CLA, reopen when you’re done.

如果一周后CLA未签署,我们会关闭拉取请求,并附上评论:签署CLA,完成后重新打开。

That gate works because it puts a human back in the loop. A CLA is one option. A code-of-conduct checkbox can do the same job.

那个门禁之所以有效,是因为它把人类重新放回了循环中。CLA 是一种选择。行为准则复选框也能起到同样的作用。

Require a commit SHA before resolving a review thread. Some agents mark every review thread as resolved without touching the code. AutoGPT’s fix is a pr-address skill in the repo that declares the only valid sequence: fix, commit, push, reply, then resolve. The reply has to link the fixing commit, with the full SHA pulled from git rev-parse HEAD after committing, so the agent can’t recycle an old one. The skill even names the anti-patterns: “Acknowledged” is not a fix, and neither is citing a commit that doesn’t touch the flagged line.

在解决审查线程之前要求提供提交 SHA。有些代理会在不碰代码的情况下将每个审查线程标记为已解决。AutoGPT 的解决方案是仓库中的一个 pr-address 技能,它声明了唯一有效的顺序:修复、提交、推送、回复,然后解决。回复必须链接到修复提交,并在提交后从 git rev-parse HEAD 获取完整的 SHA,这样代理就不能重复使用旧的。该技能甚至指出了反模式:“已确认”不是修复,引用一个不触及标记行的提交也不是。

The gate they turned off

他们关闭的门禁

When a check fails, AutoGPT had an agent read the run and comment on what broke. Their first version wired Claude Code into GitHub Actions and authenticated it inside the workflow, which meant one more broad credential living in CI. Running Copilot in the workflow gets the same result without that. Nicholas is a fan:

当检查失败时,AutoGPT 会让一个代理读取运行日志并评论出了什么问题。他们的第一个版本将 Claude Code 接入 GitHub Actions,并在工作流内进行身份验证,这意味着在 CI 中多了一个宽泛的凭据。在工作流中运行 Copilot 无需这些也能得到相同的结果。Nicholas 对此很赞赏:

It’s unbelievable. I’m so happy I never had to bother with YAML ever again. I’m never writing a workflow for an action ever.

这太不可思议了。我很高兴我再也不用为 YAML 操心了。我再也不会为 action 编写工作流了。

Then they turned the commenting off anyway. Their CI fails a lot, and a bot narrating every failure all day is not much better than the failure itself. The lesson is the restraint: keep what lowers the maintainer burden, shut off what becomes noise.

然后他们还是关闭了评论功能。他们的 CI 经常失败,一个机器人整天对每次失败进行解说,并不比失败本身好多少。教训在于克制:保留能降低维护者负担的东西,关掉那些变成噪音的东西。

Four gotchas worth writing down

四个值得记下的陷阱

A bad AGENTS.md file is worse than no AGENTS.md. AutoGPT littered them everywhere at first and ended up polluting context, pulling the agent’s attention toward files that didn’t matter. If behavior gets worse, go read what you wrote.

一个糟糕的 AGENTS.md 文件比没有 AGENTS.md 更糟糕。AutoGPT 起初到处放置这些文件,最终污染了上下文,把代理的注意力引向了不重要的文件。如果行为变差,去读读你写的东西。

The GraphQL API will rate limit you. When every tool on your team hits the CLI as an individual user, you hit the ceiling fast. Create a GitHub App and authenticate the CLI through it.

GraphQL API 会限制你的速率。当你团队中的每个工具都以个人用户身份访问 CLI 时,你会很快达到上限。创建一个 GitHub App,并通过它来认证 CLI。

The heavy review tooling costs real money. Their pull request test rig clones the branch, spawns eight agents with different jobs, runs the whole stack, and uploads screenshots. It’s great. It’s also expensive enough that they now run it only on very small or very large pull requests.

重型审查工具花费真金白银。他们的拉取请求测试装置会克隆分支,生成八个具有不同任务的代理,运行整个技术栈,并上传截图。这很棒,但也足够昂贵,以至于他们现在只对非常小或非常大的拉取请求运行它。

Go audit your authorized apps. AutoGPT is part of the Secure Open Source Fund, and this was one of Nicholas’s takeaways from that work. Every tool they trialed and dropped left an authorization behind.

去审计你授权的应用。AutoGPT 是 Secure Open Source Fund 的一部分,这是 Nicholas 从那次工作中得到的收获之一。他们试用并放弃的每个工具都留下了一个授权。

If you stop using a GitHub app, remove it from the authorized apps. Do a little audit right now after this stream and go see what you have. You’ll be surprised.

如果你停止使用一个 GitHub 应用,请将其从授权应用中移除。在本次直播之后,立即做一个小审计,去看看你有哪些授权。你会感到惊讶的。

Logging in with GitHub is so automatic at this point that most of us have never gone back to look. I opened my settings during the stream. He was right.

在这一点上,使用 GitHub 登录已经非常自动化,以至于我们大多数人从未回头看过。我在直播期间打开了我的设置。他说得对。

Not everything is a gate

并非一切都是门禁

Two takeaways from Nicholas had almost nothing to do with tooling.

从 Nicholas 那里得到的两个要点几乎与工具无关。

First: you don’t have to accept every pull request. Merging someone else’s LLM output is asymmetric. You do the upkeep, forever. Closing the pull request and building the fix yourself is a legitimate choice.

第一:你不必接受每一个拉取请求。合并别人的 LLM 输出是不对称的。你永远要做维护工作。关闭拉取请求并自己构建修复是一个合理的选择。

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →

相似阅读

另一事件,读法相近