feat(m0): measure the one model's game placements and fix desktop app matching
Add a gamemode stage that restarts Qwen3.6-35B-A3B with a smaller routed expert VRAM budget (6, 4, 2 GiB, and 2 GiB with half the CPU workers), then the normal placement again, and records switch time, free VRAM, output speed, first spoken sentence and 8K-context first token for each. It names the fastest placement that leaves the game its 8 GB reserve. Strata 0.1.59's qwen36 engine cannot shrink VRAM while running, so each placement is a restart. The desktop stage now matches running apps by the process image name Windows lists (Discord.exe) and closes the calculator it launched by image name when close-app cannot find a UWP app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -55,11 +55,11 @@ FAKE_CLI = textwrap.dedent(r'''
|
||||
return args[args.index(name) + 1] if name in args else None
|
||||
|
||||
def windows(s):
|
||||
w = [{"id": "w-1", "app_name": "WINWORD", "title": SECRET + ".docx - Word", "accessible": True}]
|
||||
w = [{"id": "w-1", "app_name": "WINWORD.EXE", "title": SECRET + ".docx - Word", "accessible": True}]
|
||||
if s.get("calc"):
|
||||
w.append({"id": "w-200", "app_name": "CalculatorApp", "title": "계산기", "accessible": True})
|
||||
w.append({"id": "w-200", "app_name": "CalculatorApp.exe", "title": "계산기", "accessible": True})
|
||||
if s.get("browser"):
|
||||
w.append({"id": "w-100", "app_name": "chrome", "title": s["browser"] + " - Google Chrome",
|
||||
w.append({"id": "w-100", "app_name": "chrome.exe", "title": s["browser"] + " - Google Chrome",
|
||||
"accessible": True})
|
||||
return w
|
||||
|
||||
@@ -96,7 +96,11 @@ FAKE_CLI = textwrap.dedent(r'''
|
||||
return ok(cmd, {"platform": "windows", "permissions": {"accessibility": {"state": "granted"}},
|
||||
"supported_surfaces": ["window", "menu"]})
|
||||
if cmd == "list-apps":
|
||||
return ok(cmd, {"apps": [{"name": "Discord"}, {"name": "explorer"}, {"name": "WINWORD"}]})
|
||||
# Windows lists the process image names of window owners. A UWP
|
||||
# app's windows belong to ApplicationFrameHost, so the calculator
|
||||
# is not listed under its own name.
|
||||
return ok(cmd, {"apps": [{"name": "ApplicationFrameHost.exe"}, {"name": "Discord.exe"},
|
||||
{"name": "explorer.exe"}, {"name": "WINWORD.EXE"}]})
|
||||
if cmd == "list-windows":
|
||||
if MODE == "cli_fail":
|
||||
fail(cmd, "PLATFORM_ERROR", SECRET)
|
||||
@@ -108,13 +112,15 @@ FAKE_CLI = textwrap.dedent(r'''
|
||||
return ok(cmd, {"app": "calc", "pid": 1})
|
||||
fail(cmd, "APP_NOT_FOUND", "no such app")
|
||||
if cmd == "close-app":
|
||||
if a[1].lower() == "calculatorapp.exe":
|
||||
fail(cmd, "APP_NOT_FOUND", "no running app named " + a[1])
|
||||
s["calc"] = False
|
||||
save(s)
|
||||
return ok(cmd, {"app": a[1]})
|
||||
if cmd == "find":
|
||||
if opt(a, "--native-id"):
|
||||
nid = opt(a, "--native-id")
|
||||
if opt(a, "--app") != "CalculatorApp" or not s.get("calc"):
|
||||
if opt(a, "--app") != "CalculatorApp.exe" or not s.get("calc"):
|
||||
return ok(cmd, {"matches": [], "total_matches": 0})
|
||||
name = ("표시는 %s입니다" % s["display"]) if nid == "CalculatorResults" else nid
|
||||
return ok(cmd, {"matches": [{"ref_id": "@s1:" + nid, "name": name, "role": "button"}]})
|
||||
@@ -144,9 +150,16 @@ FAKE_CLI = textwrap.dedent(r'''
|
||||
return ok(cmd, {"action": "set-value"})
|
||||
if cmd == "get":
|
||||
return ok(cmd, {"property": "value", "ref": a[1], "value": s.get("value", "")})
|
||||
if cmd == "force-close": # stands in for taskkill /IM <image>
|
||||
if a[-1] == "CalculatorApp.exe":
|
||||
s["calc"] = False
|
||||
save(s)
|
||||
return
|
||||
if cmd == "snapshot":
|
||||
app = opt(a, "--app")
|
||||
if app == "explorer":
|
||||
if app not in ("Discord.exe", "explorer.exe"):
|
||||
fail(cmd, "APP_NOT_FOUND", "no running app named " + str(app))
|
||||
if app == "explorer.exe":
|
||||
fail(cmd, "AMBIGUOUS_TARGET", "windows: " + SECRET + ".docx")
|
||||
return ok(cmd, {"app": app, "ref_count": 120, "complete": True,
|
||||
"tree": {"role": "window", "name": SECRET + " DM"}})
|
||||
@@ -165,6 +178,8 @@ def fake(tmp_path, monkeypatch):
|
||||
monkeypatch.setenv("FAKE_AD_SECRET", SECRET)
|
||||
monkeypatch.delenv("FAKE_AD_MODE", raising=False)
|
||||
|
||||
monkeypatch.setattr(desktop, "FORCE_CLOSE", [sys.executable, str(script), "force-close"])
|
||||
|
||||
class Fake:
|
||||
cmd = [sys.executable, str(script)]
|
||||
log = tmp_path / "desktop.log"
|
||||
@@ -279,3 +294,19 @@ def test_an_already_open_calculator_is_left_alone(fake, tmp_path):
|
||||
assert result["ok"] is False and result["skipped"]
|
||||
s = json.loads(state.read_text(encoding="utf-8"))
|
||||
assert s["calc"] is True and s["display"] == "777" # not pressed, not closed
|
||||
|
||||
|
||||
def test_running_apps_are_read_by_the_process_name_windows_lists(fake):
|
||||
result = desktop.check_apps(fake.desk())
|
||||
assert result["Discord"]["running"] is True and result["Discord"]["ok"] is True
|
||||
assert result["Discord"]["ref_count"] == 120
|
||||
assert result["explorer"]["running"] is True
|
||||
assert result["explorer"]["error"] == "AMBIGUOUS_TARGET"
|
||||
|
||||
|
||||
def test_the_launched_calculator_is_closed_when_close_app_cannot_find_it(fake, tmp_path):
|
||||
result = desktop.check_calculator(fake.desk())
|
||||
assert result["ok"] is True
|
||||
assert result["close_error"] == "APP_NOT_FOUND"
|
||||
assert result["closed"] is True
|
||||
assert json.loads((tmp_path / "state.json").read_text(encoding="utf-8"))["calc"] is False
|
||||
|
||||
Reference in New Issue
Block a user