UsageEvents::DumpWriteBufferCronWorker throws ArgumentError "'start_agent_platform_session' is not a valid event"

Summary

After !203238 (merged) is merged we get several exceptions for UsageEvents::DumpWriteBufferCronWorker:

ArgumentError: 'start_agent_platform_session' is not a valid event

Logs: https://log.gprd.gitlab.net/app/discover#/view/ef1339d1-6e63-461c-bef6-c08b50fa8cda?_g=h@2294574&_a=h@3e64753

Impact

This bug partially blocks data flow for any AI usage events.

Technical details

Ai::UsageEvent model is stored to PG via Redis buffer, so when the MR above renamed event name, the data in buffer became invalid because there is no start_agent_platform_session event name anymore.

Proposal

Provide compatibility code which will ensure buffered data with old name s successfully transformed into new values.

Edited by 🤖 GitLab Bot 🤖