From 1bd25c5aec8ff7b373e2271917b5a1f18f2f8d32 Mon Sep 17 00:00:00 2001 From: Naiyuan Qing <145280634+NevilleQingNY@users.noreply.github.com> Date: Mon, 9 Feb 2026 18:10:23 +0800 Subject: [PATCH] fix(media): don't cache whisper binary detection failure Only cache successful whisper binary lookups. When whisper is not found, leave the cache empty so subsequent calls re-check PATH. This allows the app to detect a newly installed whisper without requiring a restart. Co-Authored-By: Claude Opus 4.6 --- src/media/transcribe.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/media/transcribe.ts b/src/media/transcribe.ts index 84214f9a..2d410be1 100644 --- a/src/media/transcribe.ts +++ b/src/media/transcribe.ts @@ -18,8 +18,8 @@ import { execFile, execFileSync } from "node:child_process"; import { tmpdir } from "node:os"; import { credentialManager } from "../agent/credentials.js"; -/** Cached path to local whisper binary, or false if not found */ -let cachedWhisperBin: string | false | undefined; +/** Cached path to local whisper binary (only caches success; misses re-check each time) */ +let cachedWhisperBin: string | undefined; /** Find local whisper binary in PATH */ function findWhisperBin(): string | false { @@ -35,7 +35,7 @@ function findWhisperBin(): string | false { } } - cachedWhisperBin = false; + // Don't cache failure — whisper may be installed while the process is running return false; }