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
+16 -1
View File
@@ -6114,6 +6114,21 @@
"README.md"
],
"test_status": "docs-only update; no runtime code changes"
},
"audio-transcription-fetch-retry-hardening": {
"status": "completed",
"date": "2026-02-23",
"updated": "2026-02-23",
"summary": "Added retry+timeout hardening for transient `fetch failed` errors in both pre-transcription (`models/media`) and `audio.transcribe`, with focused regression tests and runbook updates for timestamp correlation and endpoint diagnostics.",
"files_modified": [
"src/models/media.ts",
"src/models/media.test.ts",
"src/tools/builtin/audio-transcribe.ts",
"src/tools/builtin/audio-transcribe.test.ts",
"docs/runbooks/VOICE_TRANSCRIPTION_DEBUG.md",
"docs/plans/state.json"
],
"test_status": "pnpm test:run src/tools/builtin/audio-transcribe.test.ts src/models/media.test.ts"
}
},
"overall_progress": {
@@ -6135,7 +6150,7 @@
"feature_gap_scorecard": "128/128 match (100%), 0 partial (0%), 0 missing (0%)",
"operator_dx_milestone": "Phase 3 (Live Ops Dashboard): 2/2 plans complete — milestone done",
"gmail_auth_cli": "flynn gmail-auth command implemented with OAuth2 flow, doctor check, config routed to Telegram",
"native_audio_support": "completed — smart routing for native audio (Gemini/OpenAI/GitHub) vs Whisper transcription fallback, plus 2026-02-23 arg hydration hardening and tool.args_rewritten audit metric",
"native_audio_support": "completed — smart routing for native audio (Gemini/OpenAI/GitHub) vs Whisper transcription fallback, plus 2026-02-23 arg hydration hardening, tool.args_rewritten audit metric, and transient fetch retry/timeout hardening",
"remaining_phases_completion": "Phase 1: 3/3 (100%) — context levels, command registry, memory structure. Phase 2: 3/3 (100%) — component registry, confidence routing, history index. Phase 3: 2/2 (100%) — adaptive memory/compaction, truthfulness/autonomy hardening",
"next_up": "Track OpenClaw evolution regularly for inspiration and feature ideas"
},
@@ -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.