推荐微信扫码登录以获得更好的体验!另:🎉建议更新到最新版,以体验新功能!🎉 版本更新记录→

Meta资深工程师教你如何审查AI代码

Meta资深工程师教你如何审查AI代码

Meta资深工程师教你如何审查AI代码

发布于 2026-11-04 · 时长 20:31

字幕摘录

时间英文中文
0:00Well, hello there.嗯,你好吗?
0:01So are you even reading your code these days, or do you just send it off and所以,你甚至读 你的代码这些天, 或者你只是发送它关闭
0:05just let your vibe coded AI slop code just into the wild without any review?就让你的氛围 编码AI的破解码 刚刚进入野外,没有任何审查?
0:10Or are you still in the camp of reading all your code?还是你还在营地里读你的代码?
0:13In my opinion, this topic of code review is very split right now.我认为,这个代码审查的话题 现在非常分裂。
0:18The community is very split.社区非常分裂.
0:20There's a group of people who say if you're reading your code still,有人说如果你还在读密码
0:23then you're not moving fast enough.那你动作不够快
0:25The agents are probably already better at reviewing code than you are.特工可能已经比你更擅长审查密码了
0:29So why are you reading your code?那你为什么读你的代码?
展开字幕全文(375 条)
序号英文中文
1Well, hello there.嗯,你好吗?
2So are you even reading your code these days, or do you just send it off and所以,你甚至读 你的代码这些天, 或者你只是发送它关闭
3just let your vibe coded AI slop code just into the wild without any review?就让你的氛围 编码AI的破解码 刚刚进入野外,没有任何审查?
4Or are you still in the camp of reading all your code?还是你还在营地里读你的代码?
5In my opinion, this topic of code review is very split right now.我认为,这个代码审查的话题 现在非常分裂。
6The community is very split.社区非常分裂.
7There's a group of people who say if you're reading your code still,有人说如果你还在读密码
8then you're not moving fast enough.那你动作不够快
9The agents are probably already better at reviewing code than you are.特工可能已经比你更擅长审查密码了
10So why are you reading your code?那你为什么读你的代码?
11You know, there's that camp.你知道,那里有营地。
12The other camp is people who are saying, no, the AI agents are still not great yet.另一个阵营是那些说,不,AI特工还不算大的人.
13It's not perfect.亦不圆满.
14It makes dumb mistakes and you're creating a lot of AI slop and you really它犯了愚蠢的错误 而你制造了很多AI sloop 你真的
15need to tone it down and review the stuff that you're writing.需要调低音调 并审查你正在写的东西。
16So there's these two camps.故有此二营.
17And in this video, we're going to talk about what I think of this topic.在这个视频中,我们将谈谈我对这个话题的看法。
18And I'm also going to give you my strategies on how I navigate and review我也会给你我的策略 关于我如何导航和审查
19my own code and land high quality code into the production.我自己的代码 和土地 高质量代码进入生产。
20So yeah, that's what we'll cover in this video today.所以是的,这就是我们今天在视频中要覆盖的内容。
21So if you're new to this channel, my name is John.如果你是新来这个频道的 我叫约翰
22I'm a senior staff software engineer at Meta.我是Meta的高级员工软件工程师
23And on this channel, I talk about AI tech news, AI tech tutorials,在这个频道,我谈论AI技术新闻,AI技术辅导,
24anything to do with AI is my fun side hobby to dig into all of this.和人工智能有关的一切 都是我探索这一切的乐趣爱好
25But yeah, a lot of you guys are not subscribed.但是你们很多人都不认购
26You guys watch a lot of my videos, but for some reason don't subscribe.你们看了很多我的视频, 但出于某种原因,不订阅。
27So do a brother a favor and subscribe.做一个兄弟的忙 并订阅。
28I get a ton of like tokens if people subscribe.如果别人认购,我就会得到一吨象徵物
29I don't actually, but please subscribe.我其实没有,但请订阅。
30So let's get right into this video.让我们直接进入这个视频。
31So as usual, I made some slides, just some simple slides to have和往常一样 我做了一些幻灯片 只是一些简单的幻灯片
32some talking points over all of this.一些谈话要点 关于这一切。
33And for this video, I also created just a simple website that like you can对于这段视频,我还创建了一个简单的网站,像你这样
34swipe essentially to vote whether something is AI or not, and they will偷窥主要是投票 东西是不是AI, 他们会
35tell you like if it's AI or not, it's just a simple demo app and it's really告诉你,如果它是AI或不是, 它只是一个简单的演示应用 它真的
36there so I could showcase some of the tools and like things that I'm thinking这样我就可以展示一些工具 和我想的东西
37about for the video.关于视频。
38So let's start off with the obvious.因此,让我们从明显的开始。
39I think we can all safely say with the advent of AI coding, the amount of code我想我们可以安全地说,随着AI编码的出现, 代码的数量
40that people are generating is going through the roof.人们正在产生 正在进入屋顶。
41It's like so much more code.这就像更多的代码。
42People are writing a lot more features.人们正在写更多的特征。
43They're writing more tests.他们正在写更多的测试。
44They're just doing a lot more because one person can split up multiple他们只是做了更多 因为一个人可以分开多个
45agents and generate a ton of code.代理和生成一吨代码。
46And to be honest, it's almost impossible of a task for a single engineer to老实说,一个工程师几乎不可能完成
47review even their own code, let alone do code reviews for other people.更别提为其他人做代码审查了
48So where do I stand right now personally for code reviews?我个人的代码审查站在哪?
49And the answer is it depends.答案是要看情况
50I think like any good answer to any hard problem answer is really it depends我认为,像任何好的答案 任何困难的答案是 它真的取决于
51because the reality of code reviews is a gradient.因为代码审查的现实是一个梯度.
52It really depends on the code that you're reviewing.这真的取决于你正在审查的代码。
53So when you're writing code and when you're building a feature, the AI所以,当你写代码 当你建立一个功能,AI
54agents should be part of the entire code's journey to production from planning,特工应该成为整个代码 从计划到生产的过程的一部分,
55building, reviewing, and launching every single part of this.建造、审查和推出其中的每一部分。
56You should actually include your AI agents throughout the whole process, right?整个过程你都应该包括你的人工智能特工 对吧?
57Whether it's planning out a spec to build out, making sure things are a feature是否计划建立一个小区 确保事情成为特色
58complete and making sure you have like evaluations and like validation criteria完成和确保你有 喜欢的评价和像验证标准
59is that you're thinking about ahead of time.你是在提前考虑
60And when you're building the code, you want to have agentic validation so that当你建立代码时,你想有代理验证 这样,
61the AI can self validate and self fix itself and then get the code right a lot人工智能可以自我验证和自我修复 然后经常修正代码
62more often.更常见.
63And then we have the review, which is like what we're talking about然后我们有评论, 这就像我们所说的
64today.今时.
65And we're going to talk about some strategies on how you should do this.我们来谈谈你应该怎么做的策略。
66And then when you're launching, I think this also should be part of it.然后当你发射的时候, 我认为这也应该是其中的一部分。
67You want to feature gate and run experiments on your code and all of these您想要设置门 并运行实验 您的代码和所有这些
68things, I think, tied together to answer the question when and how much should事情,我认为,捆绑在一起, 回答一个问题,什么时候,应该多少
69you review a code?你审查一个代码?
70So it really depends, right?所以这真的取决于,对不对?
71Now, the big concept that I want to let you guys know about today is that I think我想让你们知道今天的大概念是
72of the code base like a tree and like a tree, there are different parts of the代码基像树 和树一样, 有不同的部分
73tree that is more important.这棵树更重要
74So think of like kind of the trunk, the root, the main part of the code.想想树干 根 密码的主要部分
75That's like your main entry points, like your app dot JS that has all of the这就像你的主要切入点, 就像你的应用点 JS 拥有所有
76different helpers that are like added to it.各种援助者,犹如加在其中一样。
77And then your infrastructure code, like image processing, networking, and all然后,你的基础设施代码, 像图像处理,联网,和所有
78these things that if something goes wrong in that code base, it can affect the这些东西,如果事情出错 在代码基础, 它可能影响
79entire app.整个应用程序。
80I think of that as like a trunk piece of code.我觉得这就像一个后备密码
81And then there's like leaf notes and we're going to get into more of this topic然后有像叶子笔记, 我们要进入更多的这个话题
82throughout this video, but start thinking about your code base as a trunk.整个视频,但开始思考 你的密码基础作为一个后备箱。
83And as soon as you start thinking about this, then the obvious next thing that you一旦你开始想这个, 那么很明显的下一个事情,你
84naturally think about is that the review depth, the depth that your own effort自然而然的思考是,审查的深度, 你自己的努力的深度
85level on reviewing a certain code, it should really be based on like the blast关卡审查某个代码, 它真的应该基于 像爆炸
86radius of that code change.代码的半径改变。
87As an example, if you're touching something that's like core image rendering举个例子,如果你碰的东西 像核心图像渲染
88infrastructure that touches all the different image renderings, and there's a基础设施可以触及所有不同的图像渲染,
89lot of downstream dependencies, then I will spend a lot of time reading that很多下游的依赖, 然后我会花很多时间阅读
90piece of code, for example.比如说,一个代码。
91And then for any like one-off leaf node code, you could probably just have agents然后,任何像一次性叶节点代码, 你可能只是有代理人
92do simple validations like component testing or snapshot testing and just进行简单的验证,如组件测试或快照测试,以及公正
93visually validate the PR as long as they have proof in the PR.只要他们在公关里有证据 就可以通过视觉验证公关
94So this concept of like changing your effort level, depending on the importance因此,这个概念 就像改变你的努力水平, 根据重要性
95of the code, I think really matters a lot.代码,我认为真的很重要。
96And you should actually do this planning from the beginning.你从一开始就应该做这个计划。
97So when you're planning the entire feature, you actually want to feature gate it.所以当你计划整个功能时, 你其实想要设置门。
98Now, if you don't know what feature gating is, is essentially adding a branching现在,如果你不知道什么是吉丁, 本质上是增加分支
99logic in your code base where you can say, Hey, this feature is on or off.密码底部的逻辑,你可以说,嘿,这个功能是打开或关闭的。
100So there's a concept called feature toggling, a really popular option.因此,有一个概念叫做特征的移动, 一个非常受欢迎的选择。
101It's called launch starkly.这被称为"严酷发射".
102And you can have feature gating.你可以有特色的标语。
103There's a lot of actually infrastructure that you need to do feature gating有很多基础设施,你需要做 特色吉他
104properly, but you can start out really simple by just adding a说得好,不过你只要加个
105Boolean flag in your code base.密码底部的布尔旗
106It's a gating code and you just turn things on and off.那是个标语码 你打开和关闭它
107So from the beginning, if you're planning a new feature, think in broad strokes因此,从一开始,如果你计划一个新的特征, 思考在大字
108and gate all of the things out and then think a lot about the integration pieces.然后把所有的东西都打开 然后想了很多关于整合的部分。
109So you want to separate out leaf nodes, things that doesn't touch any of the所以,你想分离 叶节点,的东西 不触及任何
110existing code bases, and then you want to think about integration separately.已存在的代码基础,然后您想要单独考虑整合。
111You really want to like gate those integration layers.你真的喜欢把那些融合层的门打开。
112So once you have like a good solid plan and a good like roadmap and they have因此,一旦你有了一个很好的 坚实的计划和好的 像路线图,他们有
113like good feature gating, like ready to go, then you can start coding.喜欢好的特征 喜欢准备去, 然后你可以开始编码。
114And then this coding part is like, you know, just use agents to build the code out.然后这个编码部分就像,你知道的,只是使用代理来构建代码。
115And then you can just use the agents to like, you know, make atomic changes.然后,你可以只是使用 剂喜欢,你知道, 做原子变化。
116I have a ton of videos around using agents to code, but you know, we're not我有一大堆视频 使用代理密码,但你知道,我们不是
117covering that particular topic, but once you're ready for PR, what should但一旦你准备好公关,什么应该
118go in that PR?去公关?
119So let's think about that.因此,让我们考虑一下。
120So in my opinion, for your diffs to be really like solid, your PRs to be like所以,在我看来,你的 diffs 真的像固体, 你的公关像
121rock solid, you really want to anchor and push your agents to give you proof.坚固的岩石,你真的想 锁定和推动你的代理人给你的证据。
122And there's many different types of proof that the agents could give you.特工可以给你很多不同类型的证据
123There can be just straight up unit tests.可以直接进行测试
124So as an example, something like this, it's just a straight up unit test, very举个例子,像这样的, 这只是一个直升单元测试,非常
125simple, a lot of tests, and this is like just reading the test names and just简单,很多测试, 这就像只是读 测试名称,只是
126giving the test and the asserts.给出测试和断言。
127You could quickly get some like good sense of, oh, there's like good你可以很快得到一些像 良好的感官,哦,有像好
128logic testing that's happening.逻辑测试正在发生
129One side note is you want to be careful here when the agents are writing tests,其中一个方面是 当特工们在写测试时 你要小心
130you should probably make your own skill around not writing useless tests.你应该让自己的技能 围绕不写无用的测试。
131That's like a little side tip.这就像一个小侧尖。
132And then you also want runtime evidence.然后,你还需要运行时间的证据。
133So let's say that you have a lot of like runtime logs.假设你有很多像运行时日志的。
134And I talk about this in my engine tech engineering video, where you want to我在引擎技术工程录影带里谈到这个,你想在这里
135anchor on giving more visibility and more eyes for the agents.坚持让更多人能见度和更多人能见度
136So you can have runtime evidence and then you can have visual evidence where因此,你可以有运行时间的证据, 然后,你可以有视觉证据在哪里
137maybe it's a screenshot.也许是截图
138And then I also ask the agents to give a confidence level on their code and然后我也要求特工们 对其密码给予信任
139their gating and like different parts of the code.和代码的不同部分
140So you really want to push your agents when you're ready to like push out a所以,你真的想推 你的特工 当你准备好喜欢推出一个
141PR on these kinds of things.公关关于这种事情。
142It's like, do you have evidence?就像 你有证据吗?
143Obviously you want to build these into your skills.很明显,你想要把这些建在你的技能。
144So let's take a look at like UI proof, right?所以让我们看看 像UI的证据,对不对?
145So one of the things I like to do every time I make changes with the AI, I所以我喜欢做一件事 每次我修改AI,我
146always ask it to have a video or a UI screenshot, right?总是要求它有 视频或UI截图,对不对?
147So for this one, this lets the player save a card, right?因此,对于这一个,让玩家保存一张牌,对不对?
148So you can see right here, there is a save button.所以,你可以看到在这里, 有一个保存按钮。
149So I can see that, oh, okay, this was saved.所以,我可以看到, 哦,好吧,这是保存。
150And here's some like simple code changes.这里有一些像简单的代码更改。
151And then it looks roughly right.然后它看起来大概是正确的。
152But the point is I see a visual proof.但重点是我看到了一个视觉证据。
153So immediately I'm a lot more believing of this AI's code output, right?所以,立即我更相信 这个AI的代码输出,对不对?
154So if you have the visual proof and if you know that it's safe,所以,如果你有视觉证据 如果你知道它是安全的,
155then it's a lot safe to land.那样就能安全着陆了
156So having proof and having more proof lets you move faster because you don't所以,有证据和更多的证据 让你移动得更快 因为你没有
157have to manually check these proofs.需要手动检查这些证明。
158And this is really around agentic validation.这其实是关于代理验证的。
159And I talk about that in my agentic engineering video, but agentic我在代理工程的视频里谈到了这一点 但代理
160validation is a core concept of being able to read less code.验证是能够读得更少代码的核心概念.
161Because if you have a lot of these proof upfront on the PR, then you因为如果你在公关前有很多这些证据 那你
162don't have to read as much code.不需要读那么多代码
163Now the next big concept, and this is kind of in the tree concept is leaf code.现在下一个大概念, 这是树的概念就是叶码。
164A leaf code is really code that is written in isolation, or it's completely叶码其实是单独写出来的, 或者是完全的
165gated off in a feature gate.门关在特色门。
166So this can mean like one-off components that you can just validate with like因此,这可能意味着像一次性组件 你可以只是验证 像
167a component test or a snapshot test, right?组件测试或快照测试,对不对?
168Or maybe it's new infrastructure, new logic, maybe a new endpoint that或者是新的基础设施 新的逻辑 也许是新的终点
169you're integrating with.你正在和他们融合
170And you could just validate that with, you know, unit tests or integration tests.你可以通过单位测试或整合测试来验证这一点。
171And as long as they're not integrated to the main production code base, you只要它们没有融入主生产代码基地 你
172could move really quickly.动作很快
173And then I'll cover later what you should be doing.然后,我以后会报道你应该做什么。
174So for me, when I'm reviewing leaf like code, I spend a lot less time.所以对我来说,当我像代码一样审查叶子时, 我花的时间要少得多。
175I'm almost just mainly skimming the code and making sure things are not like very我几乎只是 轻描淡写代码 确保事情不是非常
176off or like something is just obviously wrong.关闭或喜欢的东西 只是明显是错误的。
177And for example, what can be a trunk is like, you know, in the reducer, reducer举例来说,什么可以是一个树干 就像,你知道,在减速器,减速器
178has a lot of shared state.有很多共享状态。
179So let's say you change some behavior here in this like game action advance因此,让我们假设你改变一些行为 在这里像游戏动作推进
180cards, maybe there's like a new card type or something like that, and you're牌,也许有像 新牌类型什么的, 而你
181changing existing behavior.改变现有的行为。
182And if that behavior is not gated out, then I would spend a lot more time如果那样的话,我会花更多的时间
183reviewing it because that changes production, right?因为它改变了生产,对不对?
184And then this has trickle down effects and side effects and all these things然后,这有 滴滴的效果和副作用 和所有这些东西
185can really matter and affect production code, right?能够真正重要 并影响生产代码,对不对?
186So you're really anchoring on safety.所以,你真的 锚的安全。
187So we kind of covered like thinking about code as like this gradient and how you所以,我们有种覆盖 喜欢思考代码 像这个梯度和如何你
188should anchor on changing your effort level, right?应该坚持改变你的努力水平,对不对?
189And in my opinion, everything should be anchored on safety.我认为,一切应该建立在安全的基础上。
190What is the control experience that should not change?不应该改变的控制经验是什么?
191And if this change went wrong, how bad can it be?如果这个改变出了问题,会有多糟?
192And then can I roll this change back?然后,我可以滚回这个变化?
193And then that really just depends on future gaining, right?然后这真的取决于 未来获得,对不对?
194So if you can answer these questions, especially the last one, then you can如果你能回答这些问题,尤其是最后一个问题,那么你可以
195spend a lot less time reviewing each individual code.花更多的时间审查每个代码。
196Now, one other thing that is like not that important in my opinion, these days现在,还有一件事,我认为 不那么重要,这些天
197that is part of like usually reviews is like knits and like little like different这就像通常的审查 就像织物 和小像不同
198ways of writing.写作的方式。
199And I would just leverage like static checking here to be able to do a lot of我会像静态检查一样 来做很多
200that work.这工作。
201So like type checking, linting, and all those kinds of things.所以,像类型检查,林丁, 和所有这些事情。
202And agents are really good at doing stuff like this.特工们都擅长做这种事
203So we have a codex reviewer here and it's like seeing some linting issues.因此,我们有一个代码审查器在这里, 它就像看到一些闪烁的问题。
204So it's like saying we should fix it as an example.所以,这就像说 我们应该把它作为例子。
205And here's some like stylistic changes, right?这里有一些像 结构变化,对不对?
206So one big thing about code review is that I think the old days of like having所以,一个重要的事情 关于代码审查 我认为过去的日子 像有
207your knits and they're like, oh, the code should look this way.你的织布和它们一样, 哦,代码应该看起来这样。
208This is my favorite way of writing code.这是我最喜欢的写密码的方法
209I think that's kind of dead.我觉得这有点死。
210I think we write so much code and code is being a lot more fluid and refactors are我认为我们写这么多代码和代码 是更多的流体 和重构是
211happening a lot more often.经常发生
212And it's a lot easier to do, especially once like there's good validations for做起来容易很多, 特别是一旦有很好的验证
213the code that you want to refactor.您想要重构的代码 。
214I think these kinds of knits don't really belong in the conversation of code我觉得这些织物 不属于密码的话题
215reviews anymore.复议了。
216So going back to the original question is, do I read the code?回到原来的问题,我读过密码吗?
217The simple answer is yes.简单的答案是肯定的。
218I still read a lot of code.我仍然读了很多代码。
219I think I read more code than I did before, but I definitely have this like我想我读了比以前更多的代码, 但我肯定有这样的
220knob where I, I first asked myself, is this a core change, like a trunk change?我第一次问自己,这是核心变化吗?
221And is it touch?是触摸吗?
222It's like an infrared.如红外线.
223Does it have a lot of like dependencies?它有很多相似的依赖性?
224If so, I increase it.如果有的话,我就会增加
225And then I say, is it safe?然后我说,它安全吗?
226Is there gating?有吗?
227If something went wrong, like what can happen?如果出事了 会发生什么事?
228So all of these things really change how much I review the code, right?所以所有这些事情 真正改变 我审查代码,对不对?
229And then the more dangerous it is, the more I spend time.然后越危险,我就越花时间。
230More of that changes a one-way door.更多的情况改变了单向的大门。
231I spend more time reviewing, right?我花更多的时间审查,对不对?
232Now let's get kind of to the fun parts of like looking at how you can use agents现在让我们去玩玩吧 就像看你如何使用特工
233to kind of help you review your code.帮助你检讨你的代码
234Now, in my opinion, AI is really good at reviewing code already.现在,我认为,AI真的 擅长审查代码已经。
235I actually do think it's better than most humans.我确实认为它比大多数人类更好。
236The issue is a lot of people are doing it wrong.问题是很多人都做错了
237And in my opinion, there's a few things that you should really anchor on doing.在我看来,有些事情你应该坚持去做。
238One, you should have a really good review skill.第一,你应该有很好的审查技巧
239I think both clock code and Codex have really good built reviews.我认为时钟代码和Codex 都有很好的设计评论
240And then here is the review agent right here.然后这里是审查代理 就在这里。
241And then for clock code, it's slash code review.而对于时钟代码,则是斜线代码审查.
242So these are all both really good review agents in my opinion.在我看来,他们都是很好的审查人员。
243But one thing that's kind of important to do is to use a new sub agent or a但有一点很重要的 就是使用一个新的子代理
244different agent, an agent that doesn't have the context of the code that it was不同的特工,一个没有 代码背景的特工,它是
245used to create the code because the agents will cheat, you know, the, all the用来创建代码 因为特工会欺骗,你知道,所有
246context that you gave it, it will cheat.你给它的背景, 它会欺骗。
247And then, and they will really try to anchor on like a lot of the previous然后,他们真的会像以前一样坚持下去
248conversation.谈话。
249So you really want to review the code with like a different sub agent or like所以,你真的想审查代码 与不同的子代理或喜欢
250a separate agent that it's called an adversarial review agent.一个单独的代理人,它被称为对抗性审查代理人。
251And when you have an agent write a diff or thing, just have like a good template当你有代理 写一个diff或东西, 只是有像一个好的模板
252that the agent can pull from.特工能从中抽身
253So your PRs look the same, they feel the same, they have the important bits.所以,你的公关看起来是一样的, 他们的感觉是一样的, 他们有重要的位点。
254If you don't give any guidance on what the agent should really have, it will如果你不给任何指导 特工应该有什么,它会
255write you like a giant paragraph, like a story.写你像一个巨大的段落, 像一个故事。
256And honestly, that's my biggest pet peeve right now is when people submit PRs or老实说,这是我最大的宠物尿尿,现在是 当人们提交公关或者
257diffs to review where the summary and test plan is longer than the code changesdiffs 用于审查概要和测试计划比代码变化长的地方
258itself.它本身。
259So don't be that guy.所以不要做那个家伙。
260Now I showed this off a little bit, but all the agent stuff that I've been现在,我展示了这一点一点点, 但所有经纪人的东西,我一直
261talking about was during runtime, during the generation of the code.说到的是运行时间 代码生成期间
262And that's what you're running.而汝所运行.
263But then Codex actually offers this integration right here, where you can add但Codex实际上就在这里提供这种整合,在那里你可以添加
264a Codex reviewer on to get up and it could run on new get up, like, you know,一个Codex评论员 起来,它可以运行 在新的起来,喜欢,你知道,
265PR opens, or you could also like just add Codex here like that.PR打开,或者你也可以喜欢 只是添加Codex在这里这样。
266And essentially it's this Chachapiti Codex connector.基本上就是这个Chachapiti代码连接器。
267And I think there's a separate model slightly that is custom trained just for我觉得有一个不同的模型 稍稍地是定制训练的
268like reviewing.喜欢回顾。
269Now all of this costs money, right?现在这一切 花费钱,对不对?
270But yeah, that's an example.但是,这是一个例子。
271Another thing you can do is actually use goals as an example.另一种可以做的是把目标作为例子。
272So one of the common issues that people will run into when they start having所以当人们开始有
273these agentic systems that are reviewing their code on GitHub is that after you在GitHub上审查密码的代理系统 就是在你之后
274submit a PR, the agent will go do stuff and then it'll give you a bunch of提交公关,代理会去做一些事情 然后它会给你一堆
275comments that you need to fix.需要修改的评论。
276And sometimes there'll be a lot of back and forth.亦时有前后无量.
277You fix it and then like you resubmit and then it'll be like back and forth.你修复它,然后像 你重新提出,然后 它会像前后。
278So a thing you can do is like just use goals to babysit a PR.你可以做的就是用目标来照顾公关
279So let's say we had this like random PR.所以,让我们假设我们有 这像随机公关。
280This is a draft, but you could just say for this PR, can you babysit it every这是一个草稿,但你可以只是说 这个公关,你能照顾它每一个
281hour, check it every hour and make sure that you address any changes requests小时,每个小时检查一次,确保您满足任何更改请求
282from the Codex agent.从代码代理。
283It misspelled it, but you get the point.拼错了,但你明白我的意思
284So what this will do is every hour it will check that PR and then it will fix所以,它会做一个小时 它会检查公关 然后它会修复
285any issues, rerun your local validations, agentic validations, update the PR任何问题,请重新运行本地验证,代理验证,更新 PR
286notes, and then resend it.注释,然后重新发送。
287So these are the kinds of things that you should build into your own这些是你们自己应该建造的东西
288skill if you haven't done so.技术,如果你还没有这样做。
289But yeah, so those are kind of like the high level, like useful tools.但是,是的,所以这些 有点像高级, 像有用的工具。
290In my opinion, it's just really important to use adversarial agent.在我看来 使用对抗性特工是非常重要的
291In my opinion, have good review skills.我认为,有良好的审查技能。
292Actually just like the default, like skill reviewers have a template for其实就像默认, 像技能审核员有一个模板
293your PRs and you can use my template if you want, but just have a template.公关和我的模板,如果你需要,但只要有一个模板。
294So it conforms your PRs to that template.让你的公关符合这个模板
295And then it adds like validation proof.然后它又增加了像验证证明。
296You know, we talked about the different types of validation.你知道,我们谈到 不同类型的验证。
297You really want to anchor on the agents, giving you proof that will actually你真的想锁定特工, 给你证据,实际上
298help your AI coding, by the way.顺便帮你的人工智能编码
299And then you just submit all of that.然后你只是提交 所有这一切。
300And then you make sure you anchor on safety and gating.然后你确保你锚在安全 和吉丁。
301So these are kind of the high level things that I think about before we end所以,这些都是一种高层次的事情 我思考 在我们结束之前
302this video, I also want to talk about what it means if you're coding like这段录像,我也想谈谈 如果你像编码
303this, where you're reading some of the code deeply and you're reading like这个,你读一些代码 深入,你读像
304leaf notes, kind of like skimming it as you're going the end product of that叶子笔记,有点像 滑动它,当你去 端产品
305higher feature at the end of your coding session, like you're like, Oh, I'm done.高级的功能 在你的编码会议结束时, 就像你喜欢, 哦,我完成了。
306If you actually code in this way, you'll be only actually like 80% done.如果你真的用这种方式编码, 你实际上只会像 80%完成。
307So here I'm saying, even if it's merge ready, I don't think it's launch ready.所以,我在这里说, 即使它已经合并了, 我认为它还没有准备好。
308So what I like to do is I call this initial step of like getting所以,我喜欢做的是,我称这个初始步骤 像得到
309everything gated and landed.一切都关闭和着陆。
310I call that like broad strokes.我管这叫大打大打
311I'm doing like broad strokes of the code changes.我做得很像 广义的代码改变。
312And then this last like 20% or so is really getting something launch ready.然后,这持续了20%左右 真正得到的东西 发射准备。
313And this is where a lot of my human like effort comes in.我的许多人类都在这里努力
314And I do a lot of refactoring here and kind of like cleaning up of the code base.我在这里做了很多重构工作 就像清理了密码基础
315Right.对
316So I actually have a bunch of agents before I do any launch.所以,实际上我有一堆特工 在我做任何发射前。
317I like audit the entire code that it was written.我喜欢审计整个代码 这是写。
318And then I think about it from high level.然后从高处想.
319And I think about like important things like performance, a bug security, you我想到一些重要的事情 比如表演 窃听器安全 你
320know, and then whether the feature actually works to spec and that I'm really知道,然后该功能是否真的 工作到Spec 而我真的
321like detailing the animations or anything like that until this last 20% actually就像详细描述动画之类的东西 直到最后20%
322takes as long as the first 80%, but it's actually the thing that is the most需要的时间与前80%一样长, 但实际上这是最
323important and in my opinion, you're able to move so quickly in the beginning, but在我看来,你一开始能这么快地行动,但是...
324this last 20% still requires a lot of like, like human taste factor.这最后的20%仍然需要很多类似的东西 比如人类的品味因素
325So you still need to look at it.所以你还是需要看看它。
326And this is where my code kind of becomes a lot more clean and production ready.这就是我的代码 变得更干净 生产就绪。
327Now, finally, when you're ready to launch the feature, I highly encourage现在,最后,当你准备好 推出这个功能,我大力鼓励
328you to try to run experiments.你尝试运行实验。
329So you could like validate that the code is actually working.所以你可以验证代码是否有效。
330Now, if you have a small user group, then you can't really run a sizable experiment.现在,如果你有一个小用户组, 那么,你就不能真正运行一个巨大的实验。
331You don't have statistical like power to even like run a legitimate AB testing,你连做一个合法的AB测试的能力都没有
332but I still recommend running AB tests or doing like Canary deployments, because但我还是建议进行AB测试 或者像加那利部署一样
333what that helps you is if you trickle your traffic for your new feature through如果你把交通引向新的特色 那对你有什么帮助?
334like future gating, then you're able to very quickly see bugs or crashes or就像未来玩游戏,你就能很快看到虫子或坠落
335alerts that fire.警告火势
336And that's the whole point.这才是重点
337You want to anchor always on safety when you're using agents to code because你想在使用特工进行密码时 总是锁定安全
338physically you won't be able to physically read everything in detail.身体上,你无法 身体上阅读所有细节。
339It's just impossible now.现在不可能了
340So the idea of high level is you want to create like an agent to safeguard所以,高水平的想法是,你想创造 像代理来保障
341and like an agent to garden where you have a lot of tests, you have a lot of就像一个经纪人到花园 在那里你有很多测试,你有很多
342validation and you have a lot of agents doing a lot of work to make sure your验证,你有很多代理 做很多工作确保你的
343code is good.密码很好
344But at the same time, you want to anchor on safety and make sure you can take但与此同时,你却想 锁定安全,确保你可以采取
345back bad decisions with gating.背负着恶毒的决定
346So do I review code?那我该审查一下密码吗?
347I think the simple answer is yes, but it really depends and it's a gradient.我认为简单的答案是肯定的, 但是它真的取决于它是一个梯度。
348But in my opinion, the models are getting better and better.但在我看来,模型越来越好。
349So you will probably review less code, but you should really anchor on所以,你可能会审查更少的代码, 但你真的应该坚持
350validation, agentic validation.审定,代理审定.
351And then the agent should like have a lot of validation and proof and然后代理应该有很多 验证和证明,
352evidence of the proof, like whether it's video recording or logs or like just证据,比如是录像还是日志
353screenshots, whatever it is.截图,不管是什么
354And then you gate and then you like start trusting the agents more.然后,你门,然后你喜欢开始信任 特工。
355And as long as you have like controls to take things back with gating, then只要你喜欢控制器 将东西拿回来 与吉丁,那么
356it should be safe to go.它应该是安全的离开。
357So yeah, I hope you guys enjoyed this video on agentic code reviewing and所以,我希望你们喜欢这视频 关于代理代码审查
358like my thoughts on code reviewing.喜欢我的想法 代码审查。
359The thing is this topic keeps changing for me right now.问题是这个话题现在一直在改变
360I'm comfortable with the skimming of some code depending on like where it is我对暗号的微调很满意 视其位置而定
361in the like tree concept that I talked about, but maybe after another few在像树的概念,我谈到, 但也许再过几个
362generations of the model, I might say, you know what, you don't need to read一代又一代的模特,我可以说, 你知道吗,你不需要阅读
363any of the code, so who knows?任何代码, 那么谁知道?
364But right now I think you still need to like read some of the code and have但现在我觉得你还是需要 读一些代码,并且有
365like a fine tuned opinion of it.像一个很好的调制 的意见它。
366Now, one last thing that I forgot to mention is that if you understand your现在,我忘了提的最后一件事是 如果你理解你的
367codebase, it's actually easier to review the code because you can very quickly代码库,实际上比较容易审查代码 因为你可以非常快
368spot what's touching like the dangerous zones of your code base and what's like注意你暗号底部的危险地带 以及是什么样子
369really simple and leaf notes, right?非常简单和叶子笔记,对不对?
370So yeah, that wraps up this video.所以,这是结束这个视频。
371I hope you guys enjoyed it.我希望你们喜欢它。
372I do a ton of these videos.我做了一吨这些视频。
373I did a video on like codex and clock code, which I think will be very我做了一个视频 像代码和时钟代码, 我认为这将是非常
374relevant for this video.与此视频相关。
375So feel free to check that out, but until I see you on the next one, bye.随便你看看,但下次见,再见
该视频共有字幕 375 条。解锁更多字幕为会员功能,请移动到 价格