Repository navigation
feat(voice-recording): add voice recording support for agent - #717
haiphucnguyen merged 4 commits into
Conversation
- Implemented voice recording functionality in `AgentRunArea` and `ChatInputField`. - Added `VoiceRecordingController` to handle voice recording logic. - Updated dependencies and configurations to support voice recording features. - Ensured compatibility with existing chat input mechanisms.
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved recording lifecycle, workspace isolation, and concurrent-stop issues block approval.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds reusable voice recording and transcription support for chat and agent goal inputs.
Changes:
- Adds shared recording lifecycle, waveform, transcription, auto-stop, and error handling.
- Integrates microphone controls and shortcuts into the agent run area.
- Refactors chat input to use the shared controller.
Review findings:
AgentRunArea.kt: Critical workspace-boundary lifecycle issue (2 votes).VoiceRecordingController.kt: Critical concurrent-stop race (1 vote).AgentRunArea.kt: Moderate inability to stop recording while running (2 votes).VoiceRecordingController.kt: Moderate inability to stop recording while busy (1 vote).
File summaries
| File | Description |
|---|---|
desktop-shared/src/main/kotlin/io/askimo/ui/voice/VoiceRecordingController.kt |
Shared recording lifecycle and UI controls |
desktop-shared/src/main/kotlin/io/askimo/ui/chat/ChatInputField.kt |
Uses shared voice-recording functionality |
desktop-shared/src/main/kotlin/io/askimo/ui/agent/AgentRunArea.kt |
Adds voice input to agent goals |
Review details
Suppressed comments (1)
desktop-shared/src/main/kotlin/io/askimo/ui/voice/VoiceRecordingController.kt:367
- When a caller becomes busy while recording, this disables the only stop control;
VoiceRecordingController.toggle()also returns immediately for a busy caller. In the agent area, the Run button remains available while recording, so starting a run leaves the microphone open and un-stoppable until the 120-second auto-stop. Keep the stop action enabled/allowed duringRECORDING, or prevent the run from starting until recording has stopped.
IconButton(
onClick = controller::toggle,
enabled = enabled && controller.voiceRecordingState != VoiceRecordingState.TRANSCRIBING,
- Files reviewed: 3/3 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟡 Changes recommended
One or more issues must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (1)
desktop-shared/src/main/kotlin/io/askimo/ui/voice/VoiceRecordingController.kt:182
- This cleanup is unconditional, so an older transcription that was canceled by
cancelAll()can run thisfinallyafter a new recording has already started. It will then set the new recording/transcribing state back toIDLEand clear the newtranscriptionJobreference, allowing the new transcript to arrive without being cancellable (and potentially being delivered into the wrong context). Scope cleanup to the job that owns the currenttranscriptionJobbefore resetting shared state.
} finally {
voiceRecordingState = VoiceRecordingState.IDLE
transcriptionJob = null
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
There was a problem hiding this comment.
🟡 Changes recommended
One or more issues must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (2)
desktop-shared/src/main/kotlin/io/askimo/ui/voice/VoiceRecordingController.kt:215
- This
finallyblock unconditionally resets shared controller state and clearstranscriptionJob, including for a job canceled bycancelAll(). If the canceled STT call returns after a new recording has started, it can hide the new recording/transcribing state and detach the new job, so a later context change will no longer cancel the active transcription. Only the still-current transcription job/generation should be allowed to perform this cleanup.
} finally {
voiceRecordingState = VoiceRecordingState.IDLE
transcriptionJob = null
recorderOperationPending = false
desktop-shared/src/main/kotlin/io/askimo/ui/voice/VoiceRecordingController.kt:209
cancelAll()deliberately cancels the transcription job, but the current OpenAI/local STT implementations catch everyExceptionand can wrap an interruption/cancellation inVoiceServiceException. That reaches this handler and emits a user-visible transcription error for an intentional workspace/new-chat/dispose cancellation. PreserveCancellationException(or check the coroutine is still active) before posting the error; the cancellation path should be silent.
} catch (e: VoiceServiceException) {
EventBus.post(AppErrorEvent(title = errorTitleProvider(), message = e.message ?: "Voice transcription failed"))
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
There was a problem hiding this comment.
🟡 Changes recommended
The voice-recording controller has unresolved lifecycle and cancellation race conditions.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (1)
desktop-shared/src/main/kotlin/io/askimo/ui/voice/VoiceRecordingController.kt:144
cancelIfRecording()gates the queued cancellation onaudioRecorder.isRecording, buttoggle()starts asynchronously and the recorder'slineis assigned only inside that queued task. IfcancelAll()or disposal runs after the start is queued but beforelineis assigned, this returns without cancelling the queued start; the task can then open the microphone after the controller was reset. Serialize cancellation with pending recorder operations and make the start task honor cancellation before publishingRECORDING.
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
haiphucnguyen
left a comment
There was a problem hiding this comment.
Thank you @cdrozs !
Summary
Add voice recording support for agent input field
Related Issue(s)
#713
Type of Change
What Changed & Why
VoiceRecordingControllerfor handling voice recording logic.How to Test
./gradlew testScreenshots / Recordings (if applicable)
Checklist
main./gradlew spotlessApplyand./gradlew detektlocally./gradlew testand all tests passgit commit -sAdditional Notes