用 Codex 做持续数周的工程工作|DevDay 2026
原题What Will You Build With Coding Agents That Don’t Quit? | DevDay 2026
推荐理由OpenAI 在 DevDay 复盘一次持续六周的 Codex 持续集成排查。主线程负责触发测试和协调,子智能体追查具体失败、提出修复,再用测试检查结果。演讲还谈到持久运行环境、定期检查、预算和找人介入的条件。准备委派重复性工程任务时,可以从这场分享借一套任务定义和验收办法。
看前速览
OpenAI 工程师分享 Codex 如何用六周调查偶发失败的 CI 测试,以及如何为长期任务设计可反复验证的流程。
协调工作与疑难调查分开
最初的单线程会被难以定位的偶发失败拖住。把调查交给子智能体后,主线程仍能触发测试和分派新问题。
让智能体能验证工作并恢复进度
反复运行测试,保留进度笔记。任务超出本机可持续时间时,可使用远程环境或云端快照。
给长期工作划清操作边界
明确哪些情况要评审、何时升级给人工,以及最多占用多少 CI 资源。定时跟进可在外部情况变化后续作。
完整摘要
3D 赛道演示展示 Codex 如何在 Blender 渲染中断后继续。更详细的 CI 案例里,主线程触发测试和协调,子智能体分别调查失败,其中包括一个间歇出现的 GPU 浮点错误。讲者称六周内产生逾 1,000 次提交、600 多条 Slack 消息,合并的修复超过 213 项。演讲还说明如何设置目标、测试循环、仓库指令、持久运行环境、工具访问与升级规则,并谈到本次运行的成本估算。
文字稿
简要说明Brief Description
你将用永不放弃的编程智能体构建什么?| DevDay 2026What Will You Build With Coding Agents That Don’t Quit? | DevDay 2026
目录Table of Contents
- 在 3D 中进行的长期 Codex 工作Long-running Codex work in 3D
- 从执行计划到成果From execution plans to outcomes
- 一个为期六周的 CI 代理A six-week CI agent
- 配置长期运行的 Codex 线程Configuring a long-running Codex thread
- 插件、子线程与 UltraPlugins, child threads, and Ultra
- 心跳、成本,以及该委派哪些工作Heartbeats, costs, and what to delegate
3D 中的长期 Codex 工作Long-running Codex work in 3D
演讲者:嗨,我是 Friel(姓名拼写不确定),我在 OpenAI 负责提升工程效率,帮助我们的工程师和研究人员持续交付。Presenter: Hi, I'm Friel [name spelling uncertain], and I work on engineering acceleration at OpenAI, helping our engineers and researchers keep shipping.
Vivi:我叫 Vivi,在 OpenAI 的开发者体验团队工作。我花了很多时间尝试最新的模型,看看一般来说能把它们发挥到什么程度,对吧?最近,我一直在用 Codex 和 Astra 构建 3D 世界。我是个超级一级方程式赛车迷,想看看 Astra 能不能帮我用 3D 的方式探索一辆 F1 赛车。说到底,我想做的就是了解这些赛车由什么构成,里面有哪些部件,以及它们的组成方式。于是,我在一台远程机器上运行 Codex 和 Astra,让它给自己设定一个目标。目标很简单:造一辆法拉利,并建一个网站,让我可以探索它的所有组成部分。我给了 Codex 几张法拉利赛车的参考照片,接下来几天一直和它合作,直到它把 3D 模型做对为止。Vivi: And I'm Vivi. I work on the developer experience team at OpenAI. I spent a lot of my time experimenting with the latest models and seeing how far I can push them, just in general, right? Lately, that's meant building 3D worlds with Codex and Astra. So I am a huge Formula 1 fan, and I want to see if Astra could help me explore an F1 car in 3D. And really, what I wanted to do was to just learn what these cars are made of. What are the components within this? And just see what they're composed of. So I ran Codex with Astra on a remote machine and asked it to set itself a goal. The goal was very simple. Build a Ferrari and a website where I could explore all that it's made of. So I gave Codex a few reference photos of the Ferrari itself and worked with it over a few days until it got the 3D model right.
而令人难以置信的是,所有这一切只靠七张图片就完成了。最让我惊叹的是,Astra 几乎是在没有任何提示的情况下,不仅构建出了它的 3D 版本和呈现效果,还制作出了你在屏幕上看到的黏土模型版本和线框版本。这也让我想到了下一个项目,我这就展示给你看:制作一段我最喜欢的赛道之一——纽博格林赛道的穿越视频。同样,我只给 Codex 提供了赛道名称,让它自己去制作穿越视频,并想办法规划路线。来看看它做出来的效果。你看到的东西百分之百是不存在的,准确地说,这段视频本身并不存在。这一切都是 Codex 通过查看网上的参考资料等等自行创作出来的。And what's sort of incredible is that all of this was made by just seven pictures. What blew my mind in all of this was Astra unprompted essentially built not only the 3D version and the rendition of this, but also a clay version and the wireframe version that you see on the screen as well. And this sort of brought me to the next project, which I'm just going to show you, which was to build a fly-through of one of my favorite racetracks, which is the Nürburgring. Again, I tasked Codex with literally just the name of the track to go out, build a fly-through, and find its own way around it. Here's what it made. What you see is 100% something that does not exist in the sense that this video does not exist. This is all created just by Codex by looking at references online and so on and so forth.
于是,Codex 开始着手建造这条大奖赛赛道。启动后,它决定不做短版,而是选择更长的北环赛道版本,全长 21 公里。整段视频都沿着这条赛道的 21 公里路线展开,涵盖赛道上的全部 70 个弯道。作为参考,这条赛道的规模是普通一级方程式赛道的三倍。因此,这项工作花了两天多一点的时间。大部分时间都用在渲染画面上,Codex 只能等着 Blender 完成渲染。Codex 还使用了子代理来协助研究赛道、核实几何结构是否正确,并规划渲染本身。有意思的是,由于这是一个非常耗费计算资源的渲染任务,Codex 中途停了好几次,这是因为内存问题、CPU 过热,以及各种可能出错的状况。So Codex set out with this goal to build this Grand Prix circuit. And when it started, it decided not to make the short version, but the longer Nordschleife version. That's 21 kilometers. This entire video is 21 kilometers down to all 70 turns of the circuit itself. And just for context, this track is three times bigger than your average Formula One circuit track. So this took a little over two days. And most of the time went into rendering the frame itself. And Codex was just waiting for Blender to do its thing. Codex used sub-agents to help out research the track, figure out whether the geometry is correct or not, and really just planned the render itself. What's interesting here is that because this is a really compute-intensive render, Codex stopped a few times. This was because of RAM issues, CPU overheating, and, you know, all the things that could go wrong.
这件事最棒的地方在于,Codex 会自动从这些已保存帧所在的位置接着做,并持续运行了两天。我让 Codex 和 Astra 处理这些 F1 问题,纯粹是出于个人兴趣。但在日常工作中,你还能用它们完成更多事情。总而言之,这一切都说明,我们显然已经进入这样一个阶段:只要给智能体设定合适的目标,它们就能持续工作很长时间。能否带我们回顾一下迄今为止这段历程?What was best about this was Codex automatically picked up from where these saved frames were and kept going for these two days. Now, I pointed Codex and Astra for these F1 questions out of my own personal interest. But there's so much more you can accomplish in your day-to-day. And all of this really to say that we're clearly at a point where agents, when given the right outcome, can keep working for a really long time. Can you walk us through this journey so far?
主持人:当然可以,Vivi。如果你去年也在这里,就在这个舞台上,我当时讲过 exec plans。这是一项让 Codex 能够长时间处理难题的技能。那时,让 Codex 连续运行七个小时都算是件大事。我想,如今你甚至可以不加提示,就让它连续运行好几天来建造一条 F1 赛道。你现在看到的就是我去年用的提示词。Presenter: Absolutely, Vivi. If you were here last year, on this very stage, I talked about exec plans. A skill for Codex to make it run for long periods of time on hard problems. Back then, making Codex run for seven hours felt like a big deal. I guess today you can just unprompted make it run for several days to build an F1 circuit. What you're seeing here is the prompt that I had last year.
从执行计划到成果From execution plans to outcomes
你会发现它实际上太长了,放不下。我们不得不把它拆开。它真的很长,里面有很多明确具体的指导。我给它一段代码示例,告诉它要用哪些库,以及该如何实现。然后,我还是会让它先制定一个计划,方便我在它开始工作之前针对计划提问并来回讨论。那时,我还不太放心只给模型一个目标和各种权衡,然后就让它直接开始工作。如今有了 Astra 和 Sol,我就放心多了,可以直接明确地告诉它这些内容。我会告诉它目标和我想要的结果、我在意的事情,以及我顾虑哪些权衡,然后告诉它可以自行决定具体步骤。我也可以告诉它怎样才算工作做得好,然后就让它开始工作。You'll notice that it's actually too big to fit on. We had to split it up. It's really long. There's a lot of prescriptive guidance in here. I'm giving it a code sample. I'm telling it what libraries to use and how to go about implementing things. And then, still, I'm telling it to produce a plan that I can interrogate and go back and forth with before I have it start working. I was a lot less comfortable with giving the model then a goal and trade-offs and having it just start working. Today, with Astra and Sol, I'm much more comfortable just telling it specifically that. I tell it the goal and the outcome I want, what I care about, what are the trade-offs that I'm concerned with. And then, I tell it it can figure out the steps. I can tell it how I know when the work will be good and let it just start working.
一个为期六周的 CI 代理A six-week CI agent
我不觉得一开始就需要把计划的一半告诉它,也不觉得需要和它来回沟通。这让我开始思考,今天我能交给它什么样的任务,尤其是那些需要持续人工监督的任务。这会占用我一天中的时间。我不禁想,今年我们的模型能做到什么?今天它们能持续工作多久?答案是超过 1,000 小时。 我团队的一项工作是确保 OpenAI 全公司的持续集成(CI)保持正常运行。CI 会对代码变更运行自动化测试,让工程师和研究人员判断代码是否可以合并并发布。有时测试失败确实是因为代码有问题,但很多时候,测试会失败一次,下一次却通过了。这就是不稳定测试。之后就得有人检查,找出原因,判断遇到的是哪种故障;其中最棘手的问题可能需要花上数小时甚至数天来调试。I don't feel like I need to tell it half of the plan at the start. I don't feel like I need to go back and forth with it. And that got me thinking about what kind of jobs I can give it today, and especially the kind that requires constant manual supervision. It takes time out of my day. I wondered what could our models do this year, and how long could they work today? The answer is over 1,000 hours. One of my team's jobs is keeping continuous integration, or CI, healthy across all of OpenAI. CI runs automated tests on changes that engineers and researchers can tell whether their code can merge and they can ship. Now, a test can fail legitimately because it's broken code, but often it will fail one time and pass the next. That's a flaky test. Someone then has to look at that and determine what the cause is, what kind of failure they're looking at, and the trickiest of these can take hours or days to debug.
与此同时,又有一个任务进来了。团队里总得有人去看看,或者得由其他人来调试。如果你曾在这样的团队里工作过,就知道这种情况会不断重演。我想看看能不能让一个智能体替我接手这件事,这样我就不用每次都得开口让它去做。这个智能体运行了六周,我才把它停掉,而且不是因为它不好用。实际上,是因为我的同事也开始运行自己的智能体,来做同样的工作了。这个智能体的初始提示词只有200个词。和去年相比,发生了什么变化?嗯,我还是会给它一些基本规则,告诉它我希望它怎么工作。比如,这是我们的代码仓库。我希望你……但我会告诉它,测试怎么跑,你自己想办法。整个测试套件怎么运行,你自己弄清楚。然后我会告诉它一些规则,说明我希望它怎么给同事发消息,以及如何有效利用 CI 资源。Meanwhile, another one comes in. Someone on my team has to go look at it, or someone else has to debug it. And if you've ever worked on a team like this, you know that this just keeps recurring. I wanted to see if an agent could pick this up for me without me having to ask it every time. This agent ran for six weeks before I shut it down, and not for any reason like it wasn't working. It was actually because my colleagues had started running agents of their own to do the same work. The starting prompt for this agent was only 200 words. What changed from last year? Well, I'm still giving it some ground rules of how I want it to work. Like, here's our repo. I want you to... But I'm telling it, like, you figure out how to run tests. You figure out how to run our entire suite. And I'm going to tell it then some rules about how I want it to message my colleagues and how to use CI resources effectively.
这里没有代码。我并没有规定它该如何修复任何问题。因此,它可以继续运行,自主反复循环解决 CI 问题。这次运行开始时,我给了 Sol 5.6 个 Sol。一开始,Sol 把所有事情都放在一个线程里做。它调查失败原因,并亲自编写修复方案。但我注意到,有时它会卡在某个特别棘手的问题上,花很长时间处理,而与此同时,其他不稳定测试和问题还在不断出现。于是,大约过了四天,我打断了它,说:“其实,让你的子代理去做那些繁琐的工作吧。”这彻底改变了它的工作方式,让它的效率大幅提升。之后,主线程负责触发测试、收集失败信息,然后安排子代理和线程,并给大家发消息。There's no code here. I'm not prescribing how it needs to fix anything. And so, this allows it to keep working and do this iterative loop of solving CI problems all on its own. For this run, I started with 5.6 Sol. At first, Sol did everything in one thread. It investigated the failures, and it wrote the fixes itself. But I did notice that sometimes it would get bogged down in one particularly difficult problem, and then it would work on that for a long period of time while other flakes and issues were coming in. So, about four days in, I interrupted it, and I said, actually, let your subagents do that busy work. This was a paradigm shift for how productive it could be. The main thread was then taking care of triggering the tests and collecting the information about what was failing, and then organizing subagents and threads and messaging people.
子代理承担了那些耗时的工作:拉取代码、处理某个具体故障、反复迭代、重新推送到 CI,确认测试通过(有时也会失败),并在需要时重复这一过程。去年 DevDay 上,我开玩笑说自己差不多成了智能体经理;而今年,我已经升任智能体总监。我给一个智能体安排工作,然后由它管理一支智能体团队,替我把事情办妥。这里的成果相当惊人。在运行的六周里,它每周发起 100 多个拉取请求。整个运行期间,它推送了 1,000 多次提交,还在 Slack 上给同事发了 600 多条消息来协调工作——不只是告诉他们该做什么,而是真正与他们协作,让这些修复得以合并。总共,它合并了 213 多项自己完成的修复。The subagents did that slow work of pulling down code, working on a particular failure, iterating, pushing back up to CI, making sure that it passed or sometimes failed, and repeating when it needed to. Last year at DevDay, I joked that I'd kind of become a manager of agents, and this year, I've been promoted to a director of agents. I give an agent a job, and then it manages a team of agents to get it done for me. The outcomes here are pretty incredible. Over the six weeks that it ran, it opened more than 100 pull requests per week. Across the run, it pushed more than 1,000 commits, and it sent more than 600 messages to coworkers on Slack to coordinate, not just telling them what to do, but actually coordinate on landing these fixes. And in total, it merged more than 213 of its own fixes.
对于那些它没有合并的变更,它往往会发现其实已经有人提交了类似的改动,于是优先处理对方的工作,而不是自己的。这个智能体也认出了我的角色,甚至很擅长向上管理。运行结束后,我和它做了一次复盘。虽然它没有直接评价我的管理风格,但它说,在我整整五天没给它发过消息的那段时间里,它的工作效率最高。唉。在这 1,000 个小时里,这个智能体调用工具的次数接近 50 万次。大致可以把它看作它执行的步骤数,而且它使用了 5,800 多个子智能体会话。其中超过 67,000 次调用,只是在等待事情发生。如果你曾经维护过 CI 系统、调试过这类问题,就知道这是怎么回事:你先把代码拉下来。For those that it didn't merge, it often found that actually someone else had already produced a similar change, and it prioritized their work ahead of its own. The agent recognized my role too, and even did a good job of managing up. I did a retrospective with the agent after the run, and while it didn't say anything directly about my managing style, it did say that it was most productive for a five-day stretch when I didn't message it once. Oof. Over those 1,000 hours, the agent made just under half a million tool calls. That's roughly how many steps that it took, and it used more than 5,800 sub-agent sessions. Over 67,000 of those calls were just waiting for things to happen, and if you've ever worked on CI systems, you've ever had to debug issues like this, you know how this works. You pull down the code.
你提交一个改动。也许你会去喝杯咖啡或吃点零食,因为这需要花一点时间,然后再回来。这里的智能体不知疲倦。它能够继续处理这件事,接着暂停下来等待后续情况,然后在有新情况出现时继续处理下一步。修复 CI 的几百个问题听起来或许不算多,但请记住,这些都是最棘手的 bug——在此之前,许多其他人和他们的智能体已经反复查看过这些问题,可能也在提交改动时遇到过它们,最后决定,与其修复,不如跳过或重试那个测试来得容易。举例来说,这个智能体修复的最棘手的 bug 之一,是一个海森堡 bug:我们某个 GPU 测试中浮点计算出现的非确定性错误。You push up a change. Maybe you go get a coffee or a snack, because it's going to take a little bit, and then you come back. The agent here was tireless. It was able to keep working on this, and then pause and wait for something to happen, and then work on the next step when it came in. And a couple hundred fixes to CI might not sound like a lot, but keep in mind, these were the hardest bugs that were remaining open after many, many other humans and their agents were looking at these problems, maybe encountering them on their changes, and deciding, actually, rather than fix this, it's easier for me to skip or retry that test. As an example, one of the hardest bugs that we had to fix with that this agent fixed was a Heisenbug, a non-deterministic error in the floating-point calculations of one of our GPU tests.
这确实完全超出了我的专业领域。我花了很多时间阅读这个讨论串,并跟进调查到底发生了什么。这真的令人印象深刻。这个智能体复现了问题,并将数周的日志关联起来,最终发现问题实际上发生在某个特定节点上。随后,它自学了如何在那个节点上反复运行测试。子智能体花了好几天才调试出这个问题,因此它自学了如何在该节点上反复运行这项测试,并成功复现了问题,不过并非每次都能复现,情况是间歇性的。接下来这一点最令人印象深刻:它主动联系了负责这个系统的研究人员,并与他们展开合作,描述问题是什么、如何复现这个 bug,还向他们提出了问题。Now, this is really well out of my wheelhouse. I really had to spend a lot of time reading this thread and following up on figuring out exactly what happened. It was really impressive. The agent reproduced this and correlated logs over weeks in order to find actually there was a particular node that this happened on, and it then taught itself how to run the test repeatedly on that node. This actually took several days for the subagent to debug, so it taught itself how to run this test on this node repeatedly, and it was able to reproduce this, but not 100%, intermittently. And then this was the most impressive part. It actually reached out to researchers that owned this system, and it started a collaboration with them, describing what the problem was and how it reproduced the bug, and asking them questions.
你知道,这可能是一项软件优化,只是当时不在范围内,也没有在代码仓库中声明,但或许是那台机器的一部分;也可能是硬件问题?也许真的是某块 GPU 出了故障。它居然能做到这一点并解决这个问题,确实令人印象深刻。当然,有时候,所谓“恢复绿灯”只是删除失败的测试,对吧?有时这么做也没错。但当我们想直接删掉一个测试时,通常会保持合理的怀疑,对吧?毕竟,这是让一切通过的捷径。当智能体发现自己不确定那是不是正确的解决方案时,它往往会再创建一个智能体,仔细审查并复核第一个智能体的代码,确保方案正确,然后再请人来审查。Codex 帮我省下了这段时间,让我能够专注于扩展我们的基础设施。You know, is this a software optimization that maybe wasn't in scope, wasn't declared in the repo, but maybe part of that machine, or was this a hardware issue? Maybe there was actually a faulty GPU. It was really impressive that it was able to do this, and it was able to solve this problem. Of course, sometimes this idea of getting back to green is just to delete the failing test, right? And sometimes that's right. But we often have reasonable skepticism when we want to just delete a test, right? That's the easy way of getting things to pass. When the agent noticed that it was not sure about whether that was the right solution, it often created another agent to interrogate and review the first agent's code, make sure that it was the right solution before asking a human to review it. And Codex giving me this time back allowed me to focus on scaling our infrastructure.
这让我在整个夏天省下了几百个小时。显然,Codex 可以连续工作 1,000 个小时[字幕补充了“一天”,但这与刚才描述的持续六周相矛盾]。那么,Vibi,你能给我们介绍一下 Codex 中哪些功能让这一切成为可能吗?This gave me back hundreds of hours of my time over the summer. And obviously, Codex can work for 1,000 hours [the captions add “a day,” which conflicts with the six-week run just described]. So, Vibi, can you talk us through the features in Codex that enabled this?
配置一个长期运行的 Codex 线程Configuring a long-running Codex thread
Vivi:当然。首先,Frill 没提到的一件事是,他的智能体叫 Frillbot,我觉得这个名字也很酷、很可爱。然后,Frill 带我们了解了他的智能体完成的一系列任务,也展示了简直成百上千个提交、拉取请求等等。不过,如果我们要总结一下,在 Codex 中需要具备哪些功能才能达到那种状态,那就是这六项。接下来的几张幻灯片里,我们基本上会逐一讲讲这些功能。希望讲完之后,你也能了解如何搭建可以持续运行那么久的智能体。Vivi: Sure. So, first of all, one of the things that Frill didn't mention is that his agent was called Frillbot, which I find very cool and cute as well. And, you know, so Frill walked us through a bunch of things that his agent did. And also through, like, you know, quite literally hundreds and thousands of commits, pull requests, and so on. But if we were to sort of, like, summarize all the features that you require within Codex to get you to that state, it's these six. And what we're going to do in the next couple of slides is essentially just, like, talk through those. And hopefully, by the end of this, like, you would have an understanding of how you can set up agents that can run for that long as well.
那么,第一点,每个你想达成的目标都用一个线程。这样你就可以在这个线程里反复迭代,和 Codex 一起制定计划,并随时了解 Codex 在这项具体工作上的进展。你甚至可以要求 Codex 朝某个特定方向推进,也可以在过程中随时调整方向。我们当中有些人很喜欢用 /goal。对于你们来说,也可以使用 /goal,告诉 Codex 要全力以赴完成这项任务,无论发生什么都不要停下来,直到任务完成。现在来看 Frail 的例子。如果我要为此开一个线程,我会这样说:嘿,盯着 CI,复现这些失败的测试,提出修复方案,然后呢,替 Frail 和我开一个 PR 来审查。So, number one, use one thread for each outcome that you want to accomplish. So, this is where, like, within this thread, you can iterate, build up a plan with Codex, and really just, you know, like, check in on, like, how Codex is doing at that particular job. You can even ask Codex to work towards it in a certain specific direction, or even just, like, change directions as it goes as well. Some of us are slash goal enjoyers over here. So, for those of you, you can even use slash goal and tell Codex to relentlessly go after that task and not stop until it is completed, no matter what happens. Now, let's take Frail's example. If I was to set up a thread for that, I would say something like, hey, keep an eye on the CI, reproduce these failing tests, propose fixes, and, you know what, open a PR for both Frail and me to review.
这为 Codex 设定了一个目标:修复问题,并持续关注 CI。它还提供了一种检查工作进展的方式,那就是测试。总的来说,我们已经找到了一种让 Codex 运行这些测试、进行修改、再次运行测试,并弄清楚接下来该做什么的方法。接下来,你可以通过 agents.md 为这些长期运行的任务补充更多上下文。CI 项目的 agents.md 可以写成这样:说明你对这些测试所在位置的了解、对代理的一些要求,以及哪些事情是绝对禁止的。我建议大家在推进项目的过程中,持续维护这份文件。还有一件事——或者说一个小技巧——我总会加到 Agents.md 里:让 Codex记下它目前为止做了什么,以及还有哪些内容有待探索。This gives Codex an outcome, which is to fix and, like, you know, keep an eye on the CI. It also gives it a way to check in on its work, which is the tests. And, you know, we've overall figured out a way for Codex to run those tests, as well as make a change, run it again, figure out what it needs to do. Next up, you can further contextualize these long-running tasks using agents.md. Agents.md would look something like this for the CI project. You've got some sort of an understanding of where these tests are, what are some do's for your agents, and, hey, what are some things which are completely off-limits? And this is something which I recommend to everyone to, you know, continuously sort of maintain as you sort of work through your project. Now, one of the things, or, like, one tip that I always add to my Agents.md is to ask Codex to keep notes of what it has done so far, and also for what is still left to explore.
因此,如果 Codex 在工作过程中无法继续,它仍然可以读取工作日志,然后从中接着做。此时你一定会想:这么长的任务只用一个线程,不会导致上下文逐渐失效,或者模型输出质量下降吗?这就要说到压缩了。压缩让我们的模型能够处理持续时间极长的任务,而不会丢失上下文。很多时候,我会开玩笑说,压缩已经是一个解决了的问题,也就是说,长时间跨度的任务已经不成问题了。说真的,我是最严格意义上这么说的:我有些线程已经运行了三个月,我敢肯定,Frail 也有不少线程运行了那么久。所以,你真的可以进行无休止的对话,不必担心输出本身。So in case of scenarios wherein Codex cannot continue the work as it happens, Codex can still sort of, like, read from that work log and go back to it. Now, at this point, you must be wondering, you're using one thread for such a long task, wouldn't that result in context rot or, you know, degraded model outputs? And this is where compaction comes in. Compaction allows our models to run for really long horizon tasks without losing track of context. A lot of the times I would joke about saying that compaction is a solved problem, which means that long horizon task is a solved problem. And, you know, I mean this in the most strictest sense, that I've got threads which are running for three months, and I'm sure, like, Frail's got a bunch which are running for that long as well. So you can quite literally have endless conversations without worrying about the output itself.
再说明一下,要启用这种上下文压缩,你不需要更改 Codex 的任何默认行为。这是内置功能。不过,在笔记本电脑上运行长周期任务可能会有些不便。想象一下,Frail 得让一整队笔记本电脑连续插电运行六周。这时,远程环境就派上用场了。它们可以让你的会话线程持续工作,而不必让笔记本电脑 24 小时不间断地插着电。使用 Codex,你可以通过 SSH 连接远程机器,并在桌面端、移动端和网页端使用。这样,这些会话线程就能在虚拟机上运行,并使用该虚拟机可访问的文件、上下文、Git 仓库和工具。以赛道示例来说,我用的是 Dev 服务器。那台 Dev 服务器装有 Blender,也有一些相关的项目文件,还能访问网页搜索,因此它可以按需获取所需资源。And just to make it clear, you do not need to change anything in your default Codex behavior to have this compaction. This is built in. Now, running long horizon tasks on your laptop can be a little inconvenient. Imagine Frail having to keep a fleet of laptops plugged in for six weeks straight. This is where remote environments come in. They allow your threads to continue working without having to have a laptop plugged in 24-7. With Codex, you can connect remote machines over SSH, across desktop, mobile, as well as web. And that allows these threads to run on this virtual machine with the files, the context, the Git repos, and the tools that it has access to. For the racetrack example, I used the Dev server. That Dev server had Blender. It also had some relevant project files. It also had access to web search, so it could, like, pull in resources as it needed.
而且,Codex 确实已经准备就绪好几天了。从今天起,你还可以使用我们全新升级的 Codex Cloud 体验。你可以使用功能强大的虚拟机,运行完整的 Codex 智能体,无需自己管理机器。环境会保存快照,这意味着即使过几天甚至几周后再回来处理某项任务,也可以接着做。它还会定期刷新检出的代码和依赖项,确保你的任务能够正常运行。说个有趣的事:今天我们发布的所有内容中,有些 PR 实际上就是我通过 Codex Cloud 在幕后合并的。所以它确实能用。它还支持我之前提到的三种使用场景:桌面端、移动端和网页端。最棒的是,你还可以把所有 Codex 插件带进来,直接在其中使用。And Codex was good to go for quite literally a couple days. And starting today, you can also use our new and improved Codex Cloud experience as well. You get the full Codex agent with a powerful virtual machine without the need to manage the machine yourself. The environment is snapshotted, which means in case you come back to a task after a couple days or even weeks, you can come back to it. It also refreshes the checked-out code, dependencies periodically to make sure that your tasks work the way that they do. In fact, fun fact, today for all the stuff that we launched, I was actually merging those PR from the backstages via Codex Cloud. So it does work. It also works across the three surfaces that I mentioned before, which is desktop, mobile, and web. And the best part is you can bring in all of your Codex plugins as you use directly in it as well.
插件、子线程与 UltraPlugins, child threads, and Ultra
说到插件,既然 Codex 现在有地方可以运行了,比如虚拟机或 Codex Cloud 等,你就需要确保 Codex 全面了解自己要做什么。回到 Frail 的例子,假设有一个测试未通过。可能已经有人为此创建了 GitHub issue,也可能团队成员已经在 Slack 上讨论过这个问题。Codex 可以继续处理这个问题,但如果它不知道具体情况,就只会像无头苍蝇一样盲目乱转。这正是插件派上用场的地方。你可以连接 GitHub、Linear 等插件,简单来说,就是让 Codex 使用你日常工作中会用到的工具,这样它就能搜索 issue、讨论、拉取请求等内容。我坚信,插件是最大限度提升 Codex 使用效果的途径。Speaking of plugins, now that Codex has somewhere to run, it's got either a VM or Codex Cloud and so on, you do want to make sure that Codex has the full picture of what it's trying to do. Going back to Frail's example, let's say there is a test that is failing. Now, there might already be a GitHub issue for it, or there might be that the teammates are already discussing that on Slack. Now, Codex can continue sort of working on that problem, but it would just be mindlessly running around like a headless chicken if it didn't know what is happening. And this is where plugins come in. You can connect plugins like GitHub, Linear, and really just give Codex access to tools that you work with so that it can search through issues, discussions, pull requests, and so on. I am a huge believer that plugins is the way to accelerate the most that you get out of Codex.
现在,当你给 Codex 一项大任务时,可能有几件事可以同时进行。比如,把一项为期六周的任务全都放在同一个线程里处理,尤其是跨越好几天时,可能会有点混乱。以法拉利项目为例,其中有 Blender 模型,也有一个需要搭建的网站,用户可以在上面以各种方式探索模型,等等。这两部分不必按顺序完成。你可以让 Codex 把这项任务拆分成多个子线程。主线程可以继续跟进整体任务。你甚至可以打开这些单独的线程,给它们指明方向,或者让它们停下来,也可以把它们当作独立项目来处理。Codex 应用的用户界面通常会呈现出这样的效果。Now, when you give Codex a big job, there might be a few things it could work on at the same time. Like, running a six-week long task in just one single thread can be a little messy, especially over days. Take the Ferrari project, for example. There is the Blender model, but there's also the website which needs to be built where you can sort of explore the model and so on and so forth. These two pieces do not need to be worked on sequentially. So what you could do is you could just ask Codex to split this task into child threads. The main thread can keep an eye over the main job. And, you know, you can even open these individual threads and sort of give them direction or just ask them to stop or just really treat them as individual projects in itself as well. This is how it would typically look like on the Codex app UI as well.
如果你使用的是 Git 仓库,每个线程或这些子线程都可以拥有自己的工作树。工作树是代码的一份独立检出副本,这样 Codex 子代理和子线程就可以进行修改,而不会在同一份代码上相互干扰。这在多个并行线程同时开发不同功能时尤其有用。它还能让你的 Codex 智能体以更快、更安全的方式继续工作。 你可能会想,如何引导长时间运行的任务,尤其是那些持续几天、甚至几个月的任务?这时就可以使用 /side。/side 是一种特殊的子线程,它会分叉出主线程的完整上下文,让你可以提问,而不会干扰主线程本身。And if you're using a Git repo, each thread or each of these child threads can have its own worktree. A worktree is a separate checkout of the code itself so that Codex sub-agents and the child threads can make changes without sort of messing around with one copy of your code. This is particularly useful as parallel threads are working on different features together. It allows your Codex agent to continue working faster and in a much more secure way as well. Now, you might be wondering, how do you steer long-running tasks, especially like those which are running over a couple of days and even months and so on and so forth? This is where slash side comes in. Slash side is a special form of child thread which forks the entire context that your main thread has and allows you to ask questions without messing around with the main thread itself.
我个人每天都会使用这两个功能十几次。尤其是有了工作树,我可以同时处理多个项目,也可以在同一个项目中处理多个功能,而不用担心合并冲突。毕竟我们都讨厌合并冲突。现在,这些线程在运行时,其中一个可能会卡住。也许 Codex 已经尝试了几种方法,但还是没弄清楚到底哪里出了问题。这时候,Ultra 模式就派上用场了。我得说,我个人非常喜欢这个可视化功能。Codex 可以使用 Ultra 模式,让模型花大量时间自行推理问题。它还可以在线程中启动子代理,你知道,其中一个子代理可以去调查问题;另一个可以尝试潜在的修复方案;或者,真的,也可以让另一个子代理跳出常规思路。I personally use both of these features over a dozen times a day. Especially with worktrees, I can work on multiple projects and multiple features within a project without worrying about merge conflicts. And we all hate merge conflicts. Now, while those threads are working, one of them might get stuck. Maybe Codex has tried a couple of approaches and still hasn't really figured out what exactly is going wrong. This is where ultra mode comes in. And I have to say I personally love this visualization a lot. Codex can use ultra to give the model a lot of time to reason through the problem itself. It can also spin up sub-agents within that thread that could, you know, one of those sub-agents could go investigate the problem. One of them can try a potential fix or just, you know, really another one could just like think outside the box.
心跳、成本,以及应该委派什么Heartbeats, costs, and what to delegate
而 Ultra 则让 Codex 能够把这一切整合在一个套件中进行管理。现在,拿让 Codex 创建子线程和让 Codex 使用 Ultra 来做个类比,二者真正的区别——或者说,在我看来——是这样的:当我遇到一个可以轻松并行化的问题时,我会让 Codex 用多个线程拆分任务并着手处理;而当我面对一个非常棘手的问题时,比如你提到的 GPU 问题和浮点精度问题,我就会切换到 Ultra。有时,某项工作可能会因为等待某件不受其自身控制的事情而停滞。比如说,我开了一个拉取请求,或者 Codex 替我开了一个拉取请求,正在等 Frail 审核。这时我有两个选择:一个是继续在 Slack 上给 Frail 发消息,让他结束咖啡休息,回来审查我的 PR。And ultra gives Codex the capability to sort of manage that all in a package itself. Now, to draw parallels between having Codex spin up child threads and having Codex work on ultra, the main difference really is, or rather the way that I see it is, when I have a problem that's embarrassingly parallel, I would have Codex use threads to split that task and work on that. And when I'm dealing with one really hard problem, much like the GPU problem that you mentioned and the floating point precision problem, I would switch to ultra. Now, sometimes a job can get held up waiting for something that is outside its own control. This could be, let's say I've opened a pull request or my Codex has opened a pull request and it's waiting for Frail to review. Now, I have two options. One is that I can continue messaging Frail on Slack to come back from his coffee break and review my PR.
或者我也可以让 Codex 设置一个定时任务,帮我查看一下。举个例子:嘿,Codex,每隔半小时检查一下有没有评审意见,看看是否有反馈。如果有你能处理的问题,就处理一下;如果没有,就照常继续。这就叫作心跳。心跳是在同一个线程中安排的定期跟进,Codex 可以带着截至目前完成的所有工作、发生的变化,以及接下来需要处理的事项等上下文回来继续工作。你也可以通过定时任务,每次都创建一个新任务。比如,让它总结我做过的所有项目,或者总结一下我的项目昨晚发生的所有事情。Or I can just have Codex, you know, set up a scheduled task and look at that for me. An example of this would be, hey, Codex, every half hour, check for, you know, some sort of a review and see if there's a feedback. If there is something that you can address, address it. If not, then, you know, just carry on as usual. And this is what is called a heartbeat. A heartbeat is a scheduled follow-up within the same thread where Codex can come back with the context of all the work it's done so far, what's changed, and really whatever needs to be done sort of next. You can also use scheduled tasks to set up a new task each time. A good example of this is give me a summary of all the projects that I've done or, like, everything that's happened, you know, in my project overnight.
或者说,你也可以让它每周总结一下你以前参与、现在已经不再负责的不同项目。你只要试着写一个提示词,设定好运行频率,就能在 Codex 应用的“计划任务”标签页里找到它。现在,Frey,你让所有这些功能运行了六周。我能想象此刻在场的每个人都在想:嘿,你在 OpenAI 工作,tokens 多得用不完。我们其他人肯定负担不起吧。那我们就来揭开这个谜底吧。跟我说说,实际花了多少钱?Or really just, you know, give a weekly summary of different projects which I used to work on and don't work on now. You can just try a prompt, set it as how often you want it to run, and you will find it in the scheduled tab on the Codex app. Now, Frey, you let all of this, all of these features run for six weeks. And I can imagine literally everyone in this room thinking right now that, hey, you work at OpenAI, you have infinite tokens. And the rest of us surely can't afford that. So let's demystify that. Walk me through how much did it actually cost.
主持人:这是个很好的问题,Vivi。当然,我和我的经理当时也在问同样的问题。后来我们根据定价反推,算下来让 Codex 连续运行六周、修复 OpenAI 全公司的 CI,成本大约是每小时 32 美元。Presenter: It's a great question, Vivi. And, of course, I and my manager were asking the same question. And it turned out we worked back from the pricing and it worked out to about $32 an hour to have Codex running for six weeks fixing CI across all of OpenAI.
不过,上周使用 GPT-6 Sol 时,价格降到了每小时 16 美元。GPT-6 能让你的 token 预算发挥出两倍的效用。GPT-6.1 Sol 的 token 效率更高,也更能与 Astra 竞争。这款模型用于一个智能体,帮助 OpenAI 各个系统修复漏洞;它反复运行数百万项测试,每次循环都能让 CI 恢复为绿色。为了减少我们所有人的工作阻力,这笔投入非常值得。当然,修复 CI 不只是靠一个智能体,还涉及代码审查、CI 资源本身以及其他因素。不过,我确实想和大家聊聊如何从今天开始雇用 Codex。首先,找一件占用你时间、让你无法专注于对你最重要的工作的事情。比如梳理积压事项,或者尝试性地提交 PR,实现路线图上的功能。But with GPT-6 Sol last week, the price dropped to $16 an hour. GPT-6 stretches your token budget twice as far. And with 6.1 Sol, it's even more token efficient and competitive with Astra. And this was for an agent that was fixing bugs across systems all across OpenAI, getting CI Green repeatedly running millions of tests each time it ran its loop. It was well worth it to reduce friction for all of us. Of course, there's a lot more than just an agent that goes into fixing CI. There's code review. There's the CI resources themselves. There's other factors. But I do want to talk to you about how you can get started hiring Codex today. First, find something that's taking up time and keeping you from doing the work that matters most to you. This could be going through your backlog, making PRs maybe speculatively to implement features that are on the roadmap.
它可以监控错误、异常和日志,并针对这些问题进行修复。也可以像我做的那样修复 CI。你需要让模型能够检查自己的工作,并循环运行。你有没有端到端测试,可以让它在 Codex 云端、开发机或笔记本电脑上运行?它有没有办法判断什么时候工作已经完成?使用 GPT-6 模型时,我发现只要告诉它我看重哪些权衡,以及我想要什么结果就行了,然后我让它自行分派任务。最棘手的问题我会交给 Ultra,但我也会把 Codex 当作组织工具。就像你举的一级方程式的例子,我会在应用的侧边栏里使用分区,让它帮我整理出一些很大的分区,里面有数百个需要我查看的问题,然后我把这些内容当作收件箱来管理。我会让它创建这些讨论串,并告诉我哪些事情需要我关注。It could be watching errors and exceptions and logs and making fixes for those. Or it could be fixing CI like I did. You need to give the model a way that it can check its work and run in a loop. Do you have end-to-end tests that it can run either in Codex cloud or on a dev box or on your laptop? And does it have some way to know when its work is done? With the GPT-6 models, I find that I can just tell them the trade-offs that I care about and the outcome that I'm looking for. And I let it delegate. I use Ultra for the hardest problems, but I also use Codex as an organizer. Like with your Formula One example, I use sections in the sidebar of the app, and I have it organize huge sections for me with hundreds of issues for me to look at, and I manage this as an inbox. I let it create these threads and let me know what needs my attention.
然后我会设定自己的基本规则:告诉它什么情况下应该升级给我处理、需要引起我的注意,甚至可能要通知值班人员。最后,我会告诉它我愿意花费多少,或者就我而言,它一次可以运行多少个 CI 任务。回想一下开头时你心里想着的那件事:Codex 能帮你分担哪些工作?它为你腾出时间后,你又能做些什么?谢谢大家,祝大家 DevDay 愉快。And I set my ground rules. I tell it when it should escalate to me and needs my attention, or maybe even to ping an on-call. And then finally, I tell it how much I'm willing to spend, or in my case, how many CI jobs can it run at one time? So think back to the beginning and the thing you had in mind at the start. What could Codex take off of your plate? And what could you do with the time that it gives you back? Thanks, everyone, and have a great DevDay.