Skip to main content

One post tagged with "hmr"

View all tags

The Hot-Reload Loop Your Coding Agent Polluted

· 12 min read
Tian Pan
Software Engineer

A coding agent and a hot-module-replacement dev server are both, individually, magic. Put them in the same working directory and they become a producer-consumer pair with no synchronization primitive between them. The agent writes a file. The watcher fires. The dev server reloads to a state that exists for ninety milliseconds before the agent's next write replaces it. The error overlay reflects a snapshot the file system already moved past. The agent reads that overlay, treats it as ground truth, and writes a fix for a problem the next save will erase anyway.

You don't notice this on a one-line edit. You notice it when the agent is doing a coordinated multi-file change — renaming a prop across a component, threading a new field through a hook, splitting a module — and every intermediate state between "start" and "done" is, by construction, broken. The watcher does not know the difference between an intermediate state and a final one. The agent, observing the watcher's output, cannot tell the difference between a real error and an artifact of its own in-flight work.