fix(studio): stop inactive Nebula animations - #1404
Draft
BrianNewsom wants to merge 2 commits into
Draft
Conversation
Signed-off-by: Brian Newsom <brnewsom@nvidia.com>
Contributor
|
Signed-off-by: Brian Newsom <brnewsom@nvidia.com>
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
NeMo Studio kept the empty-chat
Nebulaanimation running after the compact Assistant popover closed and after other empty-chat canvases unmounted. A single open and close of the top-bar Assistant was enough to leave the hidden animation consuming sustained renderer CPU; repeated chat lifecycles could additionally retain detached animation loops.This change unmounts the compact Assistant thread when its popover closes, cancels the active animation frame during
Nebularef cleanup, and releases the retained animation state.Changes
requestAnimationFramewhenNebulaunmounts or reinitializes.Nebulamount/unmount cycles.Type of Change
Quality Gates
Verification
Signed-off-by:traileruv run pre-commit run -apasses, or any blocked checks are identified belowActual Studio reproduction
On
main, with NeMo Assistant enabled:The KUI popover hides its content without unmounting it. Before this fix, the compact Assistant thread and its
Nebulacanvas therefore remained mounted after close, andrequestAnimationFramecontinued processing 250 particles plus 31,125 particle-pair connection checks every frame while the UI was hidden.The actual bundled Studio frontend was run against its configured development backend in system Chrome. Chrome DevTools Protocol sampled five-second
TaskDurationandScriptDurationdeltas on the Agents route.main)main)main)With this fix, closing the popover unmounts the compact thread; the shared
Nebulacleanup cancels its frame, and the renderer returns to idle.Detached-loop reproduction
The same shared empty state is used by model chat and full Assistant chat. On
main, sending the first message or navigating away unmounts the empty state but leaves its frame loop active. A Playwright lifecycle harness automated ten mount/unmount cycles against theorigin/mainsource and this branch:origin/mainAn unminified baseline CPU profile identified quadratic
drawConnectionsas the dominant function, followed by canvasstroke, particledraw, and garbage collection. The fixed profile was idle.Targeted validation:
pnpm --filter nemo-studio-ui test src/routes/agents/AssistantChatRoute/AssistantTopBarChat.test.tsx— passed (8 tests).pnpm --filter @nemo/common test src/components/Nebula/index.test.tsx— passed (1 test).pnpm --filter nemo-studio-ui test— passed (315 files, 2,933 tests).pnpm --filter @nemo/common test— passed (121 files, 1,496 tests).pnpm --filter nemo-studio-ui typecheck— passed.pnpm --filter nemo-studio-ui lint— passed.VITE_FF_ASSISTANT_STUDIO_ENABLED=true pnpm --filter nemo-studio-ui build:dev— passed; this build was used for the actual-app Chrome measurements.pnpm --filter='...[origin/main]' run --parallel --if-present typecheck— passed for affected Common and Studio packages.pnpm --filter='...[origin/main]' run --parallel --if-present test:ci— passed with coverage before the Assistant-specific regression was added (Common: 1,496 tests; Studio: 2,898 tests); the updated full Studio suite above passed afterward.uv run pre-commit run -a— code-related hooks passed, including Ruff, Ruff format,ty, config-reference validation, lock checks, copyright headers, UI lint-staged, merge-conflict detection, and Flox-lock validation. The overall command is blocked on host prerequisites unrelated to this change:helm-docsis not installed, andyqis unavailable to three toolchain-version consistency hooks.Local pnpm commands ran with pnpm 10.34.5 under Node 24.18.0 because Flox is not installed on this host; the repository requests Node 22.23.2, so pnpm emitted an engine warning. All listed web checks still passed.