Repository navigation
Studio NPU: name Smart App Control blocks instead of a 500 or a silent picker - #18549
danielhanchen wants to merge 1 commit into
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Tested on Strix Halo (Ubuntu 24.04, FastFlowLM 1.0.12, Lemonade 2026.44.1) at
Picker with the NPU list failing (left: main, then this PR on Discover and On Device): How this relates to #18528. Both PRs show the NPU list error in the picker on Discover. They cover different backend failures:
Picking and loading an NPU model still works on this PR at Not tested on a real Windows Smart App Control block. |
|
Closing in favour of #18528, which is now merged. It covers the same lemond spawn and list failures, and I ported the two |
…of an empty reason (#18648) **Problem:** On Windows, when Smart App Control or an App Control policy refuses one of FastFlowLM's DLLs, `flm.exe` exits with 0xC0E90002 and prints nothing. Since #18554, Enable NPU then fails with "Installing FastFlowLM failed: FastFlowLM does not run:" and no reason. **Change:** `flm_host.py` reports the exit code when flm prints nothing. Enable recognizes the code integrity status in that error and shows the message Studio already uses for these blocks, which names the blocked folder. **Status:** Tested on the AMD DevLab Windows runner (Strix Halo), `main` against this branch, with `flm.exe` replaced by a stub that exits 0xC0E90002 without output.  ## Details - `flm_host.py`: `Flm.run` turns a failed run with no output into `[ERROR] exit code N (0xC0E90002)`. - `npu_backend.py`: when FastFlowLM's install check fails, the reason goes through the existing `_blocked_message`. Any other failure keeps "Installing FastFlowLM failed: ...". - Loading a model already explained a silent refusal through `_explain`, so the load path is unchanged. A test now covers it. ## Not covered The runner has Smart App Control off, so the refusal comes from the stub, not from a real policy. The exit status and the empty output match what #18549 recorded on a machine with Smart App Control on. ## Testing - New tests for the install message, an ordinary install failure, the load message, and the exit code text. The install-message and exit-code tests fail on `main`. - NPU backend suites: 729 passed, 1 skipped.

On Windows with Smart App Control on, the NPU silently disappeared from the chat model picker. Windows refused to start the unsigned
lemond.exe(WinError 4551), theOSErrorescapedLemonadeServer._start_once, and everyGET /api/npu/modelsreturned a 500. The picker only shows the NPU notice while the NPU is not set up, so a set-up NPU with a failing list showed nothing at all.Once Smart App Control allows
lemond.exe, the same machine fails one step later.flm.exelinks every model DLL, so a single refused DLL ends it with0xC0E90002and no output, and Enable reportedflm validate returned no report:with an empty reason.Changes
lemonade_server.py: a code integrity refusal while spawninglemond.exebecomesLemonadeUnavailablewithcode_integrity_user_message, the same wording llama.cpp already uses. Enable, the model list and load then report it as anNpuError(409, not 500). Retrying is skipped since a policy cannot clear itself. Other spawn errors are re-raised unchanged.npu_backend.py:flm validatenames the policy both when the spawn is refused and when it exits0xC0E90002/-1058471934without a report. Other silent exits keep the old wording.composer-model-picker.tsx: the NPU section and its notice also render when the list failed (listError), so the reason is shown. It still hides while searching, as for an NPU that is not set up.Testing
tests/test_npu_code_integrity.py(16 cases, cross-platform): WinError 4551 / 1260 / 577 and the policy text on spawn, no retry, log file closed, unrelatedOSErrors untouched, the 409 from the route, Enable state and error, andflm validaterefused at spawn or by DLL exit code. 7 of them fail onmain.main:flm validate returned no report:Windows blocked part of the local model runtime: Smart App Control or an Application Control policy blocked the image. The blocked file is under ...\cache\bin\flm\npu. ...lemond.exe(before Smart App Control later allowed it),start()raised the new message from the realWinError 4551.node --test, and typecheck all pass. The real app was run on vite with/api/npu/modelsanswering 409. The notice with the reason showed in Chromium and Edge (Windows), and in Chromium, Firefox and WebKit (Linux). Onmainthe notice does not appear (negative control).main: onlyLemonadeServer._start_once,LemonadeNpuBackend._validate, the imports and the new_blocked_messagechanged. Theruff-unslothformatting pass is AST-identical.Not covered: macOS (no NPU path there; the picker change was checked on WebKit). Making FastFlowLM itself run under Smart App Control needs signed
flm.exeand DLLs upstream. Its license only allows redistributing the binaries unmodified, so Studio cannot sign them itself.