[Backend] session_usage.asr_model is left empty while llm_model is populated (#357) #508
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found validating v4.2.0 on dev (2026-09-05). Two
session_usagerows written by real end-to-end runs through the bundled WhisperX server:asr_provider=local_whisper,asr_endpoint_host=10.3.0.28:8091,asr_model=(empty)llm_provider=llamacpp,llm_model=qwen3.5The Whisper server reports
large-v3-turboin/health, and the preflight (#354) captures it, so the value is available at the point the row is written; it is just not being copied into the usage row. Low severity, but the AI usage panel's ASR model column reads blank, and #502 item 2 keys managed ASR pricing on host + model, so an empty model will also defeat the cost estimate for a managed provider once one is configured.Fix: populate
asr_modelfrom the resolved provider's capabilities (or the response's reported model) where the row is recorded inreminder_tasks.py, with a test that a run through the stub provider stores a non-empty model.Picking this up for v4.2.1. Root cause is that
resolve_asr_identityreturns the configured model, and the default configuration leaves the model blank so the bundled server chooses. Fix: fall back to the model the server actually reports (capability discovery already reads it from/health) when the configured one is empty, so the usage row carries what served the run.Fixed in PR #510 (merged), shipping in v4.2.1.
The cause was structural rather than a dropped assignment: the bundled adapter takes no model parameter, since the WhisperX server loads one at startup and its
/transcribeform has no field to override it, soresolve_asr_identityhad only the configured string to work from, and that is empty on every self-hosted deployment.llm_modelwas populated because the LLM side genuinely has a configured model.The server does say what it is running, in
/health, on both API v1 and v2, and capability discovery was already parsing that body and discarding the field. SoAsrCapabilitiesnow carries the reported model, andresolve_asr_identityfalls back to it: configured model → the id the adapter will request (resolve_model(), unchanged for OpenAI and Groq) → the model the endpoint reported →None. Unknown staysNone; an empty string was never an honest answer.No new request on the hot path.
provider.capabilitiesis a read of the last probe, so the only wrinkle was ordering:process_audiocaptured identity before anything had probed the endpoint. It now resolves a second time right after the vocabulary step (which already probes, cached per endpoint) and still before transcription, so a run that dies mid-ASR records what was serving it. The early resolution stays for runs that fail before that.Checked that this cannot mis-price anything:
estimate_asr_costshort-circuits on the self-hosted adapter names before any rate lookup, so a populated model onlocal_whisperstill yields no dollar figure, and a test pins exactly that. Admin → AI Usage now shows the model beside the transcription time, as the LLM column always has. Older rows keep their empty column, since the model a session used six weeks ago is not recoverable.Backend suite 2323 passed / 13 skipped, frontend 505 passed, ruff clean. Verify on dev after the v4.2.1 deploy: the next processed session's usage row should read
large-v3-turbo.Verified live on dev (v4.2.1). The synthetic session was resubmitted through
POST /api/bot/sessions/{id}/audiowithforce=trueand processed end to end (16:31 → 16:41 UTC,status=succeeded). The newsession_usagerow:local_whisperlarge-v3-turbo10.3.0.28:8091llamacppqwen3.5The two rows from the v4.2.0 validation this morning keep their empty column, as the changelog says they will.