Skip to content

[Windows][Desktop] Window height stretches far beyond the monitor after minimizing and restoring with Alt+Tab (dual monitor, extended display set as primary) #42493

Open

Description

@ruiwarn

What version of the Codex App are you using (From "About Codex" dialog)?

26.901.1978.0 (Microsoft Store package OpenAI.Codex_26.901.1978.0_x64__2p2nqsd0c76g0)

What subscription do you have?

N/A

What platform is your computer?

Windows 11 x64, laptop + one external monitor. The external monitor is set as the primary display, and the Codex window is opened on it.

What issue are you seeing?

After minimizing the Codex window and switching back to it with Alt+Tab, the window's HEIGHT becomes abnormally tall — it extends far beyond the bottom edge of the monitor, while its WIDTH stays unchanged. The window looks stretched vertically and no longer fits on screen.

Workarounds: clicking the Maximize button, or manually dragging/resizing the window back inside the screen bounds. This is required after every occurrence.

Steps to reproduce

  1. Use a laptop + external monitor setup with the external monitor set as the primary display.
  2. Open the Codex window on the primary (external) monitor.
  3. Minimize the Codex window.
  4. Switch back to Codex with Alt+Tab.
  5. Observe: the window height is now much larger than the monitor height (width unchanged); most of the window is off-screen below.

Reproducibility: 100% — happens on every minimize + Alt+Tab cycle.

This has been present for several months across multiple app updates.

What is the expected behavior?

The restored window keeps its previous size and position and is fully visible on its monitor.

Related issues

These are related but not identical: this bug is specifically about a vertical height explosion after a minimize + Alt+Tab restore, with unchanged width.

