Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(mobile): Clean On-Device dictation with Bring Your Own Key and explain unsupported Apple Intelligence (#2538)

Chad Piha868d5726f803
diff --git a/openwhispr-mobile/src/components/settings/InferenceModePicker.tsx b/openwhispr-mobile/src/components/settings/InferenceModePicker.tsx
index 2b37bd862..e6f54e2f0 100644
--- a/openwhispr-mobile/src/components/settings/InferenceModePicker.tsx
+++ b/openwhispr-mobile/src/components/settings/InferenceModePicker.tsx
@@ -9,9 +9,11 @@ type Props = {
// null when no mode is saved and none applies, so nothing is shown as picked.
selectedMode: InferenceMode | null;
onSelect: (mode: InferenceMode) => void;
+ // Modes this phone can never run, each with the reason shown in place of its description.
+ unavailable?: Partial<Record<InferenceMode, string>>;
};
-export function InferenceModePicker({ scope, selectedMode, onSelect }: Props) {
+export function InferenceModePicker({ scope, selectedMode, onSelect, unavailable }: Props) {
const modes = getInferenceModes(scope);
return (
<SettingsSection title="Mode">
@@ -22,7 +24,8 @@ export function InferenceModePicker({ scope, selectedMode, onSelect }: Props) {
icon={opt.icon}
mdIcon={opt.mdIcon}
title={opt.title}
- description={opt.description}
+ description={unavailable?.[opt.mode] ?? opt.description}
+ disabled={!!unavailable?.[opt.mode]}
onPress={() => onSelect(opt.mode)}
selected={selectedMode === opt.mode}
rightElement={
diff --git a/openwhispr-mobile/src/components/ui/SettingsSection.tsx b/openwhispr-mobile/src/components/ui/SettingsSection.tsx
index ab3a11fc8..5ead69f58 100644
--- a/openwhispr-mobile/src/components/ui/SettingsSection.tsx
+++ b/openwhispr-mobile/src/components/ui/SettingsSection.tsx
@@ -20,6 +20,8 @@ type SettingsRowProps = {
selected?: boolean;
// Shown right after the description, such as a help button.
descriptionAccessory?: React.ReactNode;
+ // Dims the icon and title and ignores taps; the description stays legible to say why.
+ disabled?: boolean;
};
export function SettingsRow({
@@ -36,13 +38,15 @@ export function SettingsRow({
showChevron = true,
selected = false,
descriptionAccessory,
+ disabled = false,
}: SettingsRowProps) {
const isLine = iconStyle === 'line';
+ const dimmed = disabled ? 'opacity-40' : '';
return (
<Pressable
- onPress={onPress}
- disabled={!onPress && !rightElement}
- accessibilityState={{ selected }}
+ onPress={disabled ? undefined : onPress}
+ disabled={disabled || (!onPress && !rightElement)}
+ accessibilityState={{ selected, disabled }}
className={selected ? 'bg-brand/10 active:bg-brand/20' : 'active:bg-tertiarySystemFill'}
>
<View
@@ -53,7 +57,7 @@ export function SettingsRow({
}
>
{isLine ? (
- <View className="h-6 w-6 items-center justify-center">
+ <View className={`h-6 w-6 items-center justify-center ${dimmed}`}>
<SystemIcon
name={icon}
mdName={mdIcon}
@@ -73,7 +77,7 @@ export function SettingsRow({
<View className="flex-1">
<Text
numberOfLines={1}
- className={destructive ? 'text-[17px] text-systemRed' : 'text-[17px] text-label'}
+ className={`${destructive ? 'text-[17px] text-systemRed' : 'text-[17px] text-label'} ${dimmed}`}
>
{title}
</Text>
diff --git a/openwhispr-mobile/src/lib/__tests__/aiWorkflows.test.ts b/openwhispr-mobile/src/lib/__tests__/aiWorkflows.test.ts
index 66c0a6546..ed330e8dd 100644
--- a/openwhispr-mobile/src/lib/__tests__/aiWorkflows.test.ts
+++ b/openwhispr-mobile/src/lib/__tests__/aiWorkflows.test.ts
@@ -9,12 +9,21 @@ describe('workflowSummary for Text Cleanup', () => {
it.each([
['nothing saved', undefined],
['OpenWhispr Cloud', { mode: 'openwhispr' as const }],
- ['a provider', { mode: 'providers' as const, providerId: 'openai', modelId: 'gpt-5-mini' }],
])('is skipped in On-Device mode with %s saved', (_label, cleanup) => {
const saved = config({ inference: cleanup ? { cleanup } : {} });
expect(workflowSummary(saved, 'cleanup', 'private')).toBe('Skipped');
});
+ it('names the provider saved for cleanup in On-Device mode, which cleans there', () => {
+ const saved = config({
+ inference: { cleanup: { mode: 'providers', providerId: 'openai', modelId: 'gpt-5-mini' } },
+ });
+ expect(workflowSummary(saved, 'cleanup', 'private')).toBe('OpenAI');
+ expect(workflowSummary(saved, 'cleanup', 'private', { keyMissing: true })).toBe(
+ 'OpenAI · Key missing',
+ );
+ });
+
it('runs On-Device in On-Device mode when saved as On-Device', () => {
const saved = config({ inference: { cleanup: { mode: 'local' } } });
expect(workflowSummary(saved, 'cleanup', 'private')).toBe('On-Device');
diff --git a/openwhispr-mobile/src/lib/__tests__/cleanupTranscript.customPrompt.test.ts b/openwhispr-mobile/src/lib/__tests__/cleanupTranscript.customPrompt.test.ts
index 225178d91..cedf5e7bf 100644
--- a/openwhispr-mobile/src/lib/__tests__/cleanupTranscript.customPrompt.test.ts
+++ b/openwhispr-mobile/src/lib/__tests__/cleanupTranscript.customPrompt.test.ts
@@ -132,7 +132,7 @@ describe('cleanupTranscript privacy hint follows the resolved route', () => {
expect(req.routing).toBeUndefined();
});
- it('marks provider cleanup in private mode as private content', async () => {
+ it('sends provider cleanup in private mode to the provider the user saved for it', async () => {
mockActiveMode = 'private';
mockConfig = { cleanupEnabled: true, defaultMode: 'private' };
await cleanupTranscript('um hello there', {
@@ -146,6 +146,6 @@ describe('cleanupTranscript privacy hint follows the resolved route', () => {
credentialRef: 'provider.openai',
},
});
- expect(lastRequest().routing).toEqual({ isPrivateNote: true });
+ expect(lastRequest().routing).toEqual({ sendToChosenProvider: true });
});
});
diff --git a/openwhispr-mobile/src/lib/__tests__/inferenceRouting.test.ts b/openwhispr-mobile/src/lib/__tests__/inferenceRouting.test.ts
index c15a7f826..33a42412c 100644
--- a/openwhispr-mobile/src/lib/__tests__/inferenceRouting.test.ts
+++ b/openwhispr-mobile/src/lib/__tests__/inferenceRouting.test.ts
@@ -200,3 +200,44 @@ it('marks text stages unavailable, never Cloud, for BYOK dictation with no text
'Choose a voice assistant provider in AI Models. Your raw transcript is saved.',
);
});
+
+it('keeps a saved provider cleanup for an On-Device recording; everything else stays local', () => {
+ mockProcessing.activeMode = 'private';
+ mockState.config.inference = {
+ dictation: { mode: 'local' },
+ cleanup: {
+ mode: 'providers',
+ providerId: 'openai',
+ modelId: 'gpt-5-mini',
+ credentialRef: 'provider.openai',
+ },
+ agent: {
+ mode: 'providers',
+ providerId: 'openai',
+ modelId: 'gpt-5-mini',
+ credentialRef: 'provider.openai',
+ },
+ };
+ const snapshot = snapshotTranscriptionJob('dictation');
+ expect(snapshot.provider).toBe('local');
+ expect(snapshot.cleanupRoute).toMatchObject({
+ mode: 'providers',
+ scope: 'cleanup',
+ providerId: 'openai',
+ modelId: 'gpt-5-mini',
+ });
+ expect(snapshot.agentRoute).toEqual({ mode: 'local', scope: 'agent' });
+ expect(snapshot.cleanupUnavailable).toBeUndefined();
+});
+
+it.each([
+ ['OpenWhispr Cloud', { mode: 'openwhispr' }],
+ ['nothing', undefined],
+])('keeps cleanup On-Device for an On-Device recording with %s saved', (_label, cleanup) => {
+ mockProcessing.activeMode = 'private';
+ mockState.config.inference = { dictation: { mode: 'local' }, ...(cleanup ? { cleanup } : {}) };
+ expect(snapshotTranscriptionJob('dictation').cleanupRoute).toEqual({
+ mode: 'local',
+ scope: 'cleanup',
+ });
+});
diff --git a/openwhispr-mobile/src/lib/__tests__/localReasoning.test.ts b/openwhispr-mobile/src/lib/__tests__/localReasoning.test.ts
index 32c035b5a..a9d0f47cc 100644
--- a/openwhispr-mobile/src/lib/__tests__/localReasoning.test.ts
+++ b/openwhispr-mobile/src/lib/__tests__/localReasoning.test.ts
@@ -27,6 +27,7 @@ import {
clearLocalReasoningReadinessCache,
getLocalReasoningReadiness,
getLocalReasoningUnavailableMessage,
+ isLocalReasoningUnsupported,
shouldUseLocalReasoning,
} from '../localReasoning';
import { AppleLLM } from '@/lib/appleLLM';
@@ -102,3 +103,35 @@ it('explains Apple Intelligence being off without assuming the request is a note
expect(message).toContain('Apple Intelligence is turned off');
expect(message).not.toMatch(/note/i);
});
+
+it.each([
+ ['deviceNotEligible', 'unsupportedDevice'],
+ ['unsupportedOS', 'unsupportedOS'],
+])(
+ 'reports an iPhone that cannot run Apple Intelligence (%s) as unsupported',
+ async (native, status) => {
+ mockAppleAvailability.mockResolvedValue({ status: native, tokenCounting: false });
+
+ const readiness = await getLocalReasoningReadiness();
+
+ expect(readiness.status).toBe(status);
+ expect(isLocalReasoningUnsupported(readiness)).toBe(true);
+ },
+);
+
+it.each(['ready', 'disabled', 'appleIntelligenceOff', 'modelNotReady', 'unavailable'] as const)(
+ 'does not treat %s as an unsupported iPhone, since it can change',
+ (status) => {
+ expect(isLocalReasoningUnsupported({ status, tokenCounting: false })).toBe(false);
+ },
+);
+
+it.each([
+ [
+ 'unsupportedDevice',
+ 'On-Device AI needs an iPhone with Apple Intelligence (iPhone 15 Pro or later).',
+ ],
+ ['unsupportedOS', 'On-Device AI needs iOS 26 or later on an iPhone with Apple Intelligence.'],
+] as const)('says what an unsupported iPhone needs (%s)', (status, message) => {
+ expect(getLocalReasoningUnavailableMessage({ status, tokenCounting: false })).toBe(message);
+});
diff --git a/openwhispr-mobile/src/lib/__tests__/transcribeAndCleanup.onDeviceCleanup.test.ts b/openwhispr-mobile/src/lib/__tests__/transcribeAndCleanup.onDeviceCleanup.test.ts
index 711b471bb..bdc74ba39 100644
--- a/openwhispr-mobile/src/lib/__tests__/transcribeAndCleanup.onDeviceCleanup.test.ts
+++ b/openwhispr-mobile/src/lib/__tests__/transcribeAndCleanup.onDeviceCleanup.test.ts
@@ -1,7 +1,7 @@
/**
- * A transcript made on this phone is cleaned only when the user chose On-Device
- * cleanup, and then only by Apple Intelligence on this phone. Any other cleanup
- * choice would send it off the device, so the raw transcript is kept.
+ * A transcript made on this phone is cleaned by Apple Intelligence when the user chose
+ * On-Device cleanup, or by the provider they saved for cleanup with their own key. Cloud
+ * or no choice would send it off the device unasked, so the raw transcript is kept.
*/
import { TranscriptionService } from '@/services/transcription/TranscriptionService';
import { transcribeAndCleanup } from '@/lib/transcribeAndCleanup';
@@ -124,9 +124,39 @@ it('cleans an On-Device upload on this phone outside On-Device mode too', async
expect(result.text).toBe('cleaned:um hello there');
});
+it('cleans an On-Device transcript with the provider saved for cleanup', async () => {
+ mockConfig = {
+ cleanupEnabled: true,
+ defaultMode: 'private',
+ inference: {
+ dictation: { mode: 'local' },
+ cleanup: {
+ mode: 'providers',
+ providerId: 'openai',
+ modelId: 'gpt-5-mini',
+ credentialRef: 'provider.openai',
+ },
+ },
+ };
+
+ const result = await transcribeOnDevice();
+
+ expect(mockReason).toHaveBeenCalledTimes(1);
+ const req = mockReason.mock.calls[0][0] as Record<string, unknown>;
+ expect(req.inferenceRoute).toMatchObject({
+ mode: 'providers',
+ scope: 'cleanup',
+ providerId: 'openai',
+ modelId: 'gpt-5-mini',
+ });
+ expect(req.routing).toEqual({ sendToChosenProvider: true });
+ expect(mockReadiness).not.toHaveBeenCalled();
+ expect(result.text).toBe('cleaned:um hello there');
+ expect(result.cleanupApplied).toBe(true);
+});
+
it.each([
['OpenWhispr Cloud', { mode: 'openwhispr' }],
- ['a provider', { mode: 'providers', providerId: 'openai', modelId: 'gpt-5-mini' }],
['nothing saved', undefined],
])('keeps an On-Device transcript raw when cleanup is set to %s', async (_label, cleanup) => {
mockConfig = {
diff --git a/openwhispr-mobile/src/lib/aiWorkflows.ts b/openwhispr-mobile/src/lib/aiWorkflows.ts
index 4203fca54..d806dfc56 100644
--- a/openwhispr-mobile/src/lib/aiWorkflows.ts
+++ b/openwhispr-mobile/src/lib/aiWorkflows.ts
@@ -21,9 +21,14 @@ export const UNSET_PROVIDER_NOTES: Partial<Record<MobileInferenceScope, string>>
'Not saved yet. The voice assistant is skipped until you save a selection; note chat uses OpenWhispr Cloud.',
};
-// On-Device mode skips cleanup until On-Device is saved for it, so the unset page picks nothing.
+// On-Device mode skips cleanup until On-Device or a provider is saved for it, so the unset
+// page picks nothing.
export const UNSET_ON_DEVICE_CLEANUP_NOTE =
- 'Not saved yet. On-Device mode skips cleanup until you choose On-Device.';
+ 'Not saved yet. On-Device mode skips cleanup until you choose On-Device or Bring Your Own Key.';
+
+// The same, on an iPhone that can never run On-Device cleanup.
+export const UNSET_UNSUPPORTED_CLEANUP_NOTE =
+ "Not saved yet. This iPhone can't run On-Device cleanup, so On-Device mode skips it until you choose Bring Your Own Key.";
// What On-Device mode means for each workflow other than dictation.
export const ON_DEVICE_MODE_NOTES: Partial<Record<MobileInferenceScope, string>> = {
@@ -32,17 +37,23 @@ export const ON_DEVICE_MODE_NOTES: Partial<Record<MobileInferenceScope, string>>
notes:
'On-Device mode formats notes on this iPhone and asks before sending one to your choice here.',
cleanup:
- 'On-Device cleanup runs on this iPhone. Any other choice is skipped until dictation leaves On-Device, so the transcript never leaves this phone.',
+ 'In On-Device mode, cleanup runs on this iPhone, or sends only the transcript text to your provider with Bring Your Own Key. OpenWhispr Cloud cleanup is skipped until dictation leaves On-Device.',
agent:
'In On-Device mode the voice assistant is off, and note chat asks before sending a note off this iPhone.',
};
-// A local transcript is cleaned only when cleanup is saved as On-Device; unset or any
-// other choice would take it off the phone, so it stays raw.
+// A local transcript is cleaned on the phone when cleanup is saved as On-Device.
export function cleanupSavedOnDevice(config: UserConfig | null): boolean {
return config?.inference?.cleanup?.mode === 'local';
}
+// A local transcript is also cleaned by a provider saved for cleanup, which is the user's
+// consent to send it the text; unset or Cloud would take it off the phone unasked.
+export function cleansLocalTranscripts(config: UserConfig | null): boolean {
+ const mode = config?.inference?.cleanup?.mode;
+ return mode === 'local' || mode === 'providers';
+}
+
export function parseWorkflow(value: unknown): MobileInferenceScope | null {
return WORKFLOWS.find((scope) => scope === value) ?? null;
}
@@ -80,17 +91,18 @@ export function workflowSummary(
return `${MODE_LABELS.local} · ${onDeviceUnavailable}`;
}
// On-Device mode runs everything on this phone first, whatever is saved. Cleanup runs
- // only when set to On-Device, and only note chat set to OpenWhispr, or not set, goes
- // straight to Cloud.
+ // only when set to On-Device or a provider, and only note chat set to OpenWhispr, or
+ // not set, goes straight to Cloud.
if (activeMode === 'private') {
- if (scope === 'cleanup' && !cleanupSavedOnDevice(config)) return 'Skipped';
+ if (scope === 'cleanup' && !cleansLocalTranscripts(config)) return 'Skipped';
const chatOnCloud = (config?.inference?.agent?.mode ?? 'openwhispr') === 'openwhispr';
if (scope === 'agent' && chatOnCloud) return MODE_LABELS.openwhispr;
}
const selection = config?.inference?.[scope] ?? unsetSelection(scope, activeMode);
if (selection.mode === 'local' && isLocalModelKey(selection.modelId))
return LOCAL_MODEL_TITLES[selection.modelId];
- if (activeMode === 'private') return MODE_LABELS.local;
+ if (activeMode === 'private' && !(scope === 'cleanup' && selection.mode === 'providers'))
+ return MODE_LABELS.local;
if (selection.mode !== 'providers') return MODE_LABELS[selection.mode];
if (!selection.providerId) return 'Not set';
const name = providerDisplayName(selection.providerId);
diff --git a/openwhispr-mobile/src/lib/cleanupTranscript.ts b/openwhispr-mobile/src/lib/cleanupTranscript.ts
index cabbe7002..abc012e0e 100644
--- a/openwhispr-mobile/src/lib/cleanupTranscript.ts
+++ b/openwhispr-mobile/src/lib/cleanupTranscript.ts
@@ -155,11 +155,15 @@ export async function cleanupTranscript(
// either the user's choice or a Cloud fallback they just consented to while
// still in private mode; hinting it would make ReasoningService demand local
// reasoning and fail the cleanup. ReasoningService re-checks private mode for
- // provider and local routes on its own.
+ // provider and local routes on its own. A cleanup provider route only ever
+ // comes from the provider the user saved for cleanup, so it is sent there even
+ // in On-Device mode.
const routing =
- inferenceRoute.mode === 'providers' || inferenceRoute.mode === 'local'
- ? { isPrivateNote: useProcessingModeStore.getState().activeMode === 'private' }
- : undefined;
+ inferenceRoute.mode === 'providers' && scope === 'cleanup'
+ ? { sendToChosenProvider: true }
+ : inferenceRoute.mode === 'providers' || inferenceRoute.mode === 'local'
+ ? { isPrivateNote: useProcessingModeStore.getState().activeMode === 'private' }
+ : undefined;
// A custom prompt goes out with promptMode "cleanup", which turns off the
// server's agent-name detection that the dictation agent relies on. When our
diff --git a/openwhispr-mobile/src/lib/inferenceRouting.ts b/openwhispr-mobile/src/lib/inferenceRouting.ts
index 77d9295fb..3033f0d5b 100644
--- a/openwhispr-mobile/src/lib/inferenceRouting.ts
+++ b/openwhispr-mobile/src/lib/inferenceRouting.ts
@@ -98,7 +98,8 @@ export function snapshotTextInference(provider: TranscriptionProvider): TextInfe
const routeKey = scope === 'cleanup' ? 'cleanupRoute' : 'agentRoute';
const errorKey = scope === 'cleanup' ? 'cleanupUnavailable' : 'agentUnavailable';
const selection = getInferenceSelection(scope);
- if (provider === 'local') {
+ // A local transcript leaves the phone only for a cleanup provider the user saved.
+ if (provider === 'local' && !(scope === 'cleanup' && selection?.mode === 'providers')) {
result[routeKey] = { mode: 'local', scope };
} else if (!selection && provider === 'byok') {
result[errorKey] =
diff --git a/openwhispr-mobile/src/lib/localReasoning.ts b/openwhispr-mobile/src/lib/localReasoning.ts
index 8c0f69c9b..d5117e481 100644
--- a/openwhispr-mobile/src/lib/localReasoning.ts
+++ b/openwhispr-mobile/src/lib/localReasoning.ts
@@ -65,6 +65,10 @@ export async function getLocalReasoningReadiness(options?: {
contextSize: availability.contextSize,
tokenCounting: availability.tokenCounting === true,
};
+ case 'deviceNotEligible':
+ return { status: 'unsupportedDevice', tokenCounting: false };
+ case 'unsupportedOS':
+ return { status: 'unsupportedOS', tokenCounting: false };
default:
return {
status: 'unavailable',
@@ -171,8 +175,17 @@ export async function fitsLocalReasoningBudget(input: {
return count < budget;
}
+// Unlike Apple Intelligence being off or still downloading, nothing in Settings fixes these.
+export function isLocalReasoningUnsupported(readiness?: LocalReasoningReadiness | null): boolean {
+ return readiness?.status === 'unsupportedDevice' || readiness?.status === 'unsupportedOS';
+}
+
export function getLocalReasoningUnavailableMessage(readiness?: LocalReasoningReadiness): string {
switch (readiness?.status) {
+ case 'unsupportedDevice':
+ return 'On-Device AI needs an iPhone with Apple Intelligence (iPhone 15 Pro or later).';
+ case 'unsupportedOS':
+ return 'On-Device AI needs iOS 26 or later on an iPhone with Apple Intelligence.';
case 'disabled':
return 'Local Apple Intelligence is turned off in AI Models.';
case 'appleIntelligenceOff':
diff --git a/openwhispr-mobile/src/lib/transcribeAndCleanup.ts b/openwhispr-mobile/src/lib/transcribeAndCleanup.ts
index d9c93b1c9..1a4f89af0 100644
--- a/openwhispr-mobile/src/lib/transcribeAndCleanup.ts
+++ b/openwhispr-mobile/src/lib/transcribeAndCleanup.ts
@@ -49,7 +49,7 @@ export interface DictationProcessingResult {
}
// The transcript before any cleanup pass: returned for local/private transcripts
-// that On-Device cleanup won't clean, and when a cancel short-circuits cleanup.
+// that no chosen cleanup will clean, and when a cancel short-circuits cleanup.
function rawTranscriptResult(transcription: TranscriptionResponse): DictationProcessingResult {
const originalText = transcription.originalText || transcription.text;
return {
@@ -61,9 +61,11 @@ function rawTranscriptResult(transcription: TranscriptionResponse): DictationPro
};
}
-// The pinned route decides where cleanup runs, and a local job always pins a local one;
-// the saved choice decides whether it runs, read live like cleanupEnabled.
-function cleansOnDevice(request: TranscriptionRequest): boolean {
+// The pinned route decides where cleanup runs. A local job pins a local one unless the
+// user saved a cleanup provider, which is only pinned from that saved choice; whether
+// On-Device cleanup runs is read live, like cleanupEnabled.
+function cleansLocalTranscript(request: TranscriptionRequest): boolean {
+ if (request.cleanupRoute?.mode === 'providers') return true;
return (
request.cleanupRoute?.mode === 'local' && cleanupSavedOnDevice(useConfigStore.getState().config)
);
@@ -185,9 +187,9 @@ async function runSerialTranscribeAndCleanup(
const originalText = transcription.text;
lifecycle.onRawTranscript?.(originalText, transcription);
- // Local/private transcripts must never leave the device — not even for the
- // cleanup pass — so they are cleaned only by On-Device cleanup.
- if (transcription.provider === 'local' && !cleansOnDevice(request)) {
+ // Local/private transcripts leave the device only for the cleanup provider the
+ // user saved; otherwise they are cleaned by On-Device cleanup or not at all.
+ if (transcription.provider === 'local' && !cleansLocalTranscript(request)) {
return rawTranscriptResult(transcription);
}
diff --git a/openwhispr-mobile/src/screens/AIModelsScreen.tsx b/openwhispr-mobile/src/screens/AIModelsScreen.tsx
index fc96a451e..f127e0d47 100644
--- a/openwhispr-mobile/src/screens/AIModelsScreen.tsx
+++ b/openwhispr-mobile/src/screens/AIModelsScreen.tsx
@@ -44,6 +44,10 @@ function localReasoningStatusLabel(readiness: LocalReasoningReadiness | null): s
return 'Model not ready';
case 'unavailable':
return 'Not eligible';
+ case 'unsupportedDevice':
+ return 'Not supported on this iPhone';
+ case 'unsupportedOS':
+ return 'Needs iOS 26';
default:
return 'Checking...';
}
diff --git a/openwhispr-mobile/src/screens/CleanupPromptScreen.tsx b/openwhispr-mobile/src/screens/CleanupPromptScreen.tsx
index baad2f9d6..fed31440b 100644
--- a/openwhispr-mobile/src/screens/CleanupPromptScreen.tsx
+++ b/openwhispr-mobile/src/screens/CleanupPromptScreen.tsx
@@ -36,12 +36,12 @@ export default function CleanupPromptScreen() {
const baseline = override ?? DEFAULT_CLEANUP_PROMPT;
const [draft, setDraft] = useState(baseline);
- // On-Device transcripts are cleaned only by On-Device cleanup, and Bring Your Own Key
- // skips cleanup until it has a selection.
+ // On-Device transcripts are cleaned only by On-Device cleanup or a saved provider, and
+ // Bring Your Own Key skips cleanup until it has a selection.
const inactiveNotice = !cleanupEnabled
? 'Text Cleanup is off. Your prompt is saved and applies once you turn it on.'
- : activeMode === 'private' && cleanupMode !== 'local'
- ? 'On-Device mode skips cleanup unless it is set to On-Device. Your prompt is saved and applies when it runs.'
+ : activeMode === 'private' && cleanupMode !== 'local' && cleanupMode !== 'providers'
+ ? 'On-Device mode skips cleanup unless it is set to On-Device or Bring Your Own Key. Your prompt is saved and applies when it runs.'
: activeMode === 'providers' && !cleanupMode
? 'Bring Your Own Key skips cleanup until Text Cleanup has a selection. Your prompt is saved and applies once it does.'
: null;
diff --git a/openwhispr-mobile/src/screens/WorkflowSettingsScreen.tsx b/openwhispr-mobile/src/screens/WorkflowSettingsScreen.tsx
index 50baefc57..6cb7cd2bf 100644
--- a/openwhispr-mobile/src/screens/WorkflowSettingsScreen.tsx
+++ b/openwhispr-mobile/src/screens/WorkflowSettingsScreen.tsx
@@ -34,6 +34,7 @@ import { InferenceModePicker } from '@/components/settings/InferenceModePicker';
import {
ON_DEVICE_MODE_NOTES,
UNSET_ON_DEVICE_CLEANUP_NOTE,
+ UNSET_UNSUPPORTED_CLEANUP_NOTE,
UNSET_PROVIDER_NOTES,
WORKFLOW_LABELS,
WORKFLOWS,
@@ -45,6 +46,11 @@ import { getDictationAgentName, isDictationAgentEnabled } from '@/lib/dictationA
import { SystemIcon, type LucideIconName } from '@/components/ui/SystemIcon';
import { switchWorkflowMode } from '@/lib/workflowModeSwitch';
import { getPrivateModeReadiness } from '@/lib/privateMode';
+import {
+ getLocalReasoningReadiness,
+ getLocalReasoningUnavailableMessage,
+ isLocalReasoningUnsupported,
+} from '@/lib/localReasoning';
import {
discoverProviderModels,
testProviderConnection,
@@ -267,8 +273,32 @@ function WorkflowSettings({ scope }: { scope: MobileInferenceScope }): React.JSX
const models = provider?.models.length ? provider.models : discoveredModels;
const shownMode =
cleanupUnsaved && selection.mode === savedSelection.mode ? null : selection.mode;
+ const speechScope = scope === 'dictation' || scope === 'upload' ? scope : null;
+ // On-Device text workflows run on Apple Intelligence, which some iPhones can never run.
+ const [onDeviceUnsupported, setOnDeviceUnsupported] = useState<string | null>(null);
+ useEffect(() => {
+ if (speechScope) return undefined;
+ let cancelled = false;
+ getLocalReasoningReadiness()
+ .then((readiness) => {
+ if (cancelled) return;
+ setOnDeviceUnsupported(
+ isLocalReasoningUnsupported(readiness)
+ ? getLocalReasoningUnavailableMessage(readiness)
+ : null,
+ );
+ })
+ .catch(() => undefined);
+ return (): void => {
+ cancelled = true;
+ };
+ }, [speechScope]);
const modeNote =
- (shownMode === null ? UNSET_ON_DEVICE_CLEANUP_NOTE : undefined) ??
+ (shownMode === null
+ ? onDeviceUnsupported
+ ? UNSET_UNSUPPORTED_CLEANUP_NOTE
+ : UNSET_ON_DEVICE_CLEANUP_NOTE
+ : undefined) ??
(activeMode === 'private' ? ON_DEVICE_MODE_NOTES[scope] : undefined) ??
(activeMode === 'providers' && !config?.inference?.[scope]
? UNSET_PROVIDER_NOTES[scope]
@@ -276,7 +306,6 @@ function WorkflowSettings({ scope }: { scope: MobileInferenceScope }): React.JSX
(selection.mode === 'providers' && savedSelection.mode !== 'providers'
? 'Save to switch to Bring Your Own Key.'
: undefined);
- const speechScope = scope === 'dictation' || scope === 'upload' ? scope : null;
// Keys are stored per provider (per server for Custom), so every workflow on it shares one.
const keyOwner =
provider?.id === 'custom' ? 'this server' : providerDisplayName(provider?.id ?? '');
@@ -658,6 +687,7 @@ function WorkflowSettings({ scope }: { scope: MobileInferenceScope }): React.JSX
scope={speechScope ? 'speech' : 'text'}
selectedMode={shownMode}
onSelect={chooseMode}
+ unavailable={onDeviceUnsupported ? { local: onDeviceUnsupported } : undefined}
/>
{modeNote ? <SectionFooter>{modeNote}</SectionFooter> : null}
{selection.mode === 'local' && speechScope ? (
diff --git a/openwhispr-mobile/src/screens/__tests__/AIModelsScreen.test.tsx b/openwhispr-mobile/src/screens/__tests__/AIModelsScreen.test.tsx
index cf77f2cc5..acf965da5 100644
--- a/openwhispr-mobile/src/screens/__tests__/AIModelsScreen.test.tsx
+++ b/openwhispr-mobile/src/screens/__tests__/AIModelsScreen.test.tsx
@@ -140,18 +140,26 @@ it('shows what each workflow really does while On-Device mode is on', async () =
await screen.findByText(/Status: Ready/);
});
-it.each([
- ['nothing saved', undefined],
- ['a provider', { mode: 'providers', providerId: 'openai', modelId: 'gpt-5-mini' }],
-])('shows cleanup as skipped in On-Device mode with %s', async (_label, cleanup) => {
+it('shows cleanup as skipped in On-Device mode with nothing saved', async () => {
+ mockActiveMode = 'private';
+ mockConfig = { defaultMode: 'private', inference: { dictation: { mode: 'local' } } };
+ render(<AIModelsScreen />);
+ expect(screen.getByText('Skipped')).toBeTruthy();
+ await screen.findByText(/Status: Ready/);
+});
+
+it('names the cleanup provider in On-Device mode, which cleans On-Device transcripts', async () => {
mockActiveMode = 'private';
mockConfig = {
defaultMode: 'private',
- inference: { dictation: { mode: 'local' }, ...(cleanup ? { cleanup } : {}) },
+ inference: {
+ dictation: { mode: 'local' },
+ cleanup: { mode: 'providers', providerId: 'openai', modelId: 'gpt-5-mini' },
+ },
};
render(<AIModelsScreen />);
- expect(screen.getByText('Skipped')).toBeTruthy();
- expect(screen.queryByText('OpenAI')).toBeNull();
+ expect(screen.queryByText('Skipped')).toBeNull();
+ expect(screen.getByText('OpenAI')).toBeTruthy();
await screen.findByText(/Status: Ready/);
});
@@ -211,3 +219,12 @@ it('flags a provider workflow whose key was removed', async () => {
mockCredentialListener?.();
expect(await screen.findByText('Groq · Key missing')).toBeTruthy();
});
+
+it.each([
+ ['unsupportedDevice', 'Not supported on this iPhone'],
+ ['unsupportedOS', 'Needs iOS 26'],
+])('says when this iPhone cannot run Apple Intelligence (%s)', async (status, label) => {
+ mockReadiness.mockResolvedValue({ status, tokenCounting: false });
+ render(<AIModelsScreen />);
+ expect(await screen.findByText(new RegExp(`Status: ${label}\\.`))).toBeTruthy();
+});
diff --git a/openwhispr-mobile/src/screens/__tests__/CleanupPromptScreen.test.tsx b/openwhispr-mobile/src/screens/__tests__/CleanupPromptScreen.test.tsx
index 82c1848aa..d9418214b 100644
--- a/openwhispr-mobile/src/screens/__tests__/CleanupPromptScreen.test.tsx
+++ b/openwhispr-mobile/src/screens/__tests__/CleanupPromptScreen.test.tsx
@@ -96,10 +96,23 @@ describe('CleanupPromptScreen — guidance', () => {
mockActiveMode = 'private';
render(<CleanupPromptScreen />);
expect(
- screen.getByText(/On-Device mode skips cleanup unless it is set to On-Device/),
+ screen.getByText(
+ /On-Device mode skips cleanup unless it is set to On-Device or Bring Your Own Key/,
+ ),
).toBeTruthy();
});
+ it('treats provider cleanup in On-Device mode as using the prompt', () => {
+ mockActiveMode = 'private';
+ mockConfig = {
+ defaultMode: 'private',
+ cleanupEnabled: true,
+ inference: { cleanup: { mode: 'providers', providerId: 'openai', modelId: 'gpt-5-mini' } },
+ };
+ render(<CleanupPromptScreen />);
+ expect(screen.queryByText(NOTICE)).not.toBeOnTheScreen();
+ });
+
it('treats On-Device cleanup in On-Device mode as using the prompt', () => {
mockActiveMode = 'private';
mockConfig = {
diff --git a/openwhispr-mobile/src/screens/__tests__/WorkflowSettingsScreen.test.tsx b/openwhispr-mobile/src/screens/__tests__/WorkflowSettingsScreen.test.tsx
index 1140ccaf9..63ff258d8 100644
--- a/openwhispr-mobile/src/screens/__tests__/WorkflowSettingsScreen.test.tsx
+++ b/openwhispr-mobile/src/screens/__tests__/WorkflowSettingsScreen.test.tsx
@@ -33,6 +33,11 @@ jest.mock('expo-router', () => ({
mockFocusEffect = effect;
},
}));
+const mockLocalReadiness = jest.fn();
+jest.mock('@/lib/localReasoning', () => ({
+ ...jest.requireActual('@/lib/localReasoning'),
+ getLocalReasoningReadiness: (...args: unknown[]) => mockLocalReadiness(...args),
+}));
jest.mock('@/lib/privateMode', () => ({
getPrivateModeReadiness: () => mockPrivateReadiness(),
}));
@@ -135,6 +140,7 @@ beforeEach(() => {
return 'switched';
});
mockPrivateReadiness.mockResolvedValue({ status: 'missing', modelName: 'Parakeet v2' });
+ mockLocalReadiness.mockResolvedValue({ status: 'ready', tokenCounting: true });
mockActiveMode = 'cloud';
mockPolicy.mockResolvedValue({ status: 'unmanaged' });
mockTestConnection.mockResolvedValue({ ok: true, verification: 'catalog-only' });
@@ -443,7 +449,9 @@ it('shows no cleanup mode for a private-mode user who has not saved one, since c
render(<WorkflowSettingsScreen />);
expect(selectedMode()).toBeUndefined();
expect(
- screen.getByText('Not saved yet. On-Device mode skips cleanup until you choose On-Device.'),
+ screen.getByText(
+ 'Not saved yet. On-Device mode skips cleanup until you choose On-Device or Bring Your Own Key.',
+ ),
).toBeTruthy();
expect(screen.queryByText('Runs on Apple Intelligence on this iPhone.')).toBeNull();
});
@@ -789,7 +797,7 @@ it('explains that On-Device mode skips a saved Cloud cleanup choice', () => {
expect(selectedMode()).toBe('OpenWhispr Cloud');
expect(
screen.getByText(
- 'On-Device cleanup runs on this iPhone. Any other choice is skipped until dictation leaves On-Device, so the transcript never leaves this phone.',
+ 'In On-Device mode, cleanup runs on this iPhone, or sends only the transcript text to your provider with Bring Your Own Key. OpenWhispr Cloud cleanup is skipped until dictation leaves On-Device.',
),
).toBeTruthy();
});
@@ -1036,3 +1044,62 @@ describe('a custom server reached under /v1', () => {
expect(mockUpdateConfig.mock.calls[0][0].inference.dictation.credentialRef).toBeUndefined();
});
});
+
+function modeRow(title: string): { props: { accessibilityState?: Record<string, unknown> } } {
+ let row = screen.getByText(title).parent;
+ while (row && !row.props.accessibilityState) row = row.parent;
+ if (!row) throw new Error(`No row for ${title}`);
+ return row;
+}
+
+describe('an iPhone that cannot run Apple Intelligence', () => {
+ const NEEDS = 'On-Device AI needs an iPhone with Apple Intelligence (iPhone 15 Pro or later).';
+
+ beforeEach(() => {
+ mockLocalReadiness.mockResolvedValue({ status: 'unsupportedDevice', tokenCounting: false });
+ });
+
+ it.each(['cleanup', 'notes', 'agent'])(
+ 'disables On-Device for %s and says what it needs',
+ async (scope) => {
+ mockScope = scope;
+ render(<WorkflowSettingsScreen />);
+
+ expect(await screen.findByText(NEEDS)).toBeTruthy();
+ expect(modeRow('On-Device').props.accessibilityState?.disabled).toBe(true);
+ fireEvent.press(screen.getByText('On-Device'));
+ expect(mockSwitchMode).not.toHaveBeenCalled();
+ },
+ );
+
+ it('keeps On-Device dictation, which runs its own speech model', async () => {
+ mockScope = 'dictation';
+ render(<WorkflowSettingsScreen />);
+
+ await act(async () => {});
+ expect(screen.queryByText(NEEDS)).not.toBeOnTheScreen();
+ expect(modeRow('On-Device').props.accessibilityState?.disabled).toBeFalsy();
+ });
+
+ it('keeps On-Device available while Apple Intelligence is only turned off', async () => {
+ mockLocalReadiness.mockResolvedValue({ status: 'appleIntelligenceOff', tokenCounting: false });
+ mockScope = 'cleanup';
+ render(<WorkflowSettingsScreen />);
+
+ await act(async () => {});
+ expect(modeRow('On-Device').props.accessibilityState?.disabled).toBeFalsy();
+ });
+
+ it('points an unsaved On-Device-mode cleanup at Bring Your Own Key', async () => {
+ mockActiveMode = 'private';
+ mockConfig = { defaultMode: 'private', inference: {} };
+ mockScope = 'cleanup';
+ render(<WorkflowSettingsScreen />);
+
+ expect(
+ await screen.findByText(
+ "Not saved yet. This iPhone can't run On-Device cleanup, so On-Device mode skips it until you choose Bring Your Own Key.",
+ ),
+ ).toBeTruthy();
+ });
+});
diff --git a/openwhispr-mobile/src/services/reasoning/ReasoningService.ts b/openwhispr-mobile/src/services/reasoning/ReasoningService.ts
index e27fc5703..90cd3bff7 100644
--- a/openwhispr-mobile/src/services/reasoning/ReasoningService.ts
+++ b/openwhispr-mobile/src/services/reasoning/ReasoningService.ts
@@ -137,8 +137,9 @@ export class ReasoningService {
const usesProviders = selection?.mode === 'providers';
const localSelected = selection?.mode === 'local';
const allowCloudFallback = routing?.allowCloudFallback === true;
- let privateContent = routing?.isPrivateNote === true;
- if (usesProviders || localSelected) {
+ const chosenProvider = usesProviders && routing?.sendToChosenProvider === true;
+ let privateContent = !chosenProvider && routing?.isPrivateNote === true;
+ if ((usesProviders && !chosenProvider) || localSelected) {
const { useProcessingModeStore } =
require('@/store/useProcessingModeStore') as typeof import('@/store/useProcessingModeStore');
privateContent ||= useProcessingModeStore.getState().activeMode === 'private';
@@ -205,7 +206,7 @@ export class ReasoningService {
scope,
selection,
privateContent,
- allowCloudFallback,
+ allowCloudFallback || chosenProvider,
);
const { processProviderText } =
require('@/services/providers/ProviderExecution') as typeof import('@/services/providers/ProviderExecution');
diff --git a/openwhispr-mobile/src/services/reasoning/__tests__/ReasoningService.byok.test.ts b/openwhispr-mobile/src/services/reasoning/__tests__/ReasoningService.byok.test.ts
index a63ed6c3a..d1dafb624 100644
--- a/openwhispr-mobile/src/services/reasoning/__tests__/ReasoningService.byok.test.ts
+++ b/openwhispr-mobile/src/services/reasoning/__tests__/ReasoningService.byok.test.ts
@@ -99,6 +99,34 @@ it('honors private mode even for hint-less BYOK cleanup', async () => {
expect(api.post).not.toHaveBeenCalled();
});
+it('sends On-Device mode text to the provider the user chose for the workflow', async () => {
+ jest
+ .mocked(useProcessingModeStore.getState)
+ .mockReturnValue({ activeMode: 'private' } as ReturnType<
+ typeof useProcessingModeStore.getState
+ >);
+ await expect(
+ ReasoningService.processText({ text: 'um result', routing: { sendToChosenProvider: true } }),
+ ).resolves.toEqual({ text: 'Clean result.', model: 'gpt-4o-mini' });
+ expect(resolveMobileProviderRoute).toHaveBeenCalledWith('cleanup', route, false, true);
+ expect(processProviderText).toHaveBeenCalledTimes(1);
+ expect(api.post).not.toHaveBeenCalled();
+});
+
+it('ignores a chosen-provider permission on a route that is not a provider', async () => {
+ jest
+ .mocked(useProcessingModeStore.getState)
+ .mockReturnValue({ activeMode: 'private' } as ReturnType<
+ typeof useProcessingModeStore.getState
+ >);
+ jest.mocked(getInferenceSelection).mockReturnValue({ mode: 'local' });
+ await expect(
+ ReasoningService.processText({ text: 'private', routing: { sendToChosenProvider: true } }),
+ ).rejects.toThrow();
+ expect(processProviderText).not.toHaveBeenCalled();
+ expect(api.post).not.toHaveBeenCalled();
+});
+
it('passes explicit one-request remote permission to the provider route resolver', async () => {
await ReasoningService.processText({
text: 'private',
diff --git a/openwhispr-mobile/src/types/index.ts b/openwhispr-mobile/src/types/index.ts
index ec17e44ef..e5b29c773 100644
--- a/openwhispr-mobile/src/types/index.ts
+++ b/openwhispr-mobile/src/types/index.ts
@@ -122,12 +122,18 @@ export interface ReasoningResponse {
export interface ReasoningRoutingOptions {
isPrivateNote?: boolean;
allowCloudFallback?: boolean;
+ // The provider route is the one the user saved for this workflow, which is their
+ // consent to send it this content, even in On-Device mode.
+ sendToChosenProvider?: boolean;
}
export type LocalReasoningStatus =
| 'ready'
| 'disabled'
| 'unavailable'
+ // This iPhone can never run Apple Intelligence, or not on its iOS version.
+ | 'unsupportedDevice'
+ | 'unsupportedOS'
| 'appleIntelligenceOff'
| 'modelNotReady';