Delete legacy /api/chatbot/chat route
Status
DECIDED
Context
After the April 6 chatbot unification decision, /api/chatbot/stream became the
single production chatbot endpoint. The legacy /api/chatbot/chat route remained
in the codebase with its Sonnet escalation logic intact — a live footgun.
The Sonnet escalation paths in /chat were confirmed as the root cause of
$10–30/day in surprise API bills during QA runs. As long as the route existed,
any agent or test runner that called the wrong endpoint would re-trigger the cost
spike. There was no value in keeping dead code that carried active financial risk.
Decision
Delete the /api/chatbot/chat route entirely on 2026-04-09.
The production chatbot is /api/chatbot/stream. All chatbot work — system
prompts, HEAR protocol, tool deferral, test runners — MUST target the stream
endpoint. This is a permanent deletion, not a deprecation.
Rationale
- Dead code with financial blast radius is more dangerous than dead code that
simply wastes space. The escalation trigger in
/chatcould fire at any time if a caller hit the wrong endpoint. - No customers were using
/chat— PewSearch had already switched to the CWA unified embed, and CWA had only ever used/streamin production. - Deleting removes the risk and makes the codebase unambiguous: there is exactly one chatbot endpoint.
Consequences
- Good: No accidental Sonnet escalation billing. Codebase is unambiguous. Future agents cannot mistakenly target the wrong endpoint.
- Bad: If any external integration or test was pointed at
/chat, it will get 404s. No such integrations were known at deletion time. - Reversible? Yes — the route can be recreated from git history. The decision is permanent but the code is recoverable. No customer data was deleted.
Alternatives considered
- Disable escalation, keep the route — rejected; keeping dead routes invites re-activation. Removal is unambiguous.
- Redirect
/chatto/stream— rejected; the escalation path was in the body handler, not just the route path. A redirect without stripping the escalation logic would have been a partial fix.
Links
- DECISION_LOG entry:
## 2026-04-09 - Prior decision:
2026-04-06-chatbot-unification-stream-endpoint - Memory:
~/.claude/projects/C--dev/memory/feedback_chatbot_stream_is_production.md