Add AiTracking for Duo Chat approve and deny tool events
What does this MR do and why?
Follow-up to !256247 (merged), from Kaveh's review.
Tools that need approval do not fire tool_succeeded_duo_chat / tool_failed_duo_chat at click time. The frontend already sends approve_tool_duo_chat and deny_tool_duo_chat. Those events were not registered in AiTracking, so they never reached ClickHouse.
This registers them as event IDs 50 and 51 with the same extras as the other Chat tool events: session_id, tool_name, flow_type, trigger_source.
Approve is still the user decision, not the tool outcome. If the tool then runs, tool_succeeded / tool_failed can still fire after that. Deny is the path that would otherwise never show up as a tool call for the session.
Stacked on !256247 (merged). After that merges, retarget this MR to master.
References
Screenshots or screen recordings
Not applicable. Tracking-only change, no UI.
How to set up and validate locally
- Enable ClickHouse in GDK if it is not already on.
- In rails console:
Gitlab::InternalEvents.track_event( 'approve_tool_duo_chat', user: User.first, project: Project.first, additional_properties: { session_id: '42', tool_name: 'create_issue', flow_type: 'chat', trigger_source: 'web_chat' } ) - Confirm extras on the stored event:
Expected extras include integer
Ai::UsageEvent.last.slice('event', 'extras')session_id: 42andtool_name: "create_issue". - After the ClickHouse write buffer flushes, the same row should appear in
ai_usage_eventsas event50.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist.