Repository navigation
fix(cli): report transcription language and progress - #5103
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
jrusso1020
left a comment
There was a problem hiding this comment.
Approve at 366f1acc.
The language fix is correct. whisper.cpp logs auto-detected language through WHISPER_LOG_INFO (stderr) and defaults --language to en. So the old stdout probe never matched, and multilingual models decoded as English. Reading result.language from the full JSON, and only when the language was selected automatically, is the right shape.
The reported model is now the resolved one: small.en --language es reports small.
--no-runtime-install exits non-zero before any brew/git/cmake call, including on the auto fallback. The default path is unchanged.
stdout stays clean. With a stub runtime, stdout carries exactly one result. The in-repo callers (media-use, embedded-captions, tts) read stdout or transcript.json, so they're unaffected.
Tests:
- The whisper, transcribe, models and download suites pass 211/211.
tsc, oxlint and oxfmt are clean.- Mutating the install guard, the auto-language gate or the progress writer each fails a test.
Overlap with #5095: the two conflict textually in one hunk, transcribeWithSherpa in whisper/sherpa.ts. Keeping both sides typechecks and passes the suite, so merge order doesn't matter. Whoever lands second resolves that hunk and decides whether started comes before or after the runtime selection.
Non-blocking
--jsonnow always streams progress on stderr (commands/transcribe.ts:350).- Elsewhere in the CLI,
--jsonmeans one result and no progress:models --json, cloud render, and the notices suppressed incli.ts. - On a first model download this is hundreds to thousands of lines, and skills that run
transcribe --jsonin an agent shell will surface all of it. - Consider an explicit opt-in such as
--progress json, or a much coarser interval.
- Elsewhere in the CLI,
- With the 100 ms throttle in
download.ts, the backpressure coalescing inwhisper/progress.ts(and its test) is probably unnecessary. A directprocess.stderr.write(JSON.stringify(event) + "\n")would do. - Parakeet's
started/completedevents could be emitted once aroundrun(r)in the command instead of insidesherpa.tsandparakeet.ts. That's less code, and it avoids the conflict with #5095. Whisper's events need to stay where they are so they follow the download. - Under
--json, stderr can still carry non-JSON lines (the auto fallback warning), and there's nofailedstatus. A consumer therefore sees a Parakeetstartedfollowed by a Whisperstarted. Either state in the contract that parsers must skip non-JSON lines, or add afailedrecord. - An explicit
--language autoruns detection but reportsdetectedLanguage: null, because the gate isoptions.language === undefined. - The
whisper_unavailableJSON result doesn't say that installation was disabled, and the new human message drops the install hint fromgetInstallInstructions(). docs/packages/cli.mdxis missing a--no-runtime-installrow, a stderr note on--json, anddetectedLanguage.
— Rames
Edit accuracy: accurate 2055 (base branch 2055), smooth 1625 of thoseThe gate passes. Quarantined, measured but not gated (0) |
Whisper's language probe read stdout even though the native detector logs to stderr, so multilingual transcription could silently use the English default. Decode with automatic language selection and carry the native result into
detectedLanguage; explicit language choices and English-only models reportnull.transcribe --jsonnow keeps one final result on stdout and emits typed progress JSON lines on stderr. Whisper model downloads report bytes with a nullable total, transcription reports start/completion, and slow stderr readers receive coalesced byte updates. Other diagnostics may still appear on stderr. The transcript file remains a word array, andmodelreports the resolved model.Add
--no-runtime-installto prevent Homebrew/source installation, including during automatic fallback. Model downloads remain allowed.Validation: focused test files passed individually three times with one worker; nine deliberate behavioral mutations were rejected. A native Whisper run exercised a real model download and automatic detection through the CLI. A separate doctor-to-transcribe disappearance check confirmed zero installer commands. Typecheck, lint, format, dead-code/complexity checks, and packaged CLI build passed.
Native inference was exercised on Linux. Parakeet's external MLX downloader does not expose byte progress through this interface; its transcription phase remains indeterminate.