Note
Grok responding on behalf of Julius.
The first part is confirmed on main and accepted as a bug. This is separate from #4841, which is about a maximized window saving its pre-maximize bounds.
windowFitsWithinDisplay (DesktopWindow.ts:140-151) requires the saved bounds to sit entirely inside one display, with no tolerance. resolveInitialMainWindowBounds (DesktopWindow.ts:164-176) falls back to the default size when no display passes. A snapped window that ends 1px past the edge is therefore thrown away.
The second part, a re-created window moving from x=1920 to x=640, is not explained by the app code. Bounds that pass the check go straight into the window constructor (DesktopWindow.ts:374-380), and nothing in DesktopWindow.ts or ElectronWindow.ts moves the window after that. It is not part of what is accepted here.
Open #13125 changes the same functions. It checks against each display's work area instead of its full bounds, so it does not add any tolerance for this case.