PC_Workman / blog
Wednesday Code Autopsy · #11

The Bug That Worked Perfectly for 4 Months

The code worked perfectly. That's exactly why this bug survived four months in production.

By Marcin Firmuga·2026-06-03·2 min read·Wednesday Code Autopsy #11

The code worked perfectly. That's exactly why this bug survived four months in production.

A tester sent me 15 bug reports last week. I fixed them all — and found 10 more they never mentioned. Somewhere in the middle I opened system_context.py to double-check something, and found the real problem nobody was looking for.

snapshot() reads live CPU, RAM, GPU and the process list. The core data function. Every module calls it — response builder, context system, intent router, proactive monitor — all independently, "just to be safe," each one getting fresh data. 19 calls per single user message. The function was fine. Fast. Accurate. No errors, no logs. For four months.

The problem wasn't the code. It was that nobody coordinated who was calling it. Everyone assumed someone else handled the caching.

_SNAPSHOT_CACHE_TTL = 1.0  # seconds

def snapshot(self, force=False):
    now = time.time()
    if not force and self._snapshot_cache:
        if (now - self._snapshot_ts) < self._SNAPSHOT_CACHE_TTL:
            return self._snapshot_cache
    ...
    self._snapshot_cache = ctx
    self._snapshot_ts = now
    return ctx

A 1-second TTL. 19 calls down to 1. Fresh enough to be live, short enough to share across modules.

The scariest bugs don't break things. They work. Perfectly. Quietly. Until you accidentally look at the right file for the wrong reason.

That tester's reports also turned into a full patched release — v1.7.7: Services Manager, Startup Manager, Drivers page, hck_GPT stability. 20+ fixes, tested, VirusTotal 0/70, a new SECURITY.md in the repo.

BuildInPublicPythonAI
This is the project behind the post. PC Workman is a free, open-source Windows system monitor with an offline AI assistant - everything described here is real, shipped code. Download it or read the source.
← #10Six Memory Depths, One Dictionary#12 →Five Words That Teach the App What "Normal" Means
MF

Marcin Firmuga

Solo developer · HCK_Labs · building PC Workman in public

Every edition is written from that week's real commits. Newest posts premiere on LinkedIn - the archive lives here. More about me: my story.