cd /news/ai-agents/my-ai-wrote-a-bug-that-would-have-le… Β· home β€Ί topics β€Ί ai-agents β€Ί article
[ARTICLE Β· art-177677] src=dev.to β†— pub= topic=ai-agents verified=true sentiment=↑ positive

My AI Wrote a Bug That Would Have Let Strangers Fake Your Safety Check-In

A developer built Afterlife Kit, an open-source offline-first app skeleton for #Kiroween using Kiro, a spec-driven AI IDE, and documented four bugs the AI agent introduced that were caught by property-based tests before release. The failures included a hybrid logical clock that could issue duplicate timestamps, a relay paging scheme that dropped edits from the longest-offline device, an overdue alarm measured from the last check-in instead of the next checkpoint's ETA, and ECDSA check-ins vulnerable to public-key swapping under another member's id. The fixes included the textbook HLC receive rule, keying batches by server arrival time, and deriving self-certifying member ids from the signing key.

recommendation

Convert each requirement into a property test and gate the coding agent on it, since example tests passed while properties exposed duplicate timestamps, dropped offline edits, and key-swapping check-ins.

more in playbook: Designing agent systems
by read4 min views5 publishedNov 28, 2026

It's 6:41 PM on Halloween. Maya is somewhere on Blackwood Ridge. Her phone shows no service.

At home, Mom's phone shows nothing either. Every app they own died the second the signal did.

That's the moment I built for. Afterlife Kit is an open-source skeleton for apps that keep living when the network dies. I built it for #Kiroween with Kiro, a spec-driven AI IDE. This is the story of the four bugs the AI wrote, and how the specs caught every one before a user ever could.

Most apps treat the server as the truth and your phone as a window onto it. Lose the window and you lose everything.

Afterlife Kit flips that: the device is the truth. Every change is written to an operation log on the phone (IndexedDB) the instant you tap. When any phone catches a bar of signal, the changes travel through a ~100-line relay and merge on every other phone.

Two very different apps run on the same skeleton:

πŸ¦‡ Ghost Trail πŸ•―οΈ Ledger After Dark
Group safety check-ins for no-signal hikes Credit ledger for corner shops
Real topo map, downloaded for offline use Photo receipts on every entry
Overdue alarm on every synced phone Reminders on SMS, WhatsApp, LINE, WeChat
Every check-in signed by the phone's own key 10 languages, Arabic and Urdu right-to-left

I didn't start in a chat box. I started in:

.kiro/

β”œβ”€β”€ steering/ product.md Β· tech.md Β· structure.md ← the rules every agent run follows

β”œβ”€β”€ specs/

β”‚ β”œβ”€β”€ sync-core/ requirements (EARS) Β· design Β· tasks

β”‚ └── ghost-trail/ requirements (EARS) Β· design Β· tasks

└── hooks/ tests on save Β· typecheck on stop Β· secret guard Β· boundary review

Requirements are written in EARS, so they're testable sentences:

*WHEN now > the next checkpoint's ETA + 15 min grace THE SYSTEM SHALL mark the member overdue.

The design turns those into correctness properties, and each property becomes a fast-check test that throws hundreds of random histories at the code.

Then I let Kiro's agent loose, headless, on a cheap model, one spec phase per run. A hook re-ran the property tests on every file save, and another blocked the agent from finishing while the types were broken.

The agent's code passed every example test. The properties did not pass.

The hybrid logical clock (HLC) is the heartbeat of the merge. Kiro's version could hand two phones the same timestamp, so a merge could silently pick the wrong value.

One property, "receive always produces a clock strictly greater than both inputs", failed in three steps. The fix was the textbook HLC receive rule.

This one scared me. Three replicas, one with a clock 3 ms behind:

replica 2 writes + pushes β†’ replica 0 pulls (cursor jumps ahead)
replica 1 writes (older clock) + pushes β†’ replica 0 pulls β†’ never sees it πŸ’€

The relay was paging by the phones' clocks. The phone that was offline the longest (the exact user this kit exists for) lost its edits. The spec said to key batches by server arrival time. The property made the gap impossible to miss.

CP0 at 11:00, CP1 at 12:00. Hiker checks in at CP0 at 11:00. On time.
now = 11:12 β†’ "OVERDUE" πŸ¦‡πŸ¦‡πŸ¦‡

The agent measured lateness from the last check-in, not the next checkpoint's ETA. Every hiker would have triggered a bat-swarm alarm 15 minutes after every check-in. Kiro's own seven properties passed. Three more properties written straight from the requirement text failed instantly.

Requirement 5 says "Only you can check in as you." Kiro implemented ECDSA signatures and five properties, all green.

I added a sixth: a check-in is valid only if the signing key belongs to that member id. It failed immediately. Ids were random, so anyone who could edit the shared member list could swap their own public key under Maya's id and sign "I'm OK" as her. On a safety app.

The fix: make ids self-certifying.

id = base64url(SHA-256(`${crv}:${x}:${y}`)).slice(0, 22)

Swap the key and you're out. Every phone checks it before trusting a signature.

Because it's Kiroween:

The whole thing (sync engine, two apps, 40 tests, 29 property checks) ran on Kiro's free credits. The specs did the thinking, so the model only had to type.

Built for #Kiroween 2026 (Skeleton Crew). Map data Β© OpenStreetMap contributors, OpenTopoMap.

── more in #ai-agents 4 stories Β· sorted by recency
── more on @kiro 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/my-ai-wrote-a-bug-th…] indexed:0 read:4min 2026-11-28 Β· β€”