Urgent.News

What's breaking now, across thousands of outlets.

Tech

Same audio, four request IDs: keying idempotency on the bytes so a phone can resend safely

Bolo turns speech on a phone into text. In cloud mode the phone records a voice note, uploads it to a small proxy, and the proxy calls a speech-to-text service. Two problems in that path turned out to be the same problem seen from opposite ends: The server was doing the same transcription several times for one recording. On a flaky home connection the phone gave up too early, even though a resend…

Both the phone and server experienced issues with repeated transcriptions for the same voice recording. The phone would upload a recording multiple times with new request IDs, even though the audio bytes were identical. The server was incorrectly treating each upload as a separate transcription, charging the quota for each request.

The root cause was a race condition in the phone's code that allowed duplicate uploads. To resolve this, a new idempotency key was created by combining the device ID with a SHA-256 hash of the uploaded audio. This key ensured that repeated uploads with the same audio were recognized as duplicates and only one transcription was performed.

The client could also provide its own audio hash, and a mismatch would result in a 400 error. The server and client both helped maintain this idempotency, preventing redundant transcriptions.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Friday 6 November →