Skip to content

fix: properly track user_id in ai_usages for Telegram and web#162

Merged
tuvshinjargal merged 1 commit intomainfrom
fix/ai-usage-tracking
Feb 24, 2026
Merged

fix: properly track user_id in ai_usages for Telegram and web#162
tuvshinjargal merged 1 commit intomainfrom
fix/ai-usage-tracking

Conversation

@tuvshinjargal
Copy link
Contributor

Summary

  • Fixed Telegram bot storing user_id as null in ai_usages table by checking for conversationUser property first (set by the continue() method) before falling back to user property
  • Fixed web ChatController not storing usage by adding explicit listener for AgentStreamed event in addition to AgentPrompted
  • Updated tests to use create() instead of make() to properly persist user to database for foreign key constraint

- Check for conversationUser property first in TrackAiUsage (set by continue() method)
- Add explicit listener for AgentStreamed event in addition to AgentPrompted
- Update tests to use create() instead of make() to persist user to database
@tuvshinjargal tuvshinjargal merged commit ab24b1d into main Feb 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant