Skip to content

Conversation

@ZogStriP
Copy link
Member

When automations triggered AI API calls, the usage was incorrectly attributed to the post author who triggered the automation, rather than to the system. This caused users to see AI usage in their Rewind reports for AI features they never intentionally invoked.

Added an attributed_user parameter to Playground.reply_to_post() and Playground.reply_to() that flows through to BotContext. When set, this user is recorded in AiApiAuditLog instead of defaulting to the post author.

The automation handlers (LlmPersonaTriage and LlmTriage) now pass Discourse.system_user as the attributed_user, ensuring automation-triggered AI calls are properly attributed to system rather than the triggering user.

Direct user-initiated AI interactions (mentioning bots, using AI features) continue to be attributed to the actual user since attributed_user is nil in those cases.

Internal ref - t/170333

When automations triggered AI API calls, the usage was incorrectly
attributed to the post author who triggered the automation, rather than
to the system. This caused users to see AI usage in their Rewind reports
for AI features they never intentionally invoked.

Added an `attributed_user` parameter to `Playground.reply_to_post()` and
`Playground.reply_to()` that flows through to `BotContext`. When set, this
user is recorded in `AiApiAuditLog` instead of defaulting to the post author.

The automation handlers (`LlmPersonaTriage` and `LlmTriage`) now pass
`Discourse.system_user` as the `attributed_user`, ensuring automation-triggered
AI calls are properly attributed to system rather than the triggering user.

Direct user-initiated AI interactions (mentioning bots, using AI features)
continue to be attributed to the actual user since `attributed_user` is nil
in those cases.

Internal ref - t/170333
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants