Repository navigation
feat(jobs): keep the loaded model between jobs, and stop reloading it on a preset switch - #270
Merged
Merged
Conversation
…o stale The hand-written tool list in docs/agents.md named 22 of the 37 tools the server lists. docs/reference/mcp.md is now rendered from tools/list (names, titles, descriptions, parameters, input schemas and annotations) by scripts/mcp-reference.ts, and tests/mcp-reference.test.ts fails whenever the committed page differs from what the server generates.
… key and job in the server log
A client with jobs in flight could not change where its callbacks go without
replacing its key, which loses its earlier jobs and feed. PATCH /v1/keys/{id}
and akou keys update now replace the hosts under the keys.json lock and keep
the key, its secret and its jobs.
The server log now carries key.created, key.updated and key.revoked (with the
client's address, or keys.json for a CLI edit) and job.created beside the
existing job.done, job.failed, key.refused and webhook lines. Never the audio
or the text.
Below 1248 px the sidebar drops to 10 rem so the transcript keeps half the window next to the side pane. A page (Settings, Models, Dictation) has no side pane, yet it got the narrow sidebar too, so call titles there were cut short for nothing. A page now keeps the 13.75 rem sidebar at any width.
…nloaded A job that named no model always ran Parakeet, even on a server with Qwen3-ASR on disk and a GPU free. auto now follows the app's final-pass rule: best wherever Qwen and its llama-server are on disk, else fast while Parakeet is, else best on a GPU with 16 GB and fast elsewhere. GET /v1/server says which and why, the Models page's Automatic row shows it, and `akou models pull auto` pulls the same preset. A test pins every built preset's engines to the catalog.
A backslash at the end of a description or type would have escaped the cell's closing pipe and broken the table. Cells now escape backslashes before pipes, and the escaping test covers both.
…rely on them Each route declares the refusals it answers, by status; the file renders them with the shared ones (guard, body, query) and lists every code once in components.schemas.ErrorCode. A range refusal now answers in the one error shape too. No existing code is renamed. Beads: akou-3n5.6
At 480 px, the shell's minimum, the full sidebar left the Models page too little room and it scrolled sideways.
The door parity test failed on the new PATCH /v1/keys/{id}: no row named it.
It reaches the CLI and the API; the Keys page and MCP do not change hosts.
…ize default, the bound address, each failed callback GET /v1/server listed the auto preset as unavailable while jobs on auto ran as fast, so a client trusting the flag hid its own default. auto now names what it resolves to and is available when that is. The route also reports server.default_diarize, the one default it left out. The startup line printed http://127.0.0.1 while the server listened on every address; it now names the address bound. A failed webhook try logged nothing until the whole schedule ran out, so an operator could not see callbacks failing. Each failed try with another to come logs webhook.retry with the event id, the try number, the status or error class and the next try's time, never the URL or the body.
…no server mode needed `akou transcribe FILE` against the desktop app exited 69 "file jobs need akou in server mode", although the models, the job Worker and the token were all there. server.enabled is about keys, bind and proxies for other machines, not about whether this akou may transcribe a file for its own user. The job service now starts in both modes and the job routes are served in both, reached with the app's token. The desktop app leaves out what server mode adds: no keys, no webhook secrets (capabilities.webhooks stays false), no remotes and no dictation lane; the model sweep stays the app's, and it now also keeps what a queued or running job needs. Keys and the OpenAI door stay server-only.
…oute Job results came back with a null language for every clip a client sent with language auto, because auto ran Parakeet, which names none, and the OpenAI route turned that into "unknown", which is not a language code. With auto running Qwen wherever it is on disk, a result now names the language it heard (en, es); the OpenAI route answers BCP-47 "und" when nothing names one, and its doc says words stay empty because no built engine gives word times. A model-gated test runs an English and a Spanish clip through auto on the real models.
…a running test The Linux check now measures coverage and holds src/ to 90 % of lines and 88 % of functions and src/core/ to 98 % of lines, summed from the lcov file, because Bun's own coverageThreshold holds every file to the bar on its own. A new traps job reads the JUnit files of check, ui and the capture e2e and fails when a reached trap in docs/TRAPS.md has no test named after its id that ran and asserted.
…and draw the side column as b2 With Claude Code or Codex missing, or no API key, the Ask card printed the provider's reason verbatim, naming provider.harnessPath or provider.apiKey. It now says it in one plain line that points at Settings; the CLI and the API keep the provider's own words. The side column follows b2: time-only citation chips with the speaker in their label, a one-line answer status, an HH:MM note gutter, Action and Open question under those notes, and a 340 px column.
… for a job the server forgot
A long job could not be told from a hung one: GET /v1/jobs/{id} showed only
the status and the start time. A running job now answers progress (stage
decode, diarize or transcribe, and the seconds of audio done), and a done job
answers timings, the wall seconds of each stage, also in its result.
A driver could not tell an expired job from a typo: both answered 404. A job
the caller once had, deleted or past server.retain_days, now answers 410 gone
with retain_days in the body; an unknown id still answers 404. A remote's 410
counts as a lost job, like its 404.
…irst job runs on it The first best job on a fresh box unpacked the pinned build inside its own start, after the host had last asked a build on disk, so it ran with every layer on a GPU nobody had confirmed. The server now asks the build's --list-devices once, before that first start, and runs on the CPU when it lists no such device. Also from the same review: a changed asr.accelerator asking the build again is now tested, the asr.llamaServer doc says an own build on the CPU gets --device none, and two comments point at llama-catalog.ts, where the build table lives.
…nding out dead akou:// links
An agent could not run the final pass, share a call, read a template, edit
or delete a note, open the window or read the settings, and every start
answered with an akou:// link nothing registers. The window's RPC also had
no check that each of its methods exists on the API.
MCP gains akou_finalize, akou_share_on/off/status, akou_template_list/get,
akou_edit_note, akou_delete_note, akou_open_window and a read-only
akou_config_get, plus mic and withoutModels on akou_start. GET
/templates/{name} and akou templates list|show read a template as the
notes would use it, the user's override included. POST /calls keeps url,
now null and typed nullable in the OpenAPI file. The parity test reads
every AkouRpc method from its type and fails on one with no route and no
written reason.
…s size Kept dictation audio was a 16 kHz 16-bit WAV, about 1.9 MB a minute, because the app has no Opus codec. The capture helper already links libopus for a call's parts, so it now does both ends for dictations too: `akou-capture encode` writes a mono Ogg Opus file at 24 kbps (about 180 KB a minute) and the existing `decode` reads it back. A WAV kept before is still read, served and deleted; with no helper or a failed encode the audio is kept as WAV rather than lost. The encode runs off the main thread; a read waits for it and a delete asked meanwhile removes what it wrote.
…ce ends are kept The Worker cut a Parakeet dictation at pauses on the raw signal, and the cut rule's -50 dBFS trim took the ends of quiet sentences; a clip whose peak sat under it gave no span and came back empty. The cutter now judges a copy gained as each span is decoded. On 20 quiet FLEURS English clips the cut decode goes from 21.60 to 7.99 WER with no empty clip; Spanish is unchanged.
…urces by id GET /devices and GET /apps answer the capture helper's device query, whose line now also lists the apps with audio (macOS by bundle id, Windows by executable name; Linux says it cannot capture one app). akou devices, akou apps, the Dictation mic picker and a new akou_devices MCP tool read them. A helper that refuses, such as in file-only mode, is answered as a refusal. Beads: akou-3n5.7
The type column still escaped only pipes, so a backslash in an enum value could have broken the table the same way.
…d say when llama-server may open the wrong GPU On an Intel UHD 770 with SR-IOV, the docs said to pass /dev/dri whole; llama-server then opened a virtual function instead of the GPU akou had detected, and the GPU hung. llama.cpp picks among the render nodes it can open by its own order and Mesa pins a device only by PCI ids, which the virtual functions share, so the fix is to pass one node. The docs now say so, and GET /v1/server's accelerator reason lists the nodes and names the one to pass whenever akou can open more than one. The docs also record the measured UHD 770 numbers: the Vulkan image ran about 1.2 times slower than real time and the CPU image on the same box about 1.5 times faster.
…pps-route-akou-3n5-2-l6
…gainst 8.63 WER for Qwen alone
The final pass ran one model. `asr.final.engines` lists several: each one that is
downloaded decodes every piece, and confidence ROVER fuses their words, the first
breaking ties. Empty by default, so the pass stays on the one model
`asr.final.model` picks.
Models leave from the end of the list while together they would hold more than
60 % of the machine's memory; one that goes down mid-pass is dropped and the rest
finish it. `final.done` names the engines that ran and the dropped ones with why.
`akou start --engines`, `POST /calls {engines}` and `akou_start {engines}` set the
list for one call, kept in `call.created`; `GET /models` names it.
…t for the macOS field The DC-R6 tests held a 20 s hold's release-to-text within 200 ms of a 3 s hold's, and a stalled Windows runner read 300 to 1800 ms for the same bytes. The PR check now counts what leaves after release, and the wall-clock bound runs in the nightly. The macOS inserter step read the field a fixed 0.5 s after the typed insert and once caught it before the text landed; it now waits for the text with a deadline.
… on a preset switch Every run of short file jobs paid the model load again: a Worker on a model other than the default was closed as soon as the queue drained, a fast job between two best jobs evicted Qwen, and two best jobs at concurrency 2 on Metal stopped each other's llama-server. For a voice note the load costs more than the decode. An idle Worker now keeps its model for server.model_idle_minutes (default 60, 0 lets go as soon as no queued job needs it), then closes and frees the memory. Among queued jobs of one priority, a job on a model an idle Worker holds goes first (a job is passed over at most 8 times), and a new Worker is made while there is room instead of rebuilding a warm one. A job on a Metal llama-server waits while another runs. /v1/server and /healthz report the loaded models in queue.loaded.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (15)
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. Comment |
DC-E2 failed with JSON Parse error: Unexpected EOF when a test read the fake llama-server's log while it was appending a request. The four readers now share one helper that leaves a line without its newline for the next read.
…s, and test the upload cap beside the real job route The app counted the job service's default recognizer as one of its own defaults, so Parakeet showed as a default model on a setup that never uses it. The upload-cap test added its stand-in job route behind the real one, which now exists in both modes.
…ou-w51-1-l20 [skip ci]
…u-3n5-2-l6 [skip ci]
…5an-3-l8 [skip ci]
…akou-5an-1-l13 [skip ci]
…-5an-1-l13 [skip ci]
…n-2-l17 [skip ci]
…zm-1-l18 [skip ci]
…dalone-2-l1 [skip ci]
…ou-w51-1-l20 [skip ci]
…u-3n5-2-l6 [skip ci]
…5an-3-l8 [skip ci]
…akou-5an-1-l13 [skip ci]
GeiserX
added a commit
that referenced
this pull request
Oct 4, 2026
…ng go of models nothing uses (#322) akou held about 3.7 GB while sitting idle on the reference Mac, hours after the last call, with only 56 MB of it resident. On a 24 GB Mac that is enough to start freezing it. Nothing was leaking. With dictation on, the live Worker loaded Parakeet (about 2.2 GB) and the streaming model (about 1.8 GB) at start and kept both for good, even though a live dictation never decodes with Parakeet. A call loaded Parakeet too, and nothing ever let it go. Now the dictation warm-up loads Parakeet only when the dictation's text comes from it (`dictation.final` `parakeet`, or no streaming model). A new setting, `asr.modelIdleMinutes` (default 5; 0 lets go at once, as `server.model_idle_minutes` does; up to 10080 keeps them loaded on a Mac with memory to spare), lets the live Worker drop every model once no call and no dictation has used it for that long. The app then loads back only what a dictation needs to start fast. The method is `LiveAsr.releaseIdle()`, named and shaped like the job Worker's idle release in #270. That PR covers file-job Workers, this one covers the live Worker. They share no code because they are different Workers. Footprint (`footprint -p`, which counts the compressed and swapped pages RSS hides) of the app process, measured on a 16 GB M4 with dictation on in English and Spanish: | | main | this branch | |---|---|---| | fresh start | 3,612 to 4,104 MB | 1,692 to 1,921 MB | | after a 30 s call and its final pass | 3,889 MB | 4,111 MB | | after 5 to 30 dictations | 3,903 MB | 3,941 MB | | idle, before the timer | 3,899 MB (unchanged after 3 min) | 3,938 MB (4 min) | | idle, after the timer (5 min) | n/a | 2,031 MB (the streaming model loaded back) | Thirty dictations did not grow the footprint on main (3,904 MB after 10, 3,903 after 20 and 30). Each finished final pass already lets go of its models (#179). The cost is load time. These numbers come from a loaded machine: - A `fast` dictation, a retry on `fast`, or a live dictation whose stream fails and falls back to `fast` now waits for Parakeet when it is not loaded. The first `fast` clip after a fresh start took 8.4 s wall time on this branch against 1.4 s on main. Parakeet loads in 2 to 3 s on an idle machine. - A call's first lines wait for Parakeet the same way. - A press while the streaming model reloads after an idle period waits for it, about 1 to 2 s. - Live dictations, the default, are unaffected: 1.3 to 2.3 s for a 6 s clip on both. `tests/idle-memory.e2e.test.ts` runs the app in its own process on the real models: a fresh start, a 20 s call with its final pass, 5 dictations, then an idle minute (`asr.modelIdleMinutes: 1`). It asserts that the call adds Parakeet to the fresh start (over 1.5 GB) and that the idle app is back within 1000 MB of its fresh start. Over seven runs on a busy 16 GB Mac the idle app read from 1,158 MB under to 529 MB over its fresh start (the allocator's freed small regions and swap), so the margin sits above that spread and below Parakeet; the run without a release read 2,300 MB over. It is skipped off macOS or without `AKOU_LIVE_MODELS`, and floors go +1 skip. Final runs, on this branch merged with main: - main: red. Fresh 3,439 MB, after the call 4,303 MB (+864), idle 3,998 MB. The fresh start already holds Parakeet. - this branch: green three times. Fresh 1,427 MB, after the call 4,375 MB, idle 1,429 MB; fresh 1,787 MB, after 4,411 MB, idle 2,193 MB; and, at the 1000 MB margin, fresh 1,781 MB, after 4,463 MB, idle 2,194 MB. - this branch with the idle setting at 1440: red on the idle check. Fresh 1,542 MB, idle 3,842 MB. Unit tests in `tests/asr-live.test.ts` drive `releaseIdle` with a manual clock: release after a call, a long call holding the models, an open dictation holding them, and nothing released without the setting. There is one test per busy rule (a call on the Worker, an open dictation, a decode, a speech check and a warm-up in flight), and replacing any one rule with `false` turns exactly its own test red. The warm-up rule means a release never undoes a warm-up still loading. The Settings page has a row for the new setting under Speech engines. DC-E7 in DICTATION.md and its tests now say that Parakeet loads ahead only when the dictation's text comes from it. Not changed: `asr.qwenIdleMinutes` (the `best` dictation server) still defaults to never, and its memory is in a separate llama-server process. Next step, not built here: int8 variants of Parakeet and the streaming model could cut the idle footprint further, but that trades accuracy against the fp32 choice the benchmark made, so it is a decision for later.
GeiserX
added a commit
that referenced
this pull request
Oct 12, 2026
…ad of an hour (#402) A server kept an idle model loaded for an hour after its last job. A run of jobs reuses one load just as well with 10 minutes, and an hour holds 2.5 GB or more of Qwen on a box that does other work. The owner chose 10 minutes as the default. The idle unload itself already exists (#270): an idle Worker keeps its model for `server.model_idle_minutes`, a queued job on that model keeps it, a timer closes it afterwards, and `JobService.close` clears the timer. This change only moves the default and covers the close path. - `server.model_idle_minutes` defaults to 10 (was 60). The name, the range (0 to a week) and 0 are unchanged, so existing config files keep validating. `docs/configuration.md` is regenerated. - docs/server.md says the best model stays loaded for 10 minutes after its last job, and names the setting. - SERVER.md SV-Q1 says default 10. Tests: - `tests/warm-model.e2e.test.ts`: the existing idle test now checks the model is still loaded at 9 minutes and gone at 11, with the "unloaded after 10 min" line. - New: "closing the service while the idle timer is pending stops llama-server, and the timer never fires". Red with the `clearTimeout` in `JobService.close` removed. - New positive control: "with the service open, the pending idle timer fires". - `tests/models-on-demand.e2e.test.ts`: the SV-M4 check moves from 61 to 11 minutes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A client sending many short files paid the model load on almost every file. A Worker on any model but the default closed as soon as the queue drained. A fast job between two best jobs evicted Qwen at concurrency 1, so the next best job loaded it again. And at concurrency 2 on Metal, two best jobs stopped each other's llama-server, because each Worker's start kills whatever Metal server the shared pid file names. For a 10 to 60 second voice note the load takes longer than the decode.
The fix:
server.model_idle_minutesafter its last job (new setting, default 60; 0 lets go once no queued job needs it). Then it closes and the memory comes back, with a log linejobs: <model> unloaded after N min with no job. This applies to the default model too, which used to stay loaded forever. A timer wakes the check;JobService.releaseIdle()is the check.WARM_PASS_LIMIT), so a steady stream on one model never starves another. While there is room underserver.concurrency, a new Worker is made instead of rebuilding a warm one.queue.loadedonGET /v1/serverand/healthzlists the recognizers a job Worker holds, so a client can batch its jobs around them.GET /v1/serverdoc and the OpenAPI file, and the settings pages updated; floors +8.Tests (
tests/warm-model.e2e.test.ts, run against the fake llama-server; the first 6 fail when run over a copy oforigin/main'ssrc, the last 2 fail with the line they cover removed):readylog line, andqueue.loadedis[qwen3-asr-1.7b]on/v1/serverand/healthz. On main: 3 starts.server.model_idle_minutes: 0: two jobs in a row, two starts.server.model_idle_minutes0.02, real clock, nobody callsreleaseIdle) unloads the model. Red with the timer's callback emptied.models-on-demand.e2eSV-M4 now checks that the non-default Worker stays within the idle period and is gone after it.Not done here:
/healthz, and the scheduling keeps Qwen across a queued preset switch. A fast job arriving alone after the queue drained still takes the only slot at concurrency 1.Beads: akou-5an.104, akou-5an.114, akou-5an.117, akou-5an.107