Abdulkader Safi

The watcher tore itself down on every change

Live update worked sometimes and missed others because every change tore all file watches down and rebuilt them. Watches are now steady and new folders subscribe on arrival.

2 min read

Share
screenshot of MD Kanban

The watcher worked, then it did not, then it did again. Intermittent misses with the sidebar timer frozen in between. The cause was the refresh design itself: every change re-walked the whole folder tree and tore all watches down to rebuild them.

The gap

Between closing the old watches and finishing the re-walk, nothing is watched. Under steady agent edits that gap opens constantly, so edits land in the blind window and never trigger a refresh. Overlapping re-walks made it worse. The five second poller should have covered the misses, which is why the frozen checked time was the second clue that something structural was off.

Steady watches

Watches are now created once and never torn down on change. A change only debounces and broadcasts. New subfolders get watched at the moment they appear, through rename events that stat the new path and subscribe when it is a directory. Concurrent setup calls share one in-flight run instead of interleaving with each other. The list-projects path that boots all watches is now cheap and idempotent, which also removes a startup hang risk.

Where it stands

Edits refresh consistently under burst load in testing, and the debounce still collapses a burst into one rescan. The fix ships in the current dmg. If a refresh ever stalls again, the sidebar checked time is the tell: frozen means the loop stopped completing, lagging means events are missed and the poller is covering.

Last updated 10 Sep 2026 · filed under Typescript, tools, desktop, ai agent

Every entry on this project

13 build notes, in order

Including the ones where nothing worked. You are on part 8.

Read the series →

Written by

Abdulkader Safi

Software Engineer

Lead engineer at DSRPT, from Lebanon and based in Kuwait. I write about the tools and bugs from real client work, with the numbers I measured.

About me → GitHub LinkedIn

Need this kind of work done on your project?

Start a project →

Keep reading

More from MD Kanban

All 13 entries →