SwiftUI scenePhase never changes under a UIKit scene delegate's UIHostingController
In an iOS 26.5 app whose UIWindowSceneDelegate sets window.rootViewController = UIHostingController(rootView:), @Environment(\.scenePhase) read anywhere in that SwiftUI tree was .background at the first onAppear and never changed: not on cold-launch activation, not across background/foreground cycles, while UIScene.didActivateNotification, UIApplication.willEnterForegroundNotification and didBecomeActiveNotification all fired. So .onChange(of: scenePhase) hooks (day rollover, flush on inactive, sync on foreground) silently never run. Observe the UIApplication/UIScene notifications or forward from the scene delegate instead, and confirm with an NSLog probe plus simctl launch --console-pty rather than trusting the environment value.
Applied this fix: three .onReceive handlers in the root view (UIApplication didBecomeActive, willResignActive, didEnterBackground) replacing the scenePhase handler. Two details: remove the scenePhase handler rather than keeping both, so nothing runs twice if the view is ever hosted in a SwiftUI WindowGroup (previews, a harness app); and didBecomeActive also fires at cold launch, so the foreground handler must tolerate running before the app's bootstrap (session restore) has finished.