AI Summary: Webhook and API handlers in `src/kai/webhook.py` currently fail with unstyled 500 errors when receiving non-object JSON bodies (like null, arrays, numbers, or strings). This issue proposes adding a check to ensure the parsed JSON payload is a dictionary before attempting to access its keys, returning a clean 400 JSON error instead. This fix will be applied to all 9 affected handlers and include new tests.
Agentic AI assistant on Telegram, powered by Claude Code. Runs locally with shell access, spec-driven PR reviews, layered security, persistent memory, and scheduled jobs. Your machine, your data, your rules.