Activity

  1. added
    bug
    app
    windows-os
    on Sep 3, 2026
  2. wbdb commented on Sep 4, 2026

    @wbdb

    Duplicate :) #25826

  3. ruiwarn commented on Sep 7, 2026

    @ruiwarn
    Author

    Thanks for the cross-reference, but this isn't a duplicate of #25826 — the trigger path and the failure mode are different. I'd ask that it be tracked separately.

    #25826 — native maximize

    • Trigger: clicking the Maximize button.
    • Symptom: a thin horizontal strip (~7–13 physical px) of the maximized frame bleeds across the shared edge onto the adjacent monitor.
    • Root-cause direction: the maximized window's bounds are not clipped to the selected monitor.

    This issue (#42493) — minimize + Alt+Tab restore

    • Trigger: normal (non-maximized) window → minimize → restore via Alt+Tab. No maximize step involved.
    • Symptom: the window's height grows far beyond the bottom of the monitor (width stays the same); most of it is pushed off-screen vertically.
    • Root-cause direction: on restore, the window is re-sized/re-positioned with a wrong monitor/DPI calculation for the (non-maximized) placement.

    These are two different window-manager code paths (restore vs. maximize) and the overflow is along different axes (vertical height vs. horizontal edge), so they can't share a single fix. The related-issues note in the original report already flagged them as "related but not identical."

    For reproducibility: 100% on every minimize + Alt+Tab cycle. Laptop + external monitor, external set as primary, Codex window on the primary. Version 26.901.1978.0.

    Could a maintainer please keep this open as its own bug?

  4. ruiwarn commented on Sep 7, 2026

    @ruiwarn
    Author

    Following up with some reverse-engineering evidence from the shipped Windows build (MSIX package OpenAI.Codex_26.901.6511.0, Electron app). The desktop app's main-process bundle is closed source, so this is static analysis of the compiled app.asar — strong pointers, not a confirmed line-level root cause.

    What I found in the main process (main-*.js)

    1. The primary window uses a custom window-manager layer, not a plain BrowserWindow: it maintains an "anchor" + mascotSize and recomputes all geometry from screen.getDisplayMatching(...).workArea/.bounds via applyLayout() / restoreBoundsForDisplay() / persistWindowBounds(). So on every show/restore the window size is recomputed, not just restored — consistent with the observed "height changes, width stays" behavior.

    2. The display-change geometry self-correction is disabled on Windows. The handler that listens for display-added / display-removed / display-metrics-changed and re-clamps window geometry (installDisplayChangeGeometryRefresh) begins with:

      if (process.platform !== 'darwin') return null;
      

      On macOS it re-applies setBounds(getBounds()) after display changes — but only when the window is not minimized/maximized/fullscreen:

      !(e.isMinimized() || e.isMaximized() || e.isFullScreen()) && e.setBounds(e.getBounds(), false)
      

      So on Windows, a display-metrics/layout change while the window is minimized has no correction path at all before Alt+Tab restore. My repro is exactly: minimize → (display metrics change / taskbar reflow during minimize) → Alt+Tab restore → wrong height.

    3. The restore path (restoreBounds) on Windows also derives the target size from getDisplayMatching(normalBounds).workAreaSize and computes frame insets from getBounds() vs getContentBounds() — so a stale/wrong display or work-area snapshot during minimize can feed the recompute on restore.

    Suggested fix direction

    Install the display-metrics correction on Windows too (and/or, on restore/show, if the resulting bounds exceed the current display's work area by more than a small tolerance, clamp height/position to the work area while preserving width when only height is wrong). A minimal guard on the restore path that validates the recomputed bounds against getDisplayMatching().workArea before setBounds should cover both this bug and the #25826 maximize variant.

    Happy to share the exact bundle offsets / decompiled snippets if helpful for triage.

  5. BenoitDeRycke commented on Oct 20, 2026

    @BenoitDeRycke

    Additional measured reproduction: mixed-DPI restore overflow depends on left/right monitor arrangement

    Investigated on 20 October 2026. The affected installed app is displayed as ChatGPT, with executable ChatGPT.exe and retained MSIX identity OpenAI.Codex_26.1013.4894.0_x64. The desktop updater reports 26.1013.40934, build 20770, production, and returned up_to_date.

    This adds a related maximized-window restore reproduction to this issue. It does not establish that all restore/maximize reports share the same internal cause.

    Environment and reproduction

    • Windows 11 x64, build 26200.
    • Laptop physically and logically left: 2880 × 1800, 200%, bounds (-2880,0)-(0,1800), non-primary.
    • External monitor right and primary: 1920 × 1080, 100%, bounds (0,0)-(1920,1080); usable work area 1920 × 1032.
    • Top edges aligned at y=0.
    • Open/maximize ChatGPT on the external display so it fits, minimize it for several seconds, then restore it there. The height grows beyond the screen. Manually restoring down and maximizing can temporarily return it to the correct work area, but the minimize/restore problem recurs.
    • The user also reports oversized reopening after using the window's X and reopening through the notification area.
    • With both displays at 100%, the user reports that the problem disappears. Opera GX behaves correctly in the preferred mixed-DPI configuration.

    Native measurements in the failing state

    Measurement Result
    Native window rectangle (0,0)-(1920,1200)
    Client size 1920 × 1200
    DWM visible frame (0,0)-(1920,1193)
    External work area (0,0)-(1920,1032)
    Native placement showCmd=3 (maximized)
    Window DPI / awareness 96 / Per-Monitor V2
    System DPI queried from diagnostic thread 96
    Subsequent WM_GETMINMAXINFO response Minimum tracking size 480 × 600
    Native normal placement, separate failing-state capture 1225 × 1200
    App's persisted normal bounds in that capture 1225 × 852, isMaximized=true

    The entire native window is too tall, rather than only its text or controls. The persisted bounds do not themselves contain the observed 1200-pixel height.

    Restore trace and layout-only control test

    Read-only native sampling at approximately 500 ms intervals used GetWindowRect, GetWindowPlacement, GetDpiForWindow, MonitorFromWindow(..., MONITOR_DEFAULTTONEAREST), and a bounded WM_GETMINMAXINFO query. Measurements are sequential API reads, not an atomic snapshot or an internal message trace.

    One failing transition in the original laptop-left layout was:

    Phase Placement Native rectangle/size Monitor returned Window DPI Reported minimum height
    Before minimize Maximized 1920 × 1032 at (0,0) External 96 600
    Minimized Minimized 160 × 28 at (-32000,-32000) External 96 600
    During restore Maximized, rectangle still at minimized coordinates 160 × 28 at (-32000,-32000) Laptop 96 600
    Next sample, approximately 519 ms later Maximized 1920 × 1200 at (0,0) External 96 600

    For a controlled test, only the laptop's Windows desktop position was temporarily changed from (-2880,0) to (1920,0), making the external monitor leftmost. Both resolutions, both scaling percentages, and the external primary designation stayed unchanged.

    With that arrangement, five recorded minimized-to-restored transitions all returned to 1920 × 1032 at 96 DPI, using the same native window/process, and the user confirmed that it fitted.

    The original laptop-left arrangement was then restored. Reversing mouse traversal does not match the physical setup and is not an acceptable permanent workaround.

    This supports investigating a layout-sensitive monitor/DPI calculation during restore. It does not prove the exact internal conversion, a transient minimum-size change, or that the application itself observes the same monitor result as the diagnostic sampler. The fact that 1200 is twice 600 is not being presented as proof of double scaling.

    Other tests and their limits

    • Application DPI compatibility override (~ HIGHDPIAWARE), followed by an app restart: problem persisted; observed window remained PMv2.
    • System override (~ DPIUNAWARE), followed by an app restart: problem persisted; observed window remained PMv2.
    • Both entries were removed, and absence of the app-specific compatibility entry was verified.
    • System (Enhanced) was not tested.
    • A proposed saved-window-state reset helper exited before modifying state. A completed state reset is not claimed for this reproduction.
    • An optional --force-device-scale-factor=1 launcher was prepared but not applied/tested; forcing ChatGPT to 100% on the laptop would not meet the user's requirement.
    • No app package files were modified. No reinstall, driver replacement, or Windows reboot was performed.

    Expected result

    Keep the laptop left at 200% and external monitor right at 100%, with normal per-monitor rendering on both displays. Repeatedly restoring ChatGPT on the external display should keep the visible window inside its 1920 × 1032 work area.

    Please investigate the Windows desktop shell/runtime restore path and its monitor selection and DPI-unit handling before applying size constraints. Related report: #54518. The exact code-level cause remains unconfirmed.

    This comment contains sanitized diagnostic results only; local usernames/paths, native window/monitor identifiers, account data, and conversation contents have been omitted.

    Follow-up control: laptop primary, original physical left/right order

    A further test on 20 October 2026 made the laptop primary at (0,0) and kept the external monitor to its right at (2880,0). Both monitor rectangles then had nonnegative coordinates. Laptop resolution/scaling remained 2880 × 1800 / 200%; external remained 1920 × 1080 / 100%.

    The same ChatGPT window began at (2880,0)-(4800,1032), window DPI 96. In two recorded minimize/restore cycles, it grew to (2880,0)-(4800,1200), i.e. 1920 × 1200, with DPI still 96 and queried minimum height 600. The diagnostic system-DPI query was 192 with the laptop primary. The user confirmed it remained oversized.

    Removing negative monitor coordinates and changing the primary display did not prevent the bug. Negative-coordinate handling alone is therefore not a sufficient explanation. The earlier wrong-monitor/scale interpretation remains an unconfirmed hypothesis. This is an in-session test of the same running app, not a fresh-launch test with the laptop primary.

    The original external-primary arrangement was restored and verified: laptop left at (-2880,0), external at (0,0), original resolutions and 200%/100% scaling. No test layout remains active.

  6. ANTiqiuSama commented on Oct 29, 2026

    @ANTiqiuSama

    Additional controlled layout comparison on a four-monitor Windows setup

    Environment:

    • Windows 11 25H2, build 26200.9711
    • Codex desktop 26.1013.31256, build 20586
    • MSIX package OpenAI.Codex_26.1013.3656.0_x64
    • Normal per-monitor scaling; no forced device-scale-factor
    • No post-restore resize helper running during the comparison

    Original physical display arrangement:

    • DISPLAY1: (-3840, 0) to (0, 2160), 192 DPI
    • DISPLAY3, primary: (0, 0) to (1920, 1080), 96 DPI
    • DISPLAY2: (1920, 0) to (3000, 1920), 96 DPI
    • DISPLAY4: (-1054, -2160) to (2786, 0), 192 DPI

    On the primary display, one normal-window cycle changed from
    1016 × 720 before minimization to 1016 × 1200 after restoration.
    In a separate minimized-state measurement with the same arrangement,
    GetWindowRect returned the minimized sentinel rectangle at
    (-32000, -32000). MonitorFromRect with MONITOR_DEFAULTTONEAREST
    selected DISPLAY1 at 192 DPI. MonitorFromWindow selected the primary
    DISPLAY3, while GetDpiForWindow returned 96 DPI. A bounded
    WM_GETMINMAXINFO query reported a minimum tracking size of 480 × 600.

    For the control, only the display positions were temporarily changed:
    the 96-DPI primary was the leftmost display, with all other displays
    to its right and top-aligned. Resolutions, scaling percentages, the
    primary designation, the app process, and the native window remained
    unchanged. In this arrangement, MonitorFromRect selected the primary
    96-DPI display for the minimized rectangle. One recorded normal-window
    cycle preserved 1016 × 623 before and after restoration.

    The app was minimized through its title-bar control and restored through
    the registered application activation path. The starting heights in the
    two recorded cycles differed, and this is one recorded cycle per layout.

    The values are consistent with a possible 600 × 2 = 1200 minimum-height
    conversion; 480 × 2 = 960 would remain below the observed width of 1016.
    However, these observations do not establish that Owl calls
    MonitorFromRect on the minimized rectangle or that this conversion is
    the internal cause. The queried window DPI and minimum tracking size
    remained 96 DPI and 480 × 600.

    The original arrangement was restored approximately; the user accepted
    a 52-physical-pixel horizontal offset of the upper display. The temporary
    post-restore helper and its startup entry remain disabled.

    Could the Windows/Owl restore path be checked for monitor selection and
    DPI-unit conversion while a window is minimized, including whether it
    uses the minimized sentinel rectangle or the pre-minimize window bounds?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appbugwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions