Repository navigation
Conversation
flutter test often cannot foreground the macOS app ('Failed to foreground
app; open returned 1'). macOS then naps it, and on a busy host the napped
app gets no CPU for minutes, so the llama.cpp worker misses its 30 s startup
deadline. run_local_e2e now runs Flutter for -d macos device scenarios
through tool/testing/without_app_nap.sh, which disables App Nap for the
chat app and restores the previous setting afterwards.
Fixes #1674
Refs #1845
The bundle-id check reads AppInfo.xcconfig with either line ending, so it still runs on Windows. Refs #1674
leehack
added a commit
that referenced
this pull request
Nov 9, 2026
Owner
Author
|
Landed through the 0.19.2 batch integration PR #1870 (rebase merge, one commit per constituent; this PR's pinned head was audited/CI-gated there). |
Contributor
|
Chat app preview removed for |
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
flutter test -d macosoften cannot foreground the app it launches: the log showsFailed to foreground app; open returned 1, in the historical log and in every early run here. macOS then naps the app. On a busy host the napped app runs at scheduler priority 4 and gets almost no CPU. The llama.cpp worker misses its 30 s startup deadline, and the test fails with exactlyTimed out after 30000 ms waiting for the llama.cpp worker to initialize its backend. The runtime itself is fine.run_local_e2e.dartnow runs Flutter through the newtool/testing/without_app_nap.shfor every-d macosdevice scenario. The script setsNSAppSleepDisabledforcom.example.llamaDartChatExample, runs the command, then restores the previous value: absent, YES or NO. The exit status is kept. Other devices, and the host-only macOS quit/shutdown scenarios, are unchanged.Production-readiness scope
run_local_e2e.dartFlutter device scenarios with--device macos.Completeness checklist
PR type guidance
run_local_e2e_test.dart(every macOS device scenario is wrapped; iOS is not) andwithout_app_nap_script_test.dart(a fakedefaultschecks that App Nap is disabled during the command, that each prior state is restored, that the exit status is kept, and that the bundle id matchesAppInfo.xcconfig). The script tests are skipped on Windows. The bundle-id check runs on every platform. Platform: macOS hosts only.Test Plan
dart run tool/prepare_workspace.dartdart format --output=none --set-exit-if-changed .dart analyze: no issues.dart test -p vm -j 1 --exclude-tags local-only: rantest/unit/tooling/, 1619 passed.windows_registry_qualification_test.dartfails 6 cases identically on unmodifiedmainon this Mac. It is pre-existing and unrelated.dart test -p chrome --exclude-tags local-onlyN/A: VM tooling only.coverage-libmatrix row whenlib/behavior changes. N/A: nolib/change.chat-app-text-image-coexistence --device macosrerun: see Matrix Evidence.Matrix Evidence
origin/maintoolingNativeLlamaBackendstartups with the default 30 s deadlinepri 4, 0 % CPU. 1/20 startups failed with the exact historical error after 370 s wall time (the timer itself was starved)llamadart-evidence/issue-1674-lane6/NSAppSleepDisabledYES, same loadpri 47. These runs did not log the foreground failure (one hid the app), so the starvation pair below is the matched controlopen returned 1chat-app-text-image-coexistence --device macos57d19977…) CPU + SDXS-512 Q8_0 (409ab235…) MTL0, native llamav0.9.0, sdv0.3.0-3, 32 busy processes, host load 130–180,open returned 1(not foregrounded)pri 54withNSAppSleepDisabled=1during the run and the setting restored to absent afterwards. Both 32-token repliesd5208dd3…, both 512×512 imagesb5624e7d…(the same hashes as the 2026-11 maintainer runs), dispose OKcoexist-fixed-load32.log. Earlier unguarded runs under load never reachedtext_load: the napped app's SDXS download stalled at 504 MB for over 1.5 h, and through the guard it finished in 14 sReview Notes
classify_high_risk_changes.dart: standard).2e81b00d3319943be50940ee84ef0d058c796097(34 pass, 9 skipped by selection or manual). At the first head,2b96823, the Windows tooling shard failed because the Bash script tests ran without POSIX Bash. The second commit skips those on Windows, as the other script tests do, and makes the bundle-id check tolerate CRLF.High-risk regression review
Fixes #1674
Refs #1845