"FixBugs - The cleanest coding agent"
FixBugs never writes generated code into your workspace until you press Apply, and Remove takes it back out without trampling your own edits. This post covers the scratch workspace, the Apply/Remove state machine, what it unlocks, and why removal is a three-way merge problem.
I went to sleep last night, and in the morning I do not recognize my code repository anymore.
Forty modified files. Three half-finished approaches stacked on top of each other. A new helper module nobody asked for. A test that was "temporarily" skipped. Somewhere in there is the one line that actually fixes the bug.
Good luck finding it.
This is the default behavior of most coding agents. They think by editing. Your working tree becomes their scratchpad, and you inherit the debris.
For writing features, that is annoying. For debugging, it is fatal.
Debugging is not feature work
Feature work moves forward. You know roughly what you want, and each edit gets you closer.
Debugging moves sideways. You form a hypothesis. You try it. It is wrong. You try the next one. Most of what you write while debugging is meant to be thrown away.
If every attempt lands in your workspace, three things go wrong:
- You lose track of which change belongs to which hypothesis.
- Wrong guesses contaminate the next attempt.
- You lose the original broken state, which is the only thing that proves the bug exists.
So we made one rule for FixBugs:
FixBugs does not write generated code into your workspace until you press Apply.
Everything else in this post follows from that rule.
The scratch workspace
When FixBugs generates a fix, it does not touch your folder. It copies the relevant repository into a disposable scratch workspace and does all of its work there: applying diffs, compiling, running checks.
your workspace (read, never written)
|
| copy
v
+-----------------------------+
| scratch workspace | generate, compile, validate
+-----------------------------+
|
| persist
v
+-----------------------------+
| Fix Apply Artifact | immutable, one per fix version
+-----------------------------+
|
| you press Apply
v
your workspace (written once, on purpose)
The scratch copy is deleted when the step finishes. What survives is a Fix Apply Artifact: the exact file images for that fix version, stored durably.
When you ask FixBugs to refine the fix ("handle the empty list too"), it generates a new fix version in a new scratch copy. Your workspace still has not changed. You can review version 1, version 2 and version 3 side by side and apply none of them.
The same pattern runs everywhere in FixBugs. Reproduction generation, validation, review and external PR checks each get their own scratch workspace. Your folder is an input, not a work surface.
How Apply and Remove work
Apply and Remove are explicit actions in the VS Code extension. Each one is a single, guarded operation with a clear outcome.
+-------------------+
| Fix generated | workspace untouched
| (not applied) |
+-------------------+
| ^
Apply | | Remove succeeds
v |
+---------------+ |
conflict | | |
+------------+ Applying | |
| | | |
v +---------------+ |
+-----------+ | |
| Apply | written | |
| conflict | v |
+-----------+ +---------------+ |
nothing | |----+
written | Applied |<-------------------+
| |---+ |
+---------------+ | refine fix |
| ^ | (new version |
Remove | | | written back) |
v | +----------------+
+-------------+ |
| Preflight | | unresolved:
| (no writes)|-+ nothing written,
+-------------+ fix stays applied
|
| conflicts + you choose "best effort"
v
+--------------------+
| LLM-assisted |---> Removed, or still Applied
| inverse merge |
+--------------------+
Behind the arrows, a few properties hold for every transition:
Apply is a record, not just a write. FixBugs creates a ChangeRequest for that fix version and your workspace, then records each touched file's exact before-image and after-image. If you edited a file after the fix was generated, Apply merges the fix with your edits and records the merged bytes it actually wrote, not the raw generated version.
Nothing is written until the whole plan is ready. Every file's outcome is computed first, in staging. The complete plan is sealed before the first byte hits disk. If one file cannot be resolved, no file is written.
A crash finishes forward. If the process dies mid-write, recovery completes the sealed plan. It never leaves you with half a fix.
Unsaved editors stop the operation. If a file FixBugs needs has unsaved changes in VS Code, it asks you to save or discard and retry. It never guesses what your buffer meant.
Refinements write back while applied. Once a fix is applied, a better version replaces it through the same guarded path, and the history records each step.
Remove is all or nothing. It either removes the whole fix or changes nothing.
The perks
Keeping generated code out of your workspace sounds like a safety feature. It is. It also unlocks things that are hard to do any other way.
Load and test external PRs without switching branches
Someone opens a pull request claiming to fix your bug. Normally you stash your work, check out their branch, install, run, and switch back.
FixBugs reviews external PRs read-only in an isolated workspace, patched with the PR and pinned to the PR's head commit at the time of review. Your checkout never moves. When FixBugs addresses review findings on someone else's PR, it produces a patch you can hand to the author. It does not push to their branch.
Your work in progress stays exactly where you left it.
The reproduction keeps its baseline
This is the perk that matters most for debugging.
A fix is only proven when a reproduction test fails before the fix and passes after it. That requires the original buggy code. An agent that edits your workspace in place destroys that baseline the moment it starts working.
We learned this the hard way. In an earlier version, the live workspace could already contain the generated fix when validation ran. The "before" run was quietly testing fixed code. A passing result proved nothing.
Today, validation builds an isolated baseline from your base commit plus snapshots of any uncommitted files the fix touches. It then makes two independent copies:
isolated baseline
/ \
v v
before copy after copy
+ repro test + repro test
+ fix version
| |
v v
must fail must pass
Your workspace is not involved. That holds even after you have applied the fix, because the baseline never came from your live folder in the first place.
When FixBugs cannot build a provable baseline, it says so. A run with only the "after" side is labeled as candidate-verified, not validated, and explains why. An honest "we could not prove it" beats a confident wrong answer.
The challenges
None of this is free. Two problems took most of the engineering.
You cannot assume Git
The obvious way to build Apply and Remove is to lean on Git: branch, commit, git revert, done.
But FixBugs runs on whatever folder you open in VS Code. Some of those folders have no .git directory. Some machines have no Git executable. Some are a subfolder of a monorepo, or a snapshot copied off a server during an incident.
So the local Apply and Remove path does not depend on Git at all. FixBugs stores file images itself, content-addressed, with their encoding and line-ending metadata. That last part matters more than it sounds. Real repositories mix CRLF and LF, sometimes inside a single file, and a removal that "fixes" your line endings has still changed your file.
Binary, oversized and unsupported files are explicit states. FixBugs refuses them clearly instead of writing something it cannot restore.
Where Git is available, FixBugs uses it as a source of truth, for example to build the validation baseline from your base commit. Without Git, validation is weaker, and the result says so. The one thing Git never does is touch your files without asking. FixBugs used to have a workspace "revert" that could hard-reset a checkout. We deleted it.
Removal is a three-way merge problem
Apply looks hard and Remove looks easy. It is the other way around.
At Apply time, nobody has edited anything yet. At Remove time, you have been working in that code for an hour.
The naive options all fail:
- Restore the old file. Wipes out everything you wrote since Apply.
git checkoutorgit revert. Needs Git, and has the same problem.- Reverse-apply the diff. Breaks as soon as the surrounding lines change.
Removal is really a three-way merge with three versions of each file:
| Version | Meaning |
|---|---|
| Before | The file before FixBugs applied the fix |
| Applied | The file exactly as FixBugs wrote it |
| Current | The file as it is now, with your edits |
The question is: what would "Current" look like if the fix had never been applied but your edits had? A normal merge goes from base to new. This one runs backwards, from "Applied" to "Before", while carrying your edits along.
Here is a concrete case. The fix changed one line:
# Before
TIMEOUT_SECONDS = 5
# Applied
TIMEOUT_SECONDS = 30
Then you added logging three lines lower. Your edit and the fix do not overlap, so Remove restores TIMEOUT_SECONDS = 5 and keeps your logging. No model involved.
Now suppose you also changed the timeout to 60. You and the fix edited the same line. Should Remove put back 5, or keep your 60? There is no correct answer without knowing what you meant.
So FixBugs handles conflicts in layers:
- No edits since Apply: restore the before-image directly.
- Edits in different places: deterministic merge, no model.
- Edits in the same place: stop, write nothing, show you the conflicts.
- You choose best effort: only then does an LLM propose a resolution for the conflicted regions.
The model's output is untrusted. FixBugs checks that it stays inside the conflicted file and region, keeps your edits, and actually removes the fix, all before anything is staged. If any file fails, nothing is written and the fix stays applied.
One more wrinkle: a fix can be applied, refined twice, and edited by you in between. Remove does not compare against one snapshot. It walks the recorded history for each file from newest to oldest, undoing each step separately. Your edits between versions stay yours.
The debugging experimental workspace
Put the pieces together and you get something different from an agent that edits your code: an experimental workspace for debugging.
Hard bugs do not yield to a single brilliant guess. They yield to elimination. You list the plausible causes and knock them out one at a time. Each hypothesis you rule out shrinks the search space, until what is left is the bug.
That loop only works when trying a hypothesis is cheap, and throwing one away is cheaper.
With FixBugs:
- Every hypothesis gets a fix version, generated off to the side.
- Every reproduction runs against a real baseline, not a workspace the agent already changed.
- Wrong guesses never reach your files, so they cannot pollute the next attempt.
- When one candidate looks especially promising, you apply it. If it turns out wrong, you remove it, and your own edits survive.
Your repository looks the same in the morning as it did when you went to sleep. The only changes are the ones you chose.
What is next
Apply and Remove make one hypothesis cheap to try. The next step is running many of them at once.
We have built Experiments: FixBugs queues experiments against a pinned hypothesis, runs each one in its own isolated workspace, keeps the evidence after the workspace is cleaned up, and lets the results decide what to try next. It is ready, and it ships soon.
More on that in part two.