fix(windows): launch commands on the interactive desktop

This commit is contained in:
cabbage committed 2026-10-27 18:35:29 +00:00
1 parent 30e7bb8545
commit 8d28925e44
20 files changed
+1036 -28

No files matched your search

+34
View File
@@ -188,6 +188,37 @@ assert_stdin_close() {
fail "stdin command did not reach terminal success"
}
assert_gui() {
gui_label=$1
gui_elevated=$2
gui_probe_command="@powershell.exe -NoLogo -NoProfile -STA -ExecutionPolicy Bypass -File \"C:/ProgramData/RVBox/test-runs/$run_id/windows_gui_probe.ps1\" -Seconds 2"
if [ "$gui_elevated" = yes ]; then
gui_result=$(rvc run --elevated --shell cmd "$client_id" "$gui_probe_command" 2>&1) || fail "GUI probe RPC failed: $gui_result"
else
gui_result=$(rvc run --shell cmd "$client_id" "$gui_probe_command" 2>&1) || fail "GUI probe RPC failed: $gui_result"
fi
printf '%s\n' "$gui_result" >"$fixture_dir/gui-$gui_label.log"
gui_issue=$(printf '%s\n' "$gui_result" | awk 'NR == 1 { print $1 }')
case $gui_issue in ????????-????-7???-????-????????????) ;; *) fail "GUI probe returned invalid issue UUID: $gui_result" ;; esac
gui_state=$(rvc stat "$client_id" "$gui_issue") || fail "GUI probe status failed"
printf '%s\n' "$gui_state" >"$fixture_dir/gui-$gui_label.stat"
printf '%s\n' "$gui_state" | grep -q 'lifecycle=COMMAND_SUCCEEDED' || fail "GUI probe failed: $gui_state (see gui-$gui_label.log)"
printf '%s\n' "$gui_result" | python3 -c '
import json, sys
reports = [json.loads(line) for line in sys.stdin if line.lstrip().startswith("{")]
if len(reports) != 1:
raise SystemExit("GUI probe did not return exactly one report")
r = reports[0]
if not (r.get("window_observed") and r.get("session_id", 0) > 0 and
r.get("window_station", "").lower() == "winsta0" and
r.get("desktop", "").lower() == "default" and
r.get("input_desktop", "").lower() == "default" and
r.get("console_window_visible") is False):
raise SystemExit("GUI probe did not observe a real window on the unlocked input desktop")
' || fail "GUI visibility/desktop assertion failed; inspect gui-$gui_label.log"
printf 'passed gui-%s issue=%s\n' "$gui_label" "$gui_issue"
}
assert_signal_term() {
issued=$(rvc run --background --shell cmd "$client_id" 'ping -t 127.0.0.1 >NUL' 2>&1) || fail "signal command admission failed: $issued"
issue=$(printf '%s\n' "$issued" | awk 'NR == 1 { print $1 }')
@@ -300,10 +331,13 @@ case $action in
assert_signal_term
assert_server_restart_reconnect
assert_context active-user no active-user
assert_gui active-user no
assert_context active-user-elevated yes active-user-elevated
assert_gui active-user-elevated yes
"$repo_root/scripts/windows/test-host" run --run-id "$run_id" --fail-contexts ACTIVE_USER_ELEVATED
wait_client
assert_context active-system yes active-system
assert_gui active-system yes
"$repo_root/scripts/windows/test-host" run --run-id "$run_id" --fail-contexts ACTIVE_USER_ELEVATED,ACTIVE_SYSTEM
wait_client
assert_context local-system-active-fallback yes local-system