Repository navigation
Studio: dock the floating Live monitor beside Run settings - #11699
Merged
wasimysaid merged 17 commits intoSep 24, 2026
Merged
Conversation
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)
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)
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)
…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)
`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)
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)
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)
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.
shaojun
pushed a commit
to shaojun/unsloth
that referenced
this pull request
Sep 29, 2026
…#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]>
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
Keep Studio's floating Live monitor clear of the Run settings panel: dock it immediately to the panel's left at desktop widths, keep its right-edge placement when the panel closes, and yield to the full-screen sheet at narrow widths. Replacement for #6993, originally proposed by @Imagineer99; the original issue is #6988.
Upstream
mainanchors both the monitor and the settings panel to the bottom-right corner, so opening the panel paints it over the monitor and the user has to close one to read the other.What changed
floating-monitor-layout.ts) returns whether the monitor is visible and whether it docks, fromisOpen,isMobile, the route andsettingsPanelOpen.use-chat-settings-width, so the two never overlap at any width the panel can be dragged to (248–560 px).--ui-space-scale, so the supported 20 px interface font keeps the same 4 px gap instead of reintroducing an overlap.Main versus replacement
Real authenticated Studio built from source at each pin, driven with real Chromium. Left is the before side, right is the head.
1280×800, Run settings open — main overlaps the monitor by 256 px; the replacement docks it with 4 px clearance and no overlap.
720×800, modal Run settings — main's monitor still paints over the sheet's controls even though it is
aria-hidden; the replacement suppresses it and makes its grip unreachable.1280×800 at the supported 20 px UI font — main overlaps by 250.67 px; the replacement keeps 0 px, with
containerRightscaling to277.333px(= 272 + 4 × 1.3333).Verification
f5109b587f17c056containerRight16px(rest)277.333px= 272 + 4 × 1.3333e55c9b58stayed at its docked 748scene-7f17.py, sha256fd1fc6364d30411c54aba8cc79c9edd56cc1953861b5ad8ca289d4360bae64ee. 22 captures per variant; pair 0 (panel closed) is byte-identical between main and the measured head, so both sides start from the same frame.evidence.json,SHA256SUMS.txt); all three servers were stopped and every variant left with 0 dirty tracked files.8b6f29844passes 12/12 dock tests and 8,637/8,637 frontend tests.npm run typecheckandnpm run buildpass; the bundle is within budget (61.3 KB transfer, 200.2 KB raw spare). No model load is needed for this layout check.No credentials or server logs are included in the evidence; only screenshots, geometry facts and hashes.
Credit: @Imagineer99 for the original implementation and investigation.
Codex review on fork PR #206 found no major issues at the earlier
7f17c056head; it has not been repeated on the merged head.