Skip to content

feat(voice-recording): add voice recording support for agent - #717

Merged
haiphucnguyen merged 4 commits into
askimo-ai:mainfrom
cdrozs:feature/support-voice-recording-for-agent
Sep 14, 2026
Merged

haiphucnguyen merged 4 commits into
askimo-ai:mainfrom
cdrozs:feature/support-voice-recording-for-agent

Conversation

@cdrozs

@cdrozs cdrozs commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Add voice recording support for agent input field

Related Issue(s)

#713

Type of Change

  • 🐛 Bug fix
  • [ X] ✨ New feature
  • 💥 Breaking change
  • 📝 Documentation
  • ♻️ Refactor (no functional change)
  • 🧪 Tests
  • 🔧 Chore / tooling / CI

What Changed & Why

  • Integrated voice recording functionality into the agent run area.
  • Updated chat input field to support voice recording controls.
  • Created a new VoiceRecordingController for handling voice recording logic.

How to Test

./gradlew test

Screenshots / Recordings (if applicable)

Checklist

  • [ X] I have read the CONTRIBUTING guide
  • [ X] My branch is up to date with main
  • [ X] I ran ./gradlew spotlessApply and ./gradlew detekt locally
  • [ X] I ran ./gradlew test and all tests pass
  • I added/updated tests for my changes (if applicable)
  • I added/updated documentation (if applicable)
  • [ X] My commits are signed off (DCO) — git commit -s
  • [ X] This PR is focused on a single feature/fix

Additional Notes

- 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.
@CLAassistant

CLAassistant commented Sep 14, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 during RECORDING, 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 this finally after a new recording has already started. It will then set the new recording/transcribing state back to IDLE and clear the new transcriptionJob reference, 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 current transcriptionJob before resetting shared state.
            } finally {
                voiceRecordingState = VoiceRecordingState.IDLE
                transcriptionJob = null
  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Lite

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 finally block unconditionally resets shared controller state and clears transcriptionJob, including for a job canceled by cancelAll(). 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 every Exception and can wrap an interruption/cancellation in VoiceServiceException. That reaches this handler and emits a user-visible transcription error for an intentional workspace/new-chat/dispose cancellation. Preserve CancellationException (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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 on audioRecorder.isRecording, but toggle() starts asynchronously and the recorder's line is assigned only inside that queued task. If cancelAll() or disposal runs after the start is queued but before line is 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 publishing RECORDING.
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

@haiphucnguyen haiphucnguyen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @cdrozs !

@haiphucnguyen
haiphucnguyen merged commit 07d848a into askimo-ai:main Sep 14, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants