cd /news/ai-agents/3-bugs-i-fixed-before-shipping-my-wh… · home › topics › ai-agents › article
[ARTICLE · art-153494] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

3 Bugs I Fixed Before Shipping My WhatsApp AI Receptionist

Full-stack developer Sajib fixed three bugs in the knowledge pipeline (CSV/PDF/URL → chunks → Postgres) of a WhatsApp AI receptionist before shipping it in v0.5.0. The bugs included a deduplication flaw that silently discarded unchanged chunks and deleted them when the old version was replaced, a check-then-act race letting two workers claim the same pending source, and a URL-fetch vulnerability exposing localhost, internal services, and cloud metadata via redirects. The fixes—transactional version replacement, atomic claim via a conditional UPDATE with RETURNING, and URL-fetch safeguards capping responses at 5 MB—shipped with 30 tests using Node's built-in test runner.

by read1 min views1 publishedOct 20, 2026

My WhatsApp AI receptionist answered pricing questions, booked appointments, and handed off to a human.

The demo worked. Then a production review exposed three bugs in its knowledge pipeline: CSV/PDF/URL → chunks → Postgres.

Deduplication compared incoming chunks against the previous version. Unchanged chunks were discarded as duplicates—then deleted when the old version was replaced.

A 10% update left just 10% of the knowledge. No error. Just missing answers.

Fix: Identify the previous version before deduping, exclude its chunks from the comparison, and replace it in one transaction. Add a regression test.

A SELECT followed by an UPDATE let two workers pick the same pending source.

Fix: Claim it atomically:

UPDATE knowledge_sources
SET status = 'processing'
WHERE id = $1
  AND status = 'pending'
RETURNING *;

No returned row means no claim. That worker skips ingestion.

A submitted URL could send the server to localhost, internal services, or cloud metadata—including through redirects.

Fix: Add URL-fetch safeguards: allow HTTP(S) only, check resolved IPs for internal destinations, revalidate every redirect, and cap responses at 5 MB.

These fixes shipped in v0.5.0, with 30 tests using Node’s built-in runner.

A working conversation is only part of the test. Re-uploads, competing workers, and untrusted URLs deserve their own.

Which of these has caught you before? My bet: the check-then-act race.

— Sajib, full-stack developer from Dhaka · sajib.dev.cv

── more in #ai-agents 4 stories · sorted by recency
── more on @sajib 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/3-bugs-i-fixed-befor…] indexed:0 read:1min 2026-10-20 · —