Commit Graph
3 Commits
Author SHA1 Message Date
Palash Debnath 87fe27d5a0 fix: translation provider errors, agent failure causes, M4A diarization (rewrites of #4356, #4357, #4337) (#4371)
* fix(translate): show the paid provider's own reason when it rejects a request

raise_for_status() discarded the provider's error body, so a wrong-provider,
expired or over-quota key surfaced as a bare "403 Forbidden for url ...".
Translator.translate() now raises TranslationProviderError naming the
provider and status, quoting the provider's message (DeepL message,
Microsoft/Google error.message, capped and with the key redacted), plus a
next step for 401/403, DeepL's 456 quota, 429 and 5xx.

Independent rewrite inspired by #4357 by @tng7576650-commits.

* fix(transcribe): decode uploads libsndfile cannot read before speaker diarization

Accurate transcription with speaker labels passed the raw upload to the
diarization pipeline. Transcription decodes through ffmpeg, but pyannote
reads through soundfile/torchaudio and the native Sortformer reads WAV, so
an M4A/AAC upload transcribed fine and then lost its speaker labels
(DIARIZATION_FAILED). diarize_segments() now hands both backends a
temporary WAV decoded with the shared load_audio() fallback chain when
libsndfile cannot open the file, and removes it afterwards.

Independent rewrite inspired by #4337 by @Error404-page.

* fix(dub): agent translation failures name their cause instead of an exit code

- agentProviderFailure() also reads the CLI's stderr: diagnostic lines that
  report an expired login or 401/403, a 429 or usage limit, or an
  unsupported model become AgentAuthenticationError / AgentRateLimitError /
  AgentModelError with a next step (never the raw provider text). Lines that
  are not diagnostics, such as translated dialogue, are ignored.
- An unknown non-zero exit appends the last diagnostic stderr line,
  scrubbed and capped at 240 characters.
- A second run while one is active is AgentBusyError and says which docks
  can hold the runner; the LLM bridge still answers it as a retryable 429.

Independent rewrite inspired by #4356 by @tng7576650-commits.

* docs(changelog): #4371 rewrites

* fix: review findings on #4371

- Translation: a JSON string error body is the provider's explanation.
- Agent stderr: 'not logged in', 'login expired' and 'usage limit reached'
  lines count as diagnostics; stderr only classifies a failure when the CLI
  exited non-zero, so a logged-and-retried 429 no longer rejects a good run.
- Diarization: a request cancelled while an upload is decoded never starts
  the native child.
- Test fixture keys are built at runtime so the secret scan stays clean.

* chore(security): ignore the synthetic translation-test fixture gitleaks saw in #4371's first commit

* fix(translate): redact the effective key in a provider error at any length (#4371)

* fix(translate): redact the key before collapsing whitespace in provider errors (#4371)
2026-11-23 13:00:25 +05:30
adrianchen91 527454ecca fix: stop abandoned speaker identification instead of leaving it running
On a timeout the guard cancels the worker but NativeSortformer was never given
the cancellation, so its child kept the GPU pool busy, and the upload was
deleted while the worker could still read it. Pass the request's cancellation
to Sortformer and delete the upload through on_abandon once the worker exits,
also when the request itself is cancelled.
2026-10-27 00:33:15 +05:30
adrianchen91 25fc784586 feat: identify speakers when transcribing a file
POST /transcribe never ran diarization; only the dub pipeline did. Add an
opt-in diarize flag for accurate mode that reuses the dub loader and overlap
assignment, labels each segment, and degrades to a plain transcript with a
diarization_error code when the model is missing or fails.

The Transcribe page gets an Identify speakers switch, speaker labels in the
segment list, and labelled text in exports.
2026-10-27 00:33:08 +05:30