The coding agent needs a way back from wrong
The patch looks reasonable. It compiles, the unit tests pass, and the diff is small enough to review over coffee.
Then someone opens the application.
The profile image appears to save, but a reload brings the old one back. The agent changed local state and never completed the server mutation. Nothing crashed. The interface even displayed a cheerful success message. The running product simply disagreed with the patch's story about itself.
Giving a coding agent browser access helps expose this sort of failure. Giving it a persistent workspace helps it continue from there. Neither tells the workflow what to do next.
I care more about what follows a wrong attempt than about another round of code generation.
A failure signal cannot choose the fix
Developer tools are giving agents far better senses. An agent can inspect a running page, work inside an authenticated session, run a Lighthouse audit, emulate another device, examine memory behavior, and read application-provided state. Longer-running agent environments can preserve a repository, tools, and task context across multiple attempts.
That closes a real gap. Code alone often cannot reveal whether a change works in the product that users touch.
An observation leaves the recovery work undone. A screenshot can show that a modal is clipped without explaining whether the cause is a CSS regression, the wrong viewport assumption, stale data, or an obsolete acceptance criterion. A scanner can identify a secret or vulnerable dependency without deciding whether the safe response is a code change, a credential rotation, a dependency upgrade, or an escalation to another owner.
More sensing makes failures visible. Recovery requires the system to turn a failure into a different next action.
Without that distinction, an agent can produce a strangely convincing loop: rerun the same command, make a nearby edit, rerun it again, and eventually declare success because one signal turned green. The loop stays busy without getting closer to a diagnosis.
A recovery loop has to change something
A useful correction loop can be written in six steps:
- State the expected behavior in a form that can be checked.
- Capture the observation that contradicts it.
- Classify the likely failure before editing again.
- Revise one assumption or one part of the implementation.
- Rerun the smallest check that can test that revision.
- Stop when the evidence supports the change, or escalate when it does not.
The order matters. If the workflow skips classification, the next edit is mostly a guess. If it skips the focused re-check, a passing full suite may bury the original contradiction under unrelated green output. If it has no stop condition, persistence turns into automated thrashing.
The agent may need several attempts to find the cause. Each one should be legible. A developer should be able to see what the agent believed, what contradicted that belief, what changed in the next attempt, and which result justified continuing. That is ordinary debugging, even if the tools around it look new.
Walk one frontend failure through the loop
Return to the profile image change. The intended behavior is modest: choose an image, save it, reload the page, and see the new image.
The first run supplies a clear contradiction. The preview updates and the success message appears, but a reload restores the old image. A network trace shows no successful write request.
At this point, "the test failed" is too vague to guide another attempt. The workflow can classify the problem as an implementation failure in the save path. It is not yet a rendering bug, a flaky test, or an unclear product requirement. That classification narrows the next move.
The agent inspects the event path and finds that the new preview state bypasses the mutation used by the existing form. It revises one thing: connect the save action to the mutation and show success only after the server confirms the write.
The next check should stay close to the hypothesis. Select an image, save it, confirm the write request, reload, and inspect the result. Only after that sequence passes does it make sense to run adjacent checks such as a rejected upload or a failed network response.
Suppose the write request succeeds but the reload still shows the old asset. The loop should not quietly widen into random cache edits. The new observation changes the likely failure class. The saved record, asset URL, response cache, and client cache are now separate suspects. The checkpoint should record that the mutation path was repaired and that persistence or invalidation remains unresolved.
That small record is what makes the second correction attempt different from a blind retry.
Persistence can preserve the wrong idea
Persistent, isolated environments are useful because setup is expensive. Authentication state, a running development server, installed dependencies, logs, and a reproducible route can survive between attempts. The agent can return to the same failure without rebuilding its world each time.
Continuity has a less comfortable side. It preserves assumptions too.
If the agent decided early that the profile bug was caused by stale client state, a long-lived session may accumulate patches, notes, and test commands around that diagnosis. The environment becomes richer while the original idea remains wrong. More context then makes the mistake harder to notice, not easier.
A useful checkpoint records how the attempt revised the history. Keep the expected behavior, the latest contradictory evidence, the current failure class, the change being tested, and the result. Old hypotheses should be marked as rejected when the evidence moves on.
The result is a compact debugging trail for one bounded task, rather than a claim that the environment has become durable organizational memory.
Feedback should reopen the work
Coding agents increasingly operate asynchronously. They can start from an issue, produce a pull request, respond to review comments, and encounter automated CodeQL, secret, or dependency checks along the way. This creates a promising lifecycle, but only if those events can change task state.
A review comment left after the agent says "done" should not become a passive annotation attached to a finished run. A relevant comment should reopen the task with a specific contradiction: which expectation the patch missed, which evidence supports the finding, and what kind of response is allowed.
Automated checks need similar treatment. A secret scan and a browser regression are not two points on one quality score. They describe different failure classes and call for different responses. One may require revoking a credential rather than editing code. The other may require reproducing a route at a particular viewport. A dependency alert may belong to the current patch, or it may expose an unrelated repository condition that needs separate ownership.
Collapsing all of this into "verification failed" discards the information needed for recovery.
The workflow also needs more than one kind of completion. I would separate at least these states:
- The executor finished its assigned actions.
- The relevant automated checks passed.
- The change satisfied review and acceptance.
An agent can reach the first state while the implementation remains plainly wrong. It can reach the second while a human spots a product assumption that no automated check covered. Treating those states as synonyms is how a successful run becomes a failed change.
Retrying is a budgeted decision
There is no universal correct number of retries. A formatting fix and an ambiguous authorization bug should not receive the same budget.
The workflow still needs a budget before the loop starts. The budget may be based on attempts, elapsed time, tool cost, or the risk of the affected system. The agent cannot redefine the limit merely because it has another plausible edit.
Escalation should happen when the evidence conflicts, the failure class remains unclear, the next step needs authority the agent does not have, or another attempt would repeat a rejected hypothesis. The escalation packet can stay compact: expected behavior, observations, changes already tried, checks rerun, and the unresolved decision.
That is a much better handoff than a transcript of every command. The human does not need to watch the agent think. They need to know where the evidence stopped supporting another automated move.
Some failures will still be missed. Browser inspection covers only the paths exercised. Security scanners cover defined risk classes. Reviewers can misunderstand a change. A bounded loop cannot make an agent safe or correct by construction, but it can make failure cheaper to inspect.
Reliability is visible correction
We often describe a dependable coding agent as one that produces correct changes. That is understandable, but incomplete. Real development contains stale assumptions, partial tests, ambiguous requirements, and systems that behave differently once they are running.
A mature agent workflow should expect the first implementation to be wrong sometimes. Its job is to expose the disagreement, preserve enough state to investigate it, change one meaningful thing, rerun the relevant check, and stop before uncertainty turns into confident churn.
A dependable system lets failure change what happens next, and it lets a person see why.
Comments
Post a Comment