Offline-first tracking: surviving outages without duplicates
Remote work means flaky networks. Here's how the agent queues encrypted events, syncs idempotently, and recovers from crashes — and how we tested it live.
A monitoring product that drops data during connectivity gaps punishes exactly the people it should treat fairly: travellers, home-office workers on bad ISPs, laptop sleepers. So offline behavior is a first-class design constraint, not an error state.
Encrypted local queue
While the API is unreachable, events accumulate in a local store sealed with AES-256-GCM. A lost or stolen laptop yields nothing readable. Uploads retry with exponential backoff and resume from checkpoints.
Idempotency, not hope
Every event carries a client-generated id. If a batch upload succeeds on the wire but the response is lost, the retry re-sends the same ids — and the server drops records it has already seen. Seconds are counted exactly once per person per day, even after replays.
How we verified it
In a live test we disconnected a monitored Mac mid-workday, let 15 records queue, restored connectivity, and confirmed the full batch arrived with zero duplicates. In a separate test we killed the agent process uncleanly and confirmed recovery resumed from its checkpoint with all open records intact. Both behaviors are also covered by the automated suite.