Skip to content

[LUM-753] Add diagnostic logging to dictation recording lifecycle#24067

Merged
tkheyfets merged 1 commit into
mainfrom
devin/1775588602-LUM-753-dictation-diagnostic-logging
Apr 8, 2026
Merged

[LUM-753] Add diagnostic logging to dictation recording lifecycle#24067
tkheyfets merged 1 commit into
mainfrom
devin/1775588602-LUM-753-dictation-diagnostic-logging

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot commented Apr 7, 2026

Summary

Adds comprehensive diagnostic logging to VoiceInputManager to help investigate dictation auto-stop issues on cloud-hosted assistants (LUM-753). Currently, when dictation fails to start or stops immediately, there is almost no logging — making it impossible to diagnose remotely. This PR instruments every early-return and failure path in the recording lifecycle.

No behavioral changes — only logging additions:

  • Log entry into beginRecording() with origin, mode, and current state
  • Log speech recognizer availability details when recreation is attempted
  • Log microphone/speech permission status on every recording attempt
  • Log recognition task state when skipping due to an active task
  • Track recording start timestamp; log elapsed time at every stop/error point
  • Detect and warn on micro-recordings (< 1s duration) — these almost certainly indicate a silent failure rather than a user action
  • Include NSError domain + code on recognition errors for richer diagnostics
  • Log when stopRecording() is called while already stopped (state inconsistency)

Review & Testing Checklist for Human

  • Build verification: This is a macOS/Xcode project that could not be built on the CI-less Linux dev environment. Confirm the Swift compiles cleanly (string interpolations in os.Logger calls, String(describing:) usage, CFAbsoluteTimeGetCurrent() arithmetic).
  • Deploy to a cloud-hosted staging assistant and attempt dictation — check that the new log lines appear in Console.app under the VoiceInput category, and that they contain useful diagnostic info (origin, permissions, elapsed time).
  • Verify no performance regression: The added logging is in paths that execute at most a few times per recording session (not in hot audio-tap loops), but worth a sanity check that dictation still feels responsive.

Notes

  • Context: The video for LUM-753 shows dictation immediately "auto-stopping" on a cloud-hosted assistant. Code investigation found no cloud-specific gate — the recording flow is entirely local (Apple Speech Recognition + AVAudioEngine). The silent failure paths in beginRecording() are the most likely culprits but are currently invisible without logs. This PR makes them visible so the next reproduction produces actionable diagnostics.
  • Companion to merged PR [LUM-753] Improve client-side dictation resilience #24042 which improved the HTTP fallback timeout and logging in DictationClient.swift.

Link to Devin session: https://app.devin.ai/sessions/4d99242121f94fed84c1d80e873c569a
Requested by: @tkheyfets


Open with Devin

… lifecycle

- Log entry point of beginRecording() with origin, mode, and current state
- Log speech recognizer availability details (nil vs unavailable)
- Log permission status for both microphone and speech recognition
- Log recognition task state when skipping due to active task
- Track recording start timestamp and log elapsed time at every stop point
- Detect and warn on micro-recordings (<1s) that indicate silent failures
- Log recognition error details including NSError domain and code
- Log empty final transcription as warning with elapsed time
- Log audio engine failure with elapsed time

Co-Authored-By: tkheyfets <timur@vellum.ai>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

Devin is archived and cannot be woken up. Please unarchive Devin if you want to continue using it.

3 similar comments
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

Devin is archived and cannot be woken up. Please unarchive Devin if you want to continue using it.

@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

Devin is archived and cannot be woken up. Please unarchive Devin if you want to continue using it.

@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

Devin is archived and cannot be woken up. Please unarchive Devin if you want to continue using it.

Copy link
Copy Markdown
Contributor Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 1 additional finding in Devin Review.

Open in Devin Review

@@ -949,7 +969,7 @@ final class VoiceInputManager {
overlayWindow.dismiss()
}
awaitingDaemonResponse = false // reset for next recording
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🚩 Pre-existing: awaitingDaemonResponse reset in stopRecording() after overlay check

At line 971, awaitingDaemonResponse is reset to false immediately after the overlay-dismiss check at line 968. In the dictation flow, handleFinalTranscription sets awaitingDaemonResponse = true (line 878), then the recognition callback calls stopRecording() which checks the flag (preserving the overlay) but then resets it. When handleDictationResponse later arrives (line 893-894), the flag is already false. This means any code that checks awaitingDaemonResponse between stopRecording() and handleDictationResponse will see false. This is pre-existing behavior unaffected by this PR, and the only consumer of the flag during that window appears to be another stopRecording() call (which would dismiss the overlay prematurely if triggered). Worth noting but not a regression.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@tkheyfets
Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@tkheyfets tkheyfets requested a review from noanflaherty April 8, 2026 15:29
@tkheyfets
Copy link
Copy Markdown
Contributor

provides extra logging for dictation

@tkheyfets tkheyfets merged commit c1f655e into main Apr 8, 2026
6 checks passed
@tkheyfets tkheyfets deleted the devin/1775588602-LUM-753-dictation-diagnostic-logging branch April 8, 2026 15:29
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.

1 participant