Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

Windows: a card taken out of the PC no longer decides the engine; only the display adapters Windows reports as present count when two makes are in the registry (#3892); test

Niko12210cd44323e4b1
diff --git a/strata_control/engine_component.py b/strata_control/engine_component.py
index bb4abcb80..586a1c633 100644
--- a/strata_control/engine_component.py
+++ b/strata_control/engine_component.py
@@ -627,7 +627,15 @@ def windows_display_adapters() -> list[dict]:
"""The display adapters Windows has a driver for: the display-class registry key (readable without admin and without running
anything), then Win32_VideoController when the key lists nothing: {"vendor": "10de"|"1002"|"8086"|..., "device": int, "name",
"vram_gb"}. Empty off Windows or when neither can be read."""
- return _windows_display_adapters_registry() or _windows_adapters_cim()
+ found = _windows_display_adapters_registry()
+ if len({a.get("vendor") for a in found} & {"10de", "1002"}) > 1:
+ # The registry keeps the driver entry of a card that was taken out (an NVIDIA card swapped for a Radeon, #3892): when two makes are
+ # listed, only the adapters Windows reports as present now count.
+ present = {(a["vendor"], a["device"]) for a in _windows_adapters_cim()}
+ now = [a for a in found if (a["vendor"], a["device"]) in present]
+ if now:
+ return now
+ return found or _windows_adapters_cim()
def _windows_display_adapters_registry() -> list[dict]:
diff --git a/tests/terminal/test_engine_component.py b/tests/terminal/test_engine_component.py
index d67ef211c..6f9fc5674 100644
--- a/tests/terminal/test_engine_component.py
+++ b/tests/terminal/test_engine_component.py
@@ -258,6 +258,16 @@ class WindowsAmd(unittest.TestCase):
{"vendor": "1002", "device": 0x744C, "name": "AMD Radeon RX 7900 XTX", "vram_gb": 24.0}]
IGPU_ONLY = [{"vendor": "1002", "device": 0x15BF, "name": "AMD Radeon 780M Graphics", "vram_gb": 0.5}]
+ def test_a_removed_nvidia_card_left_in_the_registry_does_not_win(self): # #3892
+ old = {"vendor": "10de", "device": 0x2684, "name": "NVIDIA GeForce RTX 4090", "vram_gb": 24.0}
+ new = self.TESTER_A[0]
+ with mock.patch.object(ec, "_windows_display_adapters_registry", return_value=[old, new]), mock.patch.object(ec, "_windows_adapters_cim", return_value=[dict(new)]):
+ self.assertEqual(ec._windows_vendor_backend(), "hip")
+ with mock.patch.object(ec, "_windows_display_adapters_registry", return_value=[old, new]), mock.patch.object(ec, "_windows_adapters_cim", return_value=[dict(old), dict(new)]):
+ self.assertEqual(ec._windows_vendor_backend(), "cuda") # both really there: NVIDIA first, as before
+ with mock.patch.object(ec, "_windows_display_adapters_registry", return_value=[old, new]), mock.patch.object(ec, "_windows_adapters_cim", return_value=[]):
+ self.assertEqual(ec._windows_vendor_backend(), "cuda") # Windows could not say: nothing is dropped
+
def test_nvidia_wins_and_an_integrated_radeon_is_not_a_card(self):
self.assertEqual(ec._windows_vendor_backend(self.OWNER_PC), "cuda")
self.assertEqual(ec.windows_amd_cards(self.OWNER_PC), [])