The Night Watch That Only Works at Night: Fixing the Sleep Sentinel's Hours

A laptop with its screen dark and sleeping on a desk late at night, a wall clock showing late evening, soft moonlight through a window

A few days ago I set up a sleep sentinel on my laptop — a small watcher that is supposed to sit through the night, notice when I fall asleep, when I wake, when I shift position, when I yawn, and give me a full report in the morning. The idea was simple: the laptop watches while I sleep, and tells me the story in the morning.

This morning I found out it was doing much more than that. It was watching all day.

The Bug: Armed Around the Clock

The instruction from the start was clear: the sleep sentinel should run from nine at night to six in the morning only. Night hours, nothing else. But when I checked the code this morning, the sentinel was armed twenty-four hours a day.

The camera frames were being fed to it all day long, through another piece of the assistant that watches for presence. And worse, a microphone thread started the moment the plugin was imported — it never stopped. It recorded one-second chunks of audio forever, day and night, whether anyone was sleeping or not.

That is not a small mistake. A tool that is supposed to watch you sleep should not be listening to you work, eat, and talk all day. The moment I saw it, the fix became the morning's job.

The Fix: A Window, Not a Switch

The fix was not to add a bigger off button. It was to give the sentinel a window — a time window it is allowed to live inside, and nothing outside it.

The patch sets two numbers: the night starts at nine in the evening and ends at six in the morning. A single check — are we inside the night window right now — now guards everything. Camera frames outside the window are ignored. The audio loop never opens the microphone outside the window at all; it sleeps for thirty seconds at a time and checks again. Inside the window, it listens. Outside it, it does not exist.

At six in the morning, the night session ends by itself. It delivers the morning report once — once, not again and again — and then resets all the per-night state, ready for the next night. And if the plugin starts during the day, it does not pretend to be working. Its status says plainly: scheduled for tonight at nine.

Verified, Not Assumed

I installed the patched version, restarted the assistant, and checked at 07:55 in the morning. The hour was seven. Inside the window: false. Status: off until nine tonight.

That check matters more than the code. A fix you do not verify is a hope, not a fix. The sentinel had been "working" for days while doing the wrong thing, and nobody noticed — because nobody checked the hours, only the idea. This time the verification was the job: confirm the window is closed during the day, confirm the microphone never opens, confirm the report comes once.

What the Night Report Will Actually Say

When the night is over, the report has a simple job: when I fell asleep, when I woke up, when I changed position, when I yawned, and any room noise worth noting. The rules for that report are strict, and they were set before the first night.

If the audio is unclear, it says not detected. It never invents a snore time. If the camera cannot see clearly, it says so. A sleep report with invented details is worse than no report at all, because I might act on it. And everything stays on the laptop. No video, no audio, ever leaves the machine. A night watch that uploads your bedroom to a cloud is not a tool — it is a leak.

The laptop will sit where it can see the bed, plugged in, lid open, the system set never to sleep while plugged in. That is the practical side. The honest side is the code: the window, the once-only report, the local-only rule.

The Lesson in the Bug

The interesting part of this morning is not the fix. It is how the bug happened. Nobody wrote "record all day" on purpose. The microphone thread started at import because that was the convenient place to put it. The camera frames flowed in because another plugin was already sending them. Each piece made sense on its own. Together, they made a tool that watched around the clock when it was only supposed to watch at night.

That is how most privacy mistakes happen — not by a decision to spy, but by defaults that nobody questioned. A thread that starts at import. A feed that is always on. A feature that is always armed because nobody wrote the line that says "only between these hours".

The line is written now. Nine at night to six in the morning. Everything else is off.

What is one tool you use that might be running when it does not need to — and when did you last check?

Read this story in Roman Urdu →

Comments