Skip to content

fix(asr): give back about 5 GB an idle app held for dictation - #419

Merged
GeiserX merged 1 commit into
mainfrom
fix/idle-release-dictation
Oct 18, 2026
Merged

GeiserX merged 1 commit into
mainfrom
fix/idle-release-dictation

Conversation

@GeiserX

@GeiserX GeiserX commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

akou kept using several GB of RAM long after the last dictation or call. Nothing leaked. Two models stayed loaded on purpose so the next dictation would start fast, and neither was ever let go:

  • Qwen's llama-server for best dictation, about 3 GB. asr.qwenIdleMinutes defaulted to 0, which means never stop. On the reference Mac the log shows two of these servers up for 18 h and 13 h, each until the app quit.
  • The streaming model, about 1.9 GB. After asr.modelIdleMinutes (5) the live Worker let go of its models, and onRelease loaded the dictation's model straight back. A warm-up was not a use, so the reload started no idle time, and the model then stayed until the next call or dictation. The same held for the warm-up at launch and after a call.

The fix:

  • asr.qwenIdleMinutes defaults to 10.
  • A dictation warm-up that finishes counts as a use (touch() on dwarmed), so what it loaded goes after the idle time like anything else.
  • onRelease no longer reloads anything. Each model loads at its next use.
  • The two deliberate preloads keep what they load. asr.warmAtStart lets memory pressure free its models, and server mode keeps its streaming model ready for the first session. Both pass use: false, as before.

The cost: after an idle stretch, the first dictation waits for its model, about 1 to 2 s for the streaming model, and a few seconds for Qwen's server under best. This undoes the reload that #322 added to keep that first press instant.

Tests: a new case in tests/asr-live.test.ts warms dictation with no use and checks that the models go after 5 minutes and stay gone for an hour. With the touch() removed, exactly that test fails. The existing asr.warmAtStart test caught the first version of this change freeing that setting's models, which is why the warm-up has the use flag. DC-E2 and DC-E7 in DICTATION.md and the settings page doc now describe the new defaults.

Not measured here: whether macOS gets back every page sherpa frees. tests/idle-memory.e2e.test.ts runs on the real models with footprint, on the reference Mac only.

Summary by CodeRabbit

  • Behavior Changes

    • Qwen3-ASR now stops after 10 minutes of inactivity by default. Starting it again for dictation may take a few seconds.
    • Released speech models reload when next needed. The first dictation may wait about 1–2 seconds for the streaming model.
    • Dictation received while the “best” engine’s server is starting is retained and decoded once the server is ready.
  • Documentation

    • Clarified model idle and reload behavior, including the effects of dictation warm-ups.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: GeiserX/akou/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4e588517-3142-40a3-aecb-473a44eff85e
📥 Commits

Reviewing files that changed from the base of the PR and between b431752 and 61aae8f.

📒 Files selected for processing: 7
  • docs/configuration.md
  • docs/ux/DICTATION.md
  • src/main/asr/live-worker.ts
  • src/main/config/schema.ts
  • src/main/dictation/best.ts
  • src/main/index.ts
  • tests/asr-live.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

The changes update how dictation warm-ups affect speech-model idle timers. Startup warm-ups do not count as model use. The Qwen server idle timeout default changes from 0 to 10 minutes.

Changes: ASR idle lifecycle

Layer / File(s) Summary
Warm-up and model idle tracking
src/main/asr/live-worker.ts, src/main/index.ts, tests/asr-live.test.ts, src/main/config/schema.ts, docs/configuration.md, docs/ux/DICTATION.md
warmDictation accepts a use flag. Successful warm-ups refresh the idle timer only when the flag is true. Startup warm-ups pass false, and a test checks that warm-up alone does not prevent idle release. Configuration and dictation documentation describe model release and reload timing.
Qwen idle timeout configuration
src/main/config/schema.ts, docs/configuration.md, docs/ux/DICTATION.md, src/main/dictation/best.ts
The Qwen idle timeout default changes to 10 minutes. The documentation describes the timeout and the server restart delay. The best engine description states that audio received during server startup is decoded after the health check responds.

Priority: ➖ Normal

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

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 61aae

The startup preload may be released after the configured idle period, as documented. No actionable merge-blocking issue remains after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the ASR fix and its main effect: releasing about 5 GB held by dictation while the app is idle.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 5 files. (2 skipped: 2 …
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 5 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@GeiserX
GeiserX merged commit a672848 into main Oct 18, 2026
29 checks passed
@GeiserX
GeiserX deleted the fix/idle-release-dictation branch October 18, 2026 17:53
GeiserX added a commit that referenced this pull request Oct 19, 2026
akou kept several GB of memory long after the last dictation or call. #419 fixed that on main. This release ships it to the desktop app, along with the dependency bumps and the nightly fix merged since 1.2.0.

## What 1.2.1 carries

- #419: Qwen's dictation server stops after 10 idle minutes, and the streaming model is no longer reloaded right after an idle release. Together that is about 5 GB back while the app sits idle.
- #418: the nightly stops downloading an AMI meeting from the Edinburgh mirror every night.
- #412, #413, #414, #415, #416: parakeet-rs 0.4.0, wasapi 0.26.0, serde_json 1.0.154, transcribe-cpp 0.4.0, zod 4.6.7, Playwright 1.64, and the upload/download-artifact bumps.

## The release itself

- `bun scripts/stamp-version.ts --set 1.2.1`: 11 places say 1.2.1. The README's DMG name, the docs' image tags and the Mac server clone tag say 1.2.1.
- CHANGELOG.md has the 1.2.1 section.
- docs/providers.md: the vendor terms were read again on 2026-10-18, as CI-28 requires after the 1.2.0 tag of 2026-10-14. No term changed. One Codex documentation change: `--full-auto` is no longer supported. akou never passed it, so nothing changes. No default changes.

## Checks

- `bun scripts/stamp-version.ts --check`: 11 places say 1.2.1.
- `bun test tests/release-evidence.test.ts`: 10 pass. With the new terms row removed, `termsProblems` reports the reading dated 2026-10-13, which is before 1.2.0. With the row back, it reports nothing.
- The 8-hour soak of the release checklist ran on the reference Mac from 18:10Z on 2026-10-18 to 02:10Z on 2026-10-19, at real time, with a burner on every core and this branch's own `akou-capture` 1.2.1 in file mode: 0 holes, heap growth 0.016 MB, RSS growth -5.3 MB, event loop late by at most 135 ms, 0 unreadable log lines, 9 of 9 checks ok. The JSON is committed as docs/gates/soak-1.2.1.json. The helper ran from a copy outside the shared cargo target folder, so no other build on the box could replace it mid-soak.
- After the merge: tag `v1.2.1` on the merge commit, then `release.yml` builds the signed app, the images and the update feed.
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