Skip to content

fix(mobile): keep the screen awake while dictating - #11902

Closed
cole-robertson wants to merge 3 commits into
pingdotgg:mainfrom
cole-robertson:fix/mobile-voice-keep-awake
Closed

cole-robertson wants to merge 3 commits into
pingdotgg:mainfrom
cole-robertson:fix/mobile-voice-keep-awake

Conversation

@cole-robertson

@cole-robertson cole-robertson commented Sep 15, 2026 •

Copy link
Copy Markdown

What Changed

Hold an expo-keep-awake lock while voice input is preparing, recording, or transcribing, and release it when the controller returns to idle or error. One effect in useVoiceInputController, keyed on the existing voiceInputBlocksSubmission state, plus the expo-keep-awake dependency in apps/mobile.

Why

Starting a dictation and then holding the phone without touching the screen lets iOS auto-lock fire. Locking backgrounds the app, the controller cancels preparation, and the take is discarded. In Low Power Mode the lock timer drops to 30 seconds, which is well inside the recording limit, so this happens on most longer voice notes.

expo-keep-awake only disables the idle timer while the lock is held. It does not add a background mode or change audio session behavior, so pressing the side button still locks the phone as before. This is intentionally narrower than #10140, which keeps the recording alive across backgrounding.

Validation: mobile tsc --noEmit, vp fmt --check, the voice-input test files, and vp lint on the changed file (warning count unchanged from main). I have not run this on a device, so the before/after video is missing. Happy to add one if a maintainer wants it before review.

UI Changes

None. No visible controls change.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes (not applicable)
  • I included a video for animation/interaction changes (not applicable)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • The screen now stays awake while a voice recording is in progress, helping prevent auto-lock from interrupting an active recording.

Auto-lock backgrounds the app and discards an in-progress recording. Low Power
Mode shortens the lock timer to 30 seconds, so longer takes are lost. Hold an
expo-keep-awake lock while voice input is preparing, recording, or transcribing.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Sep 15, 2026
// Keep-awake is best effort. Recording proceeds without it.
});
return () => {
void deactivateKeepAwake(VOICE_KEEP_AWAKE_TAG);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Medium voice-input/useVoiceInputController.ts:170

The cleanup produces an unhandled promise rejection when deactivateKeepAwake rejects on Android after the original Activity is dead or deactivated. Handle the rejection here so focus or unmount cleanup remains best-effort.

🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/mobile/src/features/voice-input/useVoiceInputController.ts around line 170:

The cleanup produces an unhandled promise rejection when `deactivateKeepAwake` rejects on Android after the original Activity is dead or deactivated. Handle the rejection here so focus or unmount cleanup remains best-effort.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in the follow-up commit: the release now swallows the rejection the same way activation does.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry, I'm unable to act on this request because you do not have permissions within this repository.

@macroscopeapp

macroscopeapp Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Would Approve

Macroscope's review found this PR approvable — This is a focused mobile bug fix that adds a keep-awake dependency and scopes the lock to the existing voice-input busy states, with no schema, security, billing, deployment, or static-analysis changes. An unresolved Medium-severity cleanup finding remains noted for the potential rejected deactivation promise.

Not approved because:

  • 1 blocking correctness issue found at or above your repo's Minimum Blocking Severity

Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more.

deactivateKeepAwake rejects on Android once the Activity is gone, which turned
focus and unmount cleanup into an unhandled rejection.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: bf12fb33-dc00-40d8-8c3b-438d1e9845e3

📥 Commits

Reviewing files that changed from the base of the PR and between c313a0c and bc2c954.

📒 Files selected for processing (1)
  • apps/mobile/src/features/voice-input/useVoiceInputController.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The mobile app adds expo-keep-awake. The voice input controller activates keep-awake while recording is busy and deactivates it during cleanup. The controller reuses the computed busy state in its return value.

Changes

Voice input keep-awake

Layer / File(s) Summary
Keep-awake lifecycle for voice input
apps/mobile/package.json, apps/mobile/src/features/voice-input/useVoiceInputController.ts
The mobile app adds expo-keep-awake. The controller computes isBusy, activates keep-awake with the voice-input tag while busy, deactivates it during cleanup, handles rejected keep-awake calls, and returns the computed value.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to bc2c9

The keep-awake lifecycle change has no confirmed current-head issue requiring changes before merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: keeping the mobile screen awake during dictation.
Description check ✅ Passed The description includes the required What Changed, Why, UI Changes, and Checklist sections. It explains the implementation, scope, validation, and why screenshots and video do not apply.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

Superseded by #12227 (merged to main) — same mobile keep-awake-during-dictation fix. Closing this PR as superseded.

@juliusmarminge

Copy link
Copy Markdown
Member

Closing as superseded by #12227.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants