Files
AI_engine/agents/dispatch_agent.py
Suriyakumarvijayanayagam 008df49605 fix(dispatch): bucket failures by geo cell while the backend omits zone_id
Every booking.assignment_failed observed in production carries no zone_id, so
the per-zone failure counter and the once-a-day alert limit collapsed into a
single global "unknown" bucket — one alert per day for the whole country.

zone_key() prefers the backend's zone_id and falls back to a coarse lat/lon
grid cell (1 dp, ~11 km, DISPATCH_GEO_BUCKET_DP). The failure reason is now
logged too.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012AJLYcbTHCe45fyFnMfEin
2026-09-22 16:42:15 +05:30

22 KiB