Repository navigation
fix(desktop): park the bot face clock when idle and tear it down on disable - #88543
Merged
Merged
Conversation
…lugin disable Follow-up to the salvaged #88219 visibility/15fps work: - Dormancy: the rAF loop stops scheduling frames when no faces are mounted or none are visible, instead of running the 1Hz whole-document shadow-root scan forever. A mounting BotFace or a face scrolling into view wakes it. - Teardown: register() now hooks ctx.onDispose so disabling the Bots plugin (or a hot reload) cancels the animation frame, disconnects the IntersectionObserver, drops cached nodes, and clears window.__hbFaceClock. Previously the loop ran until app restart even with the plugin disabled. - Behavioral tests for park/wake/stop via a vm-extracted clock harness, verified to fail against the pre-fix source.
૮ >ﻌ< ა ci reviewran on 0207ab9 — fix(desktop): park the bot face clock when idle and tear it
|
This was referenced Aug 17, 2026
teknium1
added a commit
that referenced
this pull request
Aug 17, 2026
…imations Desktop shipped the same bug class four times in one week: a decorative animation loop that never sleeps (bots face clock #88543, pixel egg #88406, diffusion placeholder #88564, plus the #77651 hidden-renderer wave). Each fix hand-rolled the same four behaviors. This extracts them into one helper in src/lib/budgeted-loop.ts: - fps budget (default 15) on top of rAF - observability pause via the existing createRendererLoopPauseController - idle dormancy: idleWhen() true after a draw parks the loop with zero pending work until wake() — the piece every hand-rolled loop forgot - teardown: dispose() cancels the frame, disposes the controller, and makes wake() a no-op DiffusionCanvas migrates onto it as the first consumer (net -40 lines at the call site); its existing scheduling/budget/instance-cap tests pass unchanged against the migrated implementation. Helper suite covers budget, pause, park/wake, dormancy-survives-focus-churn, and dispose idempotency; sabotage run (budget+dormancy stripped) fails 4/5.
lisajlau
pushed a commit
to lisajlau/hermes-agent
that referenced
this pull request
Aug 20, 2026
…imations Desktop shipped the same bug class four times in one week: a decorative animation loop that never sleeps (bots face clock NousResearch#88543, pixel egg NousResearch#88406, diffusion placeholder NousResearch#88564, plus the NousResearch#77651 hidden-renderer wave). Each fix hand-rolled the same four behaviors. This extracts them into one helper in src/lib/budgeted-loop.ts: - fps budget (default 15) on top of rAF - observability pause via the existing createRendererLoopPauseController - idle dormancy: idleWhen() true after a draw parks the loop with zero pending work until wake() — the piece every hand-rolled loop forgot - teardown: dispose() cancels the frame, disposes the controller, and makes wake() a no-op DiffusionCanvas migrates onto it as the first consumer (net -40 lines at the call site); its existing scheduling/budget/instance-cap tests pass unchanged against the migrated implementation. Helper suite covers budget, pause, park/wake, dormancy-survives-focus-churn, and dispose idempotency; sabotage run (budget+dormancy stripped) fails 4/5.
bobaba76
pushed a commit
to bobaba76/hermes-agent
that referenced
this pull request
Aug 27, 2026
…imations Desktop shipped the same bug class four times in one week: a decorative animation loop that never sleeps (bots face clock NousResearch#88543, pixel egg NousResearch#88406, diffusion placeholder NousResearch#88564, plus the NousResearch#77651 hidden-renderer wave). Each fix hand-rolled the same four behaviors. This extracts them into one helper in src/lib/budgeted-loop.ts: - fps budget (default 15) on top of rAF - observability pause via the existing createRendererLoopPauseController - idle dormancy: idleWhen() true after a draw parks the loop with zero pending work until wake() — the piece every hand-rolled loop forgot - teardown: dispose() cancels the frame, disposes the controller, and makes wake() a no-op DiffusionCanvas migrates onto it as the first consumer (net -40 lines at the call site); its existing scheduling/budget/instance-cap tests pass unchanged against the migrated implementation. Helper suite covers budget, pause, park/wake, dormancy-survives-focus-churn, and dispose idempotency; sabotage run (budget+dormancy stripped) fails 4/5.
melon-xf
added a commit
to melon-xf/hermes-agent
that referenced
this pull request
Sep 3, 2026
…imations Desktop shipped the same bug class four times in one week: a decorative animation loop that never sleeps (bots face clock NousResearch#88543, pixel egg NousResearch#88406, diffusion placeholder NousResearch#88564, plus the NousResearch#77651 hidden-renderer wave). Each fix hand-rolled the same four behaviors. This extracts them into one helper in src/lib/budgeted-loop.ts: - fps budget (default 15) on top of rAF - observability pause via the existing createRendererLoopPauseController - idle dormancy: idleWhen() true after a draw parks the loop with zero pending work until wake() — the piece every hand-rolled loop forgot - teardown: dispose() cancels the frame, disposes the controller, and makes wake() a no-op DiffusionCanvas migrates onto it as the first consumer (net -40 lines at the call site); its existing scheduling/budget/instance-cap tests pass unchanged against the migrated implementation. Helper suite covers budget, pause, park/wake, dormancy-survives-focus-churn, and dispose idempotency; sabotage run (budget+dormancy stripped) fails 4/5.
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.
Summary
The bundled Bots plugin's face-animation clock no longer burns CPU when idle and actually stops when the plugin is disabled. Salvages #88219 by @digitalbase (visible-faces-only painting via IntersectionObserver + 15 fps cap, authorship preserved) and completes it with dormancy and teardown.
Root cause of the field report (Desktop pinned at 100% CPU, persisting after disabling Bots): the clock started at plugin load, ran a
requestAnimationFrameloop forever, rescanned the whole document — including every shadow root viaquerySelectorAll('*')— every second, and repainted all mounted faces at 60 fps. Disabling the plugin never tore any of it down.Changes
apps/desktop/src/plugins/hermes-bots/plugin.js:BotFaceor a face scrolling into view wakes itregister()hooksctx.onDispose(stopFaceClock)— disabling/reloading the plugin cancels the frame, disconnects the observer, drops cached nodes, clearswindow.__hbFaceClocktests/face-clock.test.mjs: behavioral park/wake/stop coverage via a vm-extracted clock harness (verified to fail against the pre-fix source)Validation
node --test)Field report: Discord (rahlquist) — Desktop at 100% CPU after this morning's update, unchanged by disabling Bots without a restart. Likely also issue #73082.
Credit: @digitalbase for the visibility/15 fps work in #88219, cherry-picked with authorship preserved. Diagnosis by @helix4u.
Infographic