Harden audio transcription fetch path with retries and timeout

This commit is contained in:
William Valentin
2026-02-22 19:54:58 -08:00
parent abaa9be3f1
commit 487f26e36d
6 changed files with 175 additions and 4 deletions
@@ -39,9 +39,28 @@ curl -sS -i -X POST http://localhost:18801/v1/audio/transcriptions \
- `Transcription endpoint error: FFmpeg conversion failed.`
- Endpoint could not decode payload as audio. Often caused by model-provided fake or mismatched `data`/`mime_type`.
- `fetch failed`
- Flynn could not connect to the transcription endpoint for that attempt (transport/connectivity timeout/reset).
- Confirm endpoint is reachable from Flynn host and check `whisper-server` logs around the same timestamp.
- If this is intermittent, Flynn now retries transient failures before returning an error.
- `[No speech detected]`
- Request succeeded and endpoint returned empty transcript text.
## Correlate Events By Timestamp
To inspect one Telegram session with wall-clock timestamps:
```bash
tail -n 2000 ~/.local/share/flynn/audit.log | jq -c '
select(
.event.session_id=="telegram:8367012007" and
(.event_type=="user.action" or .event_type=="backend.route" or .event_type=="tool.start" or .event_type=="tool.success" or .event_type=="tool.error")
)
| . + {ts_iso: ((.timestamp/1000)|strftime("%Y-%m-%d %H:%M:%S %Z"))}
'
```
## Rewrite Metric
Flynn emits `tool.args_rewritten` whenever it replaces model-provided `audio.transcribe` args with trusted session audio bytes.