Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

One `rm -f` Silently Disabled My Crash Detection

Description and use

Removing the pid file during test cleanup caused the crash‑recovery logic to silently skip gap detection. Preserving the pid file and mimicking the launcher’s behavior restores correct gap recording.

Problem

A test cleanup removed the daemon’s pid file, causing the crash‑recovery logic to skip gap detection silently.

Outcome

After preserving the pid file and replicating launcher behavior, the daemon correctly records a recording‑gap anomaly after a crash‑restart, and the test FT‑14 passes.

Workflow

  • 1. Test kills daemon and deletes stale state: rm -f /data/agentwatch/daemon.pid and socket. 2. Daemon starts, sees no pid file, returns early, no gap recorded. 3. Test asserts gap exists, fails. 4. Fix: keep pid file during cleanup, only delete socket. 5. Harness replicates launcher by writing pid file before daemon start. 6. Daemon detects pid file, records gap, test passes.

Evidence

The test kills the daemon and restarts it, then asserts the gap record exists. The kill step also tidied up: rm -f /data/agentwatch/daemon.pid

Source

Keep the pid file. Clear only the socket: rm -f /run/agentwatch/agentwatch.sock # leave daemon.pid alone — it's the signal, not stale state

Source

Since the launcher writes the pid file and not the daemon, the harness had to do the launcher's job when starting the daemon directly: (agentwatch-daemon >/tmp/daemon.log 2>&1 &) pgrep -f "[a]gentwatch-daemon" | head -1 > /data/agentwatch/daemon.pid

Source

  • Record date: 2026-10-12T06:56:48.080Z