feat(mobile): transcribe voice input through the Kilo gateway - #6032
Open
iscekic wants to merge 7 commits into
Open
feat(mobile): transcribe voice input through the Kilo gateway#6032iscekic wants to merge 7 commits into
iscekic wants to merge 7 commits into
Conversation
iscekic
marked this pull request as draft
September 10, 2026 00:43
iscekic
added a commit
that referenced
this pull request
Sep 10, 2026
iscekic
force-pushed
the
kwf/support-transcribing-voice-i-6a1b
branch
from
September 10, 2026 01:31
54d7121 to
d82ce82
Compare
iscekic
added a commit
that referenced
this pull request
Sep 10, 2026
iscekic
force-pushed
the
kwf/support-transcribing-voice-i-6a1b
branch
from
September 10, 2026 03:10
d82ce82 to
34a38ad
Compare
iscekic
added a commit
that referenced
this pull request
Sep 10, 2026
iscekic
force-pushed
the
kwf/support-transcribing-voice-i-6a1b
branch
from
September 10, 2026 05:16
34a38ad to
8ddd98a
Compare
iscekic
marked this pull request as ready for review
September 10, 2026 05:27
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Incremental review of the changes since Files Reviewed (18 files)
Previous Review Summaries (2 snapshots, latest commit 4a9ff31)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 4a9ff31)Status: No Issues Found | Recommendation: Merge Files Reviewed (38 files)
Previous review (commit 8ddd98a)Status: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (24 files)
Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
iscekic
marked this pull request as draft
September 10, 2026 05:54
iscekic
force-pushed
the
kwf/support-transcribing-voice-i-6a1b
branch
from
September 10, 2026 11:48
f202d33 to
4a9ff31
Compare
iscekic
marked this pull request as ready for review
September 10, 2026 12:03
Replace the primary/fallback dispatcher with a selector. The gateway switch now chooses the only engine that runs: off is the OS recogniser, on is the Kilo gateway. No engine ever hands a session to the other. - Default the gateway model to the first catalogue entry when the user has not stored a choice. - Drop the "Use as primary" preference, the engine-fell-back event, the both-engines copy, and the transcribing hand-off tone. - Remove the dispatch machine and its fallback suites; cover the selector instead.
…ing-voice-i-6a1b # Conflicts: # apps/mobile/src/components/agents/chat-composer.tsx
pandemicsyn
approved these changes
Sep 10, 2026
request.formData() rejects on a malformed body or missing boundary. The rejection escaped the route as an unhandled 500. Catch it and return null so POST answers the controlled 400 invalid-request response.
The default model and the picker read the catalogue unscoped, then the upload carried the organization header. The first global model can be unavailable to the organization, so the default could pick a model the scoped upload rejects. Read the stored organization id and pass it to fetchTranscriptionModels, and pass it from the picker into useTranscriptionModels.
Recorder.release() frees the native object, not the recording file, so every gateway dictation left an m4a behind. Inject a best-effort deleteRecording dependency and run it once the URI is known on every terminal path: upload success, classified failure, model/auth short-circuit, stale session, and abort during recording or upload. Tests cover success, failure, and both aborts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog for users
Changelog for maintainers
apps/mobile/src/lib/voice-input/voice-input-engine-select.ts— the selector composes the OS recogniser and the gateway engine behind the singleVoiceInputNativethe controller consumes. It reads the chosen engine atstart(), routes start/stop/abort and every capability probe to that one engine, and drops events from the idle engine. No engine ever hands a session to the other. Review this file first.apps/mobile/src/lib/voice-input/voice-input-engine-mode.ts—resolveVoiceInputEngineName(enabled)maps the switch toosorgateway. The formergateway-primary/device-primarymodes and theVoiceInputEngineModeunion are gone.apps/mobile/src/lib/voice-input/native-voice-input.ts—createSelectingVoiceInputNativereplaces the two-engine dispatcher; the gateway-enabled subscription still refreshes availability so enabling the switch surfaces the mic without a restart.apps/mobile/src/lib/voice-input/gateway/gateway-transcription-preference.ts— two SecureStore keys remain (enabled default off, chosen model). Thegateway-transcription-primarykey and its hooks are removed.apps/mobile/src/lib/voice-input/gateway/native-gateway-voice-input.ts:22—resolveGatewayTranscriptionModelId()returns the stored model, else the first catalogue entry, else null. An unreachable or empty catalogue reads as no model, which surfaces the actionable picker message instead of an upload that must fail. The engine'sreadModelIddependency is now async.apps/mobile/src/lib/voice-input/use-voice-input-actions.ts— the start path branches once: switch on starts the gateway engine with no OS consent disclosure (the switch is the consent); switch off runs the existing OS consent flow. The model precondition and the picker alert on start are gone because the engine now resolves the default.VOICE_INPUT_TOAST_IDis a module-private constant shared by every voice-input toast, so sonner replaces messages in place; check:unused reports no unused exports, no checker ignore.engine-fell-backcontroller event and its listener,classifyVoiceInputEngineFallback, thevoice-engines-failederror case and its copy, thetone: 'info'feedback field, the Preferences "Use as primary" row, and thevoice-input-engine-dispatch*module plus its five suites. New coverage isvoice-input-engine-select.test.ts.apps/mobile/src/lib/voice-input/gateway/gateway-transcription-client.ts:133— a cancelled upload that resolves with no response is classified by checking the timeout signal first: a fired timeout returns the retryable timeout, while a caller abort stays an invalid response.apps/web/src/app/api/openrouter/audio/transcriptions/route.ts:278— the resolved organization provider policy is computed once and appended to the multipart form as a JSONproviderfield (the JSON branch merges it as before); multipart requests also carrysafety_identifieranduser, both the provider-specific hash.{ text: string }; failures classify into distinct codes that map to one copy each. The gateway route accepts multipart uploads and exempts free models from the zero-balance gate; the catalogue fetch is uncached; the feature value ismobile-voice-input. The fake gateway keeps exactly its two committed transcription models and a request counter; no fixture, test hook, or test-only flag is committed. The feature-flags mounted test mocks the gateway transcription preference module, whose import-time Sentry chain cannot resolve under vitest.Owner manual verification
E2E proof
The device captures for the Preferences rows, persistence across launch, the fake-gateway round trip, and the switch-off no-call check remain valid. The prior "use as primary" and fallback hand-off captures are superseded by this change and are not part of the current proof.
Owner request
E2E proof — log excerpts
.../e2e-mobile-app/p1-timeout.log.../e2e-mobile-app/p2-upstream-fields.log