Of course, overall the direction sounds good!
To be honest, I felt you were heading in this direction for a long time. I kept asking myself what are the prerequisites, and how to fulfill them. Maybe it’s what we will all learn.
It does feel like a bit of a wild experiment 😅, on these codebases, but it’s very reassuring if we focus this experiment on the open source repositories, and be ready to learn what we can we do at the current LLM capabilities. Some thoughts below…
Software factory story
Please let me take a step back. So we want to try to make the SWE work in the Open Source repos an autonomous factory. The five main, related, repos.
People call something like this a “dark factory”.
Why is it “dark”? Well, because there are no lights: I picture a long flat building, where there are only machines inside. No humans are operating them, so no need for lights. Machines can work in the dark.
I think that LLM capabilities today are close, though not quite there - give or take that I haven’t really tried Fable and Astra. For the rest, we still need those pesky humans. 😅 But for what?
Maybe in the hallways. I think we still need some lights in the hallways.
The rooms are dark (or can become dark), but the hallways - what are the hallways? They’re the main way through the system, they and their walls separate components and sub-components. So humans can patrol around, and look at the shapes, and sometimes push a protrusion in the wall to make it clean and lean.
The humans use flashlights sometimes. They enter a dark room and point the flashlight around a bit: see if the walls are still in place between rooms, or some machine took the wrong turn and made a hole in the wall… then they need to act and glue it back in place.
Humans usually point their flashlight to the walls, not down to the floor where machines are working. There be dragons there! 😅 No, they just listen to the humming in the room - if it sounds right, and the walls are in place, it’s fine.
Then they get out. Let it hum.
Note that there are
rooms, it’s not a single large room… that is, it has
walls separating components, and it’s terribly necessary that walls exist (otherwise we’d go towards spaghetti - machines would get enmeshed into a mess of cables and stop working)
The doors. The doors to the building are not fully in the dark. By definition, they’re half inside, half outside in the sunlight.
Through doors, things enter the system, to be processed. Features, wishes, user feedback of course. In OpenHands’ case, it’s a dev tool, so we dogfood it, too, so the needs we discover through use, too.
I think there may be some backdoors, on the other side of the building, in the shadow, where the system feeds itself… Bugs. Automations discover bugs themselves, reproduce bugs, fix bugs, review fixes. Or maybe those are just inner doors - where a drone patrols around, and finds a hole it can see, and feeds back into the system a fix.
I think there are holes it can’t see yet. We need some hallways and flashlights for those.
Why? Because LLMs love complexity. Oh, do they love complexity. If the system lets them have their way on that, they’ll entangle themselves into a knot.
———
Just the other day I was thinking about this factory, since of course it’s clear we’re moving towards it - and I was writing about this building. Please see the screenshot below. 😅
Yeah, LLMs are still perfectly able to tie themselves into a knot.
Guardrails/constraints
I think I would add to the list
more guardrails or constraints. With any opportunity, we should add constraints for the next agent to do the right thing.
You mentioned security guardrails, of course; and it’s not just security, we have a bunch of other guardrails in CI. I suggest these other kinds of guardrails are enforcing the shape of the system.
Like
this guardrail.
And
this - or maybe we could name this one
self-healing automation.
In essence, I think the better we make the code design, and pin it down with lints/workflows/precommit/whatever, the easier it becomes for the next agent passes. Easier to not make mistakes anymore.
We could have a sub-goal to make sure it doesn’t make the same mistake twice.
———
Self-healing
To put it differently:
I agree auto-review is not perfect… I’ve been trying a lot and thinking a lot about this.
I think a complement to auto-review is important: self-healing. I submit that the factory needs self-healing automations, running periodically, suggesting improvements in design at all levels of abstraction.
In other words, if we accept that the agent’s review is enough when it’s not, and merge to main too soon, then the focus on
doing things right moves: from before it’s in main, to after it’s in main.
Redesigns, refactors, gain a new life.
I mean, what is the main risk with insufficiently good review?
Well, that bad code design slips into main, and, in time, makes the codebase unmaintainable.
OK. So I ask myself, how can we address that?
All the above:
• guardrails/constraints
• refactorings to fix code design (and put guardrails in place to pin it down)
• (self-healing) automations to visit the codebase with the right prompts to focus the LLM on known design patterns and tell smells or improvement suggestions
And one more: code review has been changing into code design review, for a long time now (several LLM generations, an eternity)
Review: review the high-level behavior and design.
• not exactly the code, most of the time (in the open source projects)
• the code design - from “does this feature affect the right files or is there an unexpected file?” to a quick overview of the relations / data flow / changes involved
Design docs
Some of us have started to have the agent fill in design docs, with focus on high level view of the PRs, or of the entire feature/refactor.
I suggest to make it standard, for PRs/redesigns that go deep enough.
That will help the auto-review too (it’s context); but also: if the author feels it’s relevant and if other people should know about it, they can notify here, in Slack, and link that doc, so we can figure out what they propose, easier than by manually reviewing code.
Reading at a glance is amazing, and we can just use the agents to give us the view we like. GitHub’s raw diffs are terribly time-consuming in comparison.
———
TL;DR:
Yes, of course this is an exciting direction (and a bit scary, but I think with self-healing in place and use of these amazing tools for visualization and collaboration, we can have a lot of fun).
I think there are others I missed above… such as e2e moved to test ALL behaviors of the system… 🤔
I'll stop here though, please do tell what you think. And where do you want to record the software factory project?