Repository navigation
Fix live monitor occlusion by run settings - #6993
Imagineer99 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new LiveMonitorStatusChip component to display real-time RAM and VRAM usage in the chat page and resources tab, and implements collision avoidance logic for the FloatingMonitor component when the chat settings panel is open. The feedback recommends correcting the Tailwind CSS important modifier syntax in the tooltip's class name to ensure proper styling.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| side="bottom" | ||
| sideOffset={8} | ||
| variant="rich" | ||
| className="[&_span>svg]:hidden!" |
There was a problem hiding this comment.
There was a problem hiding this comment.
Tailwind v4 supports postfix !, and this repo already uses "[&_span>svg]:hidden!" in a few existing components. Keeping this consistent with local style.
|
Live Studio E2E validation on an exact PR-head fork branch passed.
Screenshot from the run artifact: |
|
@codex review |
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
59ce0e4 to
eb3d028
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fea4254bf9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| className="pointer-events-none fixed inset-4 z-50" | ||
| className={cn( | ||
| "pointer-events-none fixed inset-y-4 left-4 z-40", | ||
| dockedBesideRunSettings ? "right-[18rem]" : "right-4", |
There was a problem hiding this comment.
Use the actual run-settings width for docking
When a desktop user widens Run Settings, the panel can still occlude the monitor because this fixed 18rem offset ignores the persisted, resizable settings width (248–560px). For example, at 560px the default 256px monitor lies entirely within the settings panel's horizontal area, and the panel's z-50 renders above this z-40 container, reproducing the issue this change is intended to fix.
Useful? React with 👍 / 👎.
| {visible && ( | ||
| <FloatingMonitorPanel | ||
| key={panelKey} | ||
| key={`${panelKey}-${dockedBesideRunSettings ? "docked" : "floating"}`} |
There was a problem hiding this comment.
Preserve monitor state when toggling run settings
When a desktop user opens or closes Run Settings, changing this key unmounts and recreates the panel. That discards both the hook's dragged position and the browser-owned inline resize dimensions, so a monitor the user moved or resized unexpectedly snaps back to its default geometry on every settings toggle instead of merely moving when a collision requires it.
Useful? React with 👍 / 👎.
| import assert from "node:assert/strict"; | ||
| import test from "node:test"; | ||
|
|
||
| import { getFloatingMonitorLayout } from "../../studio/frontend/src/components/floating-monitor-layout.ts"; |
There was a problem hiding this comment.
Put the layout test under the frontend test root
This test is not exercised by the repository's automated frontend checks: Frontend CI runs npm test from studio/frontend, whose script only matches tests/**/*.test.ts, while this file is a root-level .mjs and is also outside tsconfig.test.json's included tests directory. Consequently all five new assertions are silently skipped in CI, leaving the docking regression unprotected unless someone invokes this file manually.
Useful? React with 👍 / 👎.
|
Confirmed the overlap the issue describes still happens in studio/frontend/src/components/floating-monitor.tsx, and the docking direction looks right, but this hardcodes the panel offset as right-[18rem] and swaps the shared z-layer zIndex for a literal z-40. Could you keep the z-layer value and derive the offset from the run settings panel width, and rebase since the branch now conflicts? |
|
The docking behaviour still looks right, but the branch is now stale: main sets the container layer via the shared z-layers value in studio/frontend/src/components/floating-monitor.tsx and this replaces it with a literal z-40, which would drop the monitor back under the notification stack. Could you rebase, keep the shared z-layer, and derive the offset from the run settings panel width instead of a hardcoded right offset? |
|
Live Studio A/B — docking/occlusion reproduced; the offset regresses on wider panels Head
So the interaction is real, but the fix is hardcoded ( |
The Live resource monitor is anchored to the bottom-right corner, which is exactly where the Run settings panel opens, so opening the panel covered the monitor and the user had to close one to read the other. Decide the monitor's placement from the panel's own state instead: dock it to the panel's left edge while the panel is open on /chat, and yield to the sheet on a narrow viewport, where there is no room to stand beside it. The docked inset is the panel's live width from use-chat-settings-width, so the monitor clears it at every width the panel can be dragged to (248-560 px). Adapted from unslothai#6993 onto current main. The original hardcoded an 18rem offset (correct only near the 272 px default, and fully occluded at the 560 px maximum) and replaced the shared floating-panel z-layer with a literal `z-40`, which puts the bottom-right notification stack back over the monitor; both are kept on main's terms here. Its regression test also shipped as a root-level .mjs that the configured frontend runner never collected, so it moved to studio/frontend/tests/. (cherry picked from commit fb9cc19)
|
The branch still hardcodes right-[18rem] and replaces the shared z-layer with z-40 in floating-monitor.tsx, so could you derive the offset from the run settings panel width and keep the z-layer value? Could you also take a look at the Chat UI Tests failures and rebase onto main? |
The Live resource monitor is anchored to the bottom-right corner, which is exactly where the Run settings panel opens, so opening the panel covered the monitor and the user had to close one to read the other. Decide the monitor's placement from the panel's own state instead: dock it to the panel's left edge while the panel is open on /chat, and yield to the sheet on a narrow viewport, where there is no room to stand beside it. The docked inset is the panel's live width from use-chat-settings-width, so the monitor clears it at every width the panel can be dragged to (248-560 px). Adapted from unslothai#6993 onto current main. The original hardcoded an 18rem offset (correct only near the 272 px default, and fully occluded at the 560 px maximum) and replaced the shared floating-panel z-layer with a literal `z-40`, which puts the bottom-right notification stack back over the monitor; both are kept on main's terms here. Its regression test also shipped as a root-level .mjs that the configured frontend runner never collected, so it moved to studio/frontend/tests/. (cherry picked from commit fb9cc19)
* fix(studio): dock the live monitor beside the run settings panel The Live resource monitor is anchored to the bottom-right corner, which is exactly where the Run settings panel opens, so opening the panel covered the monitor and the user had to close one to read the other. Decide the monitor's placement from the panel's own state instead: dock it to the panel's left edge while the panel is open on /chat, and yield to the sheet on a narrow viewport, where there is no room to stand beside it. The docked inset is the panel's live width from use-chat-settings-width, so the monitor clears it at every width the panel can be dragged to (248-560 px). Adapted from #6993 onto current main. The original hardcoded an 18rem offset (correct only near the 272 px default, and fully occluded at the 560 px maximum) and replaced the shared floating-panel z-layer with a literal `z-40`, which puts the bottom-right notification stack back over the monitor; both are kept on main's terms here. Its regression test also shipped as a root-level .mjs that the configured frontend runner never collected, so it moved to studio/frontend/tests/. (cherry picked from commit fb9cc19) * fix(studio): keep the docked monitor clear of the live panel width Four follow-ups on the docking behaviour, each with a test that fails on the previous revision: - Follow the panel's painted width, not only the stored one. The resize handle paints --chat-settings-width per frame and commits to the store on pointer up, so the monitor trailed the panel by a whole drag. - Yield when a pinned sidebar leaves no room to dock. At the 768 px breakpoint the default sidebar and panel leave less than the monitor's own width, and docking there covered the sidebar rather than the panel. - Restore the position the user dragged to when the dock is removed: the narrowed container clamps it and place() then keeps the clamped spot. - Keep the monitor mounted while the settings panel covers it, so opening the panel no longer discards the dragged position and the resize dimensions. (cherry picked from commit 12ac921) * fix(studio): close three gaps in the monitor's dock and yield path Codex round 3 on the previous head flagged three follow-ups: - Suppression withholds the monitor's frame from the API monitor, but visibility and aria-hidden fire no ResizeObserver, so ending suppression never put the box back. `hidden` now feeds the existing republish effect. - Crossing the mobile breakpoint replaces the desktop <aside> with the settings sheet and back while Run settings stays open, leaving the painted width observer attached to a disconnected node. The effect reattaches. - Docking reserved a fixed 256 px for the monitor, but the panel is natively resizable, so a widened monitor could dock over the sidebar. The capacity check now reserves the width the panel actually renders. (cherry picked from commit 695f9d0) * fix(studio): keep the monitor's dock decision live across responsive changes Codex round 4 on the previous head flagged two follow-ups: - Sidebar swaps its desktop element for a sheet across the mobile breakpoint and back, so the painted-width observer stayed attached to a disconnected node and its stale width kept overriding the committed one. The effect reattaches on the breakpoint, as the settings-panel observer already does. - The capacity check read window.innerWidth during render, so it only re-evaluated when useIsMobile crossed 768px or a width store changed. Both width stores saturate at their maxima, so resizing from 1600px to 1500px could leave a docked monitor overlapping the sidebar. It now tracks the viewport through its own resize subscription. (cherry picked from commit 49b339d) * fix(studio): reserve the monitor's real width, not the scaled constant `dockedMonitorFits` floored the measured width at `FLOATING_MONITOR_WIDTH`. Tailwind's spacing token is `calc(0.25rem * var(--ui-space-scale, 1))`, so at a 12px UI font (`--ui-space-scale: 0.8`) a `w-64` monitor renders 205px and the floor over-reserved by 51px. An 800px desktop with the default 280px sidebar and a 272px panel leaves 248px, which fits the real monitor but not the floor, so the dock was suppressed and the monitor disappeared. The constant now only supplies the pre-first-measure default; a finite measured width is used as-is. Adds the narrow-viewport regression alongside it. (cherry picked from commit 91cd246) * fix(studio): reserve the icon rail and reconcile when suppression ends Two transitions left the dock decision or the restored position wrong: - Suppressed and undocked both paint the full-width container, so leaving suppression resizes no observed element and the queued position restore was never applied; the monitor reappeared at its dock-clamped spot. The transition now runs the same reconcile the observers would have. - An unpinned web sidebar still holds the 3rem icon rail as a column (`collapseToZero` is desktop-app only), so reserving zero let a docked monitor sit on the rail. The measured rail is reserved while the sidebar really is one. (cherry picked from commit 39393e5) * fix(studio): keep the settings grip and the saved spot usable Two docked-state interactions were wrong: - The docked inset ended exactly at the aside's left edge, but the resize handle is a `-left-1 w-2` target, so its outer 4px sat under the monitor's layer and the grip lost half its width. The docked inset now clears it. - `startDrag` cleared the saved position on pointer-down, so pressing the grip without moving discarded the placement the undock restore replays. The position is now only replaced once a move actually happens. (cherry picked from commit 6d4c1cf) * fix(studio): scale the monitor's clearance with the UI space scale The settings aside's resize handle is `-left-1 w-2`, and both halves resolve through Tailwind's `--spacing: calc(0.25rem * var(--ui-space-scale, 1))`. The docked monitor reserved a pinned 4px for the outward half, which is only right at the 15px default UI font: at the supported 20px maximum the handle reaches 5.333px outside the aside, so the monitor's above-panel layer covered its outer 1.33px along the whole shared height. Derive the clearance from the live `--ui-space-scale` instead, threaded from the appearance store through `useUiSpaceScale`, and pin the pair in the dock regression test: the shipped CSS keeps `--spacing` scaled, the clearance tracks it at 12/15/20px, and the default still resolves to the shipped 4px. * fix(studio): address monitor dock review findings * fix(studio): keep dock anchor on vertical drags * Defer floating monitor bundle until opened * Restore eager monitor mount and align budget with current main * Scale restored monitor inset with UI font * Preserve saved monitor placement when docked drag returns to start * Keep monitor anchored after net-zero dock drag * Format overlay layering test with pinned Ruff hook --------- Co-authored-by: imagineer99 <[email protected]>
…#11699) * fix(studio): dock the live monitor beside the run settings panel The Live resource monitor is anchored to the bottom-right corner, which is exactly where the Run settings panel opens, so opening the panel covered the monitor and the user had to close one to read the other. Decide the monitor's placement from the panel's own state instead: dock it to the panel's left edge while the panel is open on /chat, and yield to the sheet on a narrow viewport, where there is no room to stand beside it. The docked inset is the panel's live width from use-chat-settings-width, so the monitor clears it at every width the panel can be dragged to (248-560 px). Adapted from unslothai#6993 onto current main. The original hardcoded an 18rem offset (correct only near the 272 px default, and fully occluded at the 560 px maximum) and replaced the shared floating-panel z-layer with a literal `z-40`, which puts the bottom-right notification stack back over the monitor; both are kept on main's terms here. Its regression test also shipped as a root-level .mjs that the configured frontend runner never collected, so it moved to studio/frontend/tests/. (cherry picked from commit fb9cc19) * fix(studio): keep the docked monitor clear of the live panel width Four follow-ups on the docking behaviour, each with a test that fails on the previous revision: - Follow the panel's painted width, not only the stored one. The resize handle paints --chat-settings-width per frame and commits to the store on pointer up, so the monitor trailed the panel by a whole drag. - Yield when a pinned sidebar leaves no room to dock. At the 768 px breakpoint the default sidebar and panel leave less than the monitor's own width, and docking there covered the sidebar rather than the panel. - Restore the position the user dragged to when the dock is removed: the narrowed container clamps it and place() then keeps the clamped spot. - Keep the monitor mounted while the settings panel covers it, so opening the panel no longer discards the dragged position and the resize dimensions. (cherry picked from commit 12ac921) * fix(studio): close three gaps in the monitor's dock and yield path Codex round 3 on the previous head flagged three follow-ups: - Suppression withholds the monitor's frame from the API monitor, but visibility and aria-hidden fire no ResizeObserver, so ending suppression never put the box back. `hidden` now feeds the existing republish effect. - Crossing the mobile breakpoint replaces the desktop <aside> with the settings sheet and back while Run settings stays open, leaving the painted width observer attached to a disconnected node. The effect reattaches. - Docking reserved a fixed 256 px for the monitor, but the panel is natively resizable, so a widened monitor could dock over the sidebar. The capacity check now reserves the width the panel actually renders. (cherry picked from commit 695f9d0) * fix(studio): keep the monitor's dock decision live across responsive changes Codex round 4 on the previous head flagged two follow-ups: - Sidebar swaps its desktop element for a sheet across the mobile breakpoint and back, so the painted-width observer stayed attached to a disconnected node and its stale width kept overriding the committed one. The effect reattaches on the breakpoint, as the settings-panel observer already does. - The capacity check read window.innerWidth during render, so it only re-evaluated when useIsMobile crossed 768px or a width store changed. Both width stores saturate at their maxima, so resizing from 1600px to 1500px could leave a docked monitor overlapping the sidebar. It now tracks the viewport through its own resize subscription. (cherry picked from commit 49b339d) * fix(studio): reserve the monitor's real width, not the scaled constant `dockedMonitorFits` floored the measured width at `FLOATING_MONITOR_WIDTH`. Tailwind's spacing token is `calc(0.25rem * var(--ui-space-scale, 1))`, so at a 12px UI font (`--ui-space-scale: 0.8`) a `w-64` monitor renders 205px and the floor over-reserved by 51px. An 800px desktop with the default 280px sidebar and a 272px panel leaves 248px, which fits the real monitor but not the floor, so the dock was suppressed and the monitor disappeared. The constant now only supplies the pre-first-measure default; a finite measured width is used as-is. Adds the narrow-viewport regression alongside it. (cherry picked from commit 91cd246) * fix(studio): reserve the icon rail and reconcile when suppression ends Two transitions left the dock decision or the restored position wrong: - Suppressed and undocked both paint the full-width container, so leaving suppression resizes no observed element and the queued position restore was never applied; the monitor reappeared at its dock-clamped spot. The transition now runs the same reconcile the observers would have. - An unpinned web sidebar still holds the 3rem icon rail as a column (`collapseToZero` is desktop-app only), so reserving zero let a docked monitor sit on the rail. The measured rail is reserved while the sidebar really is one. (cherry picked from commit 39393e5) * fix(studio): keep the settings grip and the saved spot usable Two docked-state interactions were wrong: - The docked inset ended exactly at the aside's left edge, but the resize handle is a `-left-1 w-2` target, so its outer 4px sat under the monitor's layer and the grip lost half its width. The docked inset now clears it. - `startDrag` cleared the saved position on pointer-down, so pressing the grip without moving discarded the placement the undock restore replays. The position is now only replaced once a move actually happens. (cherry picked from commit 6d4c1cf) * fix(studio): scale the monitor's clearance with the UI space scale The settings aside's resize handle is `-left-1 w-2`, and both halves resolve through Tailwind's `--spacing: calc(0.25rem * var(--ui-space-scale, 1))`. The docked monitor reserved a pinned 4px for the outward half, which is only right at the 15px default UI font: at the supported 20px maximum the handle reaches 5.333px outside the aside, so the monitor's above-panel layer covered its outer 1.33px along the whole shared height. Derive the clearance from the live `--ui-space-scale` instead, threaded from the appearance store through `useUiSpaceScale`, and pin the pair in the dock regression test: the shipped CSS keeps `--spacing` scaled, the clearance tracks it at 12/15/20px, and the default still resolves to the shipped 4px. * fix(studio): address monitor dock review findings * fix(studio): keep dock anchor on vertical drags * Defer floating monitor bundle until opened * Restore eager monitor mount and align budget with current main * Scale restored monitor inset with UI font * Preserve saved monitor placement when docked drag returns to start * Keep monitor anchored after net-zero dock drag * Format overlay layering test with pinned Ruff hook --------- Co-authored-by: imagineer99 <[email protected]>





Summary
Fixes #6988.
live.monitor.mp4