Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
594aad1
reconcile(ic1): apply qualified observer docker/Dockerfile atop broke…
mark-e-deyoung Nov 19, 2026
fdea7d5
reconcile(ic1): apply qualified observer api/core/wininspect.py atop …
mark-e-deyoung Nov 19, 2026
bd7e1bb
ci(ic1): compose broker and WinInspect real Windows acceptance triggers
mark-e-deyoung Nov 19, 2026
2285575
ci(ic1): compose live WinInspect observation before broker input acce…
mark-e-deyoung Nov 19, 2026
aa59765
reconcile(ic1): carry scripts/ci/qualify-mvp-wininspect-live.py into …
mark-e-deyoung Nov 19, 2026
c8e199b
reconcile(ic1): carry tests/test_wininspect_daemon_launch.py into cle…
mark-e-deyoung Nov 19, 2026
7104cfc
ci(ic1): preserve broker tests and enforce WinInspect launch regression
mark-e-deyoung Nov 19, 2026
6bf265e
rdte(wininspect): publish only fixed daemon startup stage signatures …
mark-e-deyoung Nov 19, 2026
28c1a6d
ci(wininspect): allowlist non-sensitive WinInspect daemon startup sig…
mark-e-deyoung Nov 19, 2026
be250dd
fix(wininspect): pin daemon IPv4 loopback bind and configured RPC port
mark-e-deyoung Nov 20, 2026
326d69a
test(wininspect): verify loopback-only pinned daemon TCP startup
mark-e-deyoung Nov 20, 2026
6887de6
fix(wininspect): use upstream TCP protocol 0.3.0 separate from produc…
mark-e-deyoung Nov 20, 2026
559c015
ci(wininspect): enforce existing wire protocol 0.3.0 framing regressi…
mark-e-deyoung Nov 20, 2026
4270bc0
rdte(wininspect): classify RPC handshake/transport failures without r…
mark-e-deyoung Nov 20, 2026
8af1677
ci(wininspect): allowlist bounded RPC wire failure causes
mark-e-deyoung Nov 20, 2026
941d27a
test(wininspect): reject missing and foreign RPC response IDs across …
mark-e-deyoung Nov 20, 2026
493388c
fix(wininspect): fail closed on malformed and non-object RPC frames
mark-e-deyoung Nov 20, 2026
dc6ada1
test(wininspect): refuse invalid UTF-8, non-object and truncated fram…
mark-e-deyoung Nov 20, 2026
a12edba
test(wininspect): use real malformed UTF-8 fixture and format bounded…
mark-e-deyoung Nov 20, 2026
364fcd3
fix(wininspect): pin wire version and reject invalid daemon hello bef…
mark-e-deyoung Nov 20, 2026
b798178
test(wininspect): require exact daemon hello and refuse caller protoc…
mark-e-deyoung Nov 20, 2026
360820b
fix(wininspect): enforce boolean response status and typed error enve…
mark-e-deyoung Nov 20, 2026
ca6fcf3
test(wininspect): typed RPC status and malformed error envelope fail-…
mark-e-deyoung Nov 20, 2026
5920789
ci(ic1): fail early on known-unqualified WinInspect v0.4.4 before cos…
mark-e-deyoung Nov 20, 2026
bc8e8db
test(ic1): enforce early-failure guard for stale observer binary
mark-e-deyoung Nov 20, 2026
c59506e
ci(ic1): fence unqualified WinInspect archive by digest as well as fi…
mark-e-deyoung Nov 20, 2026
1face38
test(ic1): assert unqualified archive SHA remains denied
mark-e-deyoung Nov 20, 2026
ba0ea95
fix(ic1): bind HWND observer acceptance to same visible real Notepad+…
mark-e-deyoung Nov 20, 2026
6345be9
test(ic1): reject stale, hidden, wrong-title and fallback HWND observ…
mark-e-deyoung Nov 20, 2026
31a1d71
style(ic1): satisfy Ruff import sorting for native HWND regression
mark-e-deyoung Nov 20, 2026
1fc40fa
test(wininspect): correct Ruff import grouping in native oracle tests
mark-e-deyoung Nov 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/mvp-ic1-windows-workloads.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
- '.github/workflows/mvp-ic1-windows-workloads.yml'
- 'scripts/ci/qualify-mvp-windows-workloads.sh'
- 'scripts/ci/qualify-mvp-broker-real-keyboard.py'
- 'tests/test_wininspect_daemon_launch.py'
- 'api/core/wininspect.py'
- 'scripts/ci/qualify-mvp-wininspect-live.py'
permissions:
contents: read
concurrency:
Expand All @@ -33,6 +36,20 @@ jobs:
persist-credentials: false
ref: 8c5ed8019a3518cf534b158662755172bfce7c59
path: wine11-candidate
- name: Fail early on the known-unqualified WinInspect observer binary
working-directory: layered
shell: bash
run: |
set -euo pipefail
# Only the optional live observer path is blocked. The owning MVP
# without this harness must retain its normal real-Wine acceptance.
if test -f scripts/ci/qualify-mvp-wininspect-live.py &&
{ grep -Fq 'WinInspectPortable-v0.4.4.zip' docker/Dockerfile ||
grep -Fq '6ac0a65f774ffe69672f1c459254931ebfddb1e52c9fbec14b5db1348ccaad04' docker/Dockerfile; }; then
echo 'IC1_OBSERVER_CAUSE=upstream_binary_unqualified'
echo 'IC1_OBSERVER_GATE=await_corrected_source_qualified_artifact'
exit 1
fi
- name: Reclaim disposable standard-runner disk
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /usr/share/swift
Expand Down Expand Up @@ -90,6 +107,7 @@ jobs:
working-directory: layered
run: |
bash -n scripts/ci/qualify-mvp-windows-workloads.sh
python3 -m py_compile scripts/ci/qualify-mvp-wininspect-live.py
# Reject accidentally appended/duplicated workload segments before
# spending minutes rebuilding the pinned Wine and Windows fixtures.
test "$(grep -Fc "echo 'MVP_WORKLOAD stage=bounded_qualification_pass'" scripts/ci/qualify-mvp-windows-workloads.sh)" -eq 1
Expand Down
44 changes: 36 additions & 8 deletions api/core/wininspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

DEFAULT_HOST = "127.0.0.1"
DEFAULT_PORT = 1985
# Upstream WinInspect product v0.4.0 still speaks TCP protocol v0.3.0.
# Keep wire protocol version independent from the product release version.
WININSPECT_PROTOCOL_VERSION = "0.3.0"
DEFAULT_TIMEOUT_SECONDS = 3.0
MAX_MESSAGE_SIZE = 10 * 1024 * 1024
READ_ONLY_METHODS = {
Expand Down Expand Up @@ -172,7 +175,15 @@ def ensure_daemon(start: bool = True) -> dict[str, Any]:
log_file = open(_log_path(), "ab")
try:
proc = subprocess.Popen(
["wine", str(daemon_exe())],
# WinInspect tray mode can exit under headless Wine before
# its background TCP listener becomes available. The WineBot
# adapter is a service endpoint, so require the daemon's
# upstream-supported blocking/headless TCP mode explicitly.
# Match the adapter's loopback RPC endpoint explicitly.
# WinInspect's persisted Wine config and IPv6 defaults must
# not silently bind a different address or TCP port.
["wine", str(daemon_exe()), "--headless",
"--bind", "127.0.0.1", "--port", str(port())],
stdout=log_file,
stderr=subprocess.STDOUT,
start_new_session=True,
Expand Down Expand Up @@ -252,9 +263,13 @@ def _read_frame(sock: socket.socket) -> dict[str, Any]:
raise WinInspectError(f"WinInspect frame too large: {length}")
payload = _recv_exact(sock, length)
try:
return json.loads(payload.decode("utf-8"))
except json.JSONDecodeError as exc:
raise WinInspectError(f"invalid WinInspect JSON frame: {exc}") from exc
decoded = json.loads(payload.decode("utf-8"))
except (UnicodeDecodeError, json.JSONDecodeError) as exc:
# Never expose arbitrary malformed daemon content in API errors.
raise WinInspectError("invalid WinInspect JSON frame") from exc
if not isinstance(decoded, dict):
raise WinInspectError("invalid WinInspect JSON frame root")
return decoded


def _write_frame(sock: socket.socket, payload: dict[str, Any]) -> None:
Expand All @@ -276,22 +291,35 @@ def request(method: str, params: dict[str, Any] | None = None) -> dict[str, Any]
"id": request_id,
"method": method,
"params": {
"protocol_version": "0.4.0",
**(params or {}),
# The caller may not downgrade or substitute the wire protocol.
"protocol_version": WININSPECT_PROTOCOL_VERSION,
},
}
with socket.create_connection((host(), port()), timeout=timeout_seconds()) as sock:
sock.settimeout(timeout_seconds())
hello = _read_frame(sock)
if (
hello.get("type") != "hello"
or hello.get("version") != WININSPECT_PROTOCOL_VERSION
):
raise WinInspectError("WinInspect hello protocol mismatch")
_write_frame(sock, payload)
response = _read_frame(sock)

if response.get("id") != request_id:
# Never expose untrusted daemon hello identity in API-visible errors.
raise WinInspectError("WinInspect response correlation failed")
if not response.get("ok"):
error = response.get("error") or {}
raise WinInspectError(str(error.get("message") or error or "WinInspect request failed"))
if type(response.get("ok")) is not bool:
raise WinInspectError("WinInspect response status invalid")
if response["ok"] is False:
error = response.get("error")
if not isinstance(error, dict):
raise WinInspectError("WinInspect response error invalid")
message = error.get("message")
if not isinstance(message, str) or not message:
raise WinInspectError("WinInspect request failed")
raise WinInspectError(message)
return {
"result": response.get("result"),
"metrics": response.get("metrics"),
Expand Down
5 changes: 5 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ RUN bash /download_tool.sh "WinInspect" \
"https://github.com/SemperSupra/WinInspect/releases/download/v0.4.4/WinInspectPortable-v0.4.4.zip" \
"6ac0a65f774ffe69672f1c459254931ebfddb1e52c9fbec14b5db1348ccaad04" \
"/opt/winebot/windows-tools/WinSpy" \
&& for binary in wininspectd.exe wininspect.exe wininspect-gui.exe; do \
test -s "/opt/winebot/windows-tools/WinSpy/App/WinInspect/$binary" || exit 1; \
cp "/opt/winebot/windows-tools/WinSpy/App/WinInspect/$binary" \
"/opt/winebot/windows-tools/WinSpy/$binary" || exit 1; \
done \
&& find /opt/winebot/windows-tools -name "*.txt" -delete

# --- Stage 2: Base System (From pre-built base) ---
Expand Down
19 changes: 19 additions & 0 deletions scripts/ci/qualify-mvp-windows-workloads.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,25 @@ docker compose -f compose/layered.yml exec -T winebot-interactive /bin/bash -euo
fail editor_gui_save
}
echo 'MVP_WORKLOAD stage=real_windows_editor_gui_save'
# Require Windows-native read-only observation of this actual Wine GUI.
# Only allowlisted stage categories leave the disposable runner.
docker compose -f compose/layered.yml exec -T \
-e GITHUB_ACTIONS=true -e GITHUB_EVENT_NAME=pull_request \
-e PYTHONPATH=/ \
winebot-interactive python3 /scripts/ci/qualify-mvp-wininspect-live.py \
>"$RUNNER_TEMP/ic1-observer-local.log" 2>&1 || {
cause="$(grep -Eo 'IC1_OBSERVER_CAUSE=(unqualified_venue|binary_missing|daemon_unavailable|capabilities_missing|capabilities_unavailable|rpc_timeout|rpc_connection_error|rpc_version_rejected|rpc_correlation_rejected|rpc_connection_closed|rpc_unsupported_compression|rpc_daemon_rejected|rpc_transport_or_decode_error|observer_rpc_error|window_info_rpc_error|real_window_not_observed|daemon_exception|daemon_exited|daemon_tcp_timeout|daemon_log_unavailable|tcp_winsock_unavailable|tcp_no_sockets|tcp_bind_or_listen_failed|tcp_listener_reported_unreachable|tcp_start_requested_no_listener|daemon_initialized_no_tcp|daemon_no_output|daemon_log_preinit_only|unexpected_harness_exception)' "$RUNNER_TEMP/ic1-observer-local.log" | tail -1 || true)"
case "$cause" in
IC1_OBSERVER_CAUSE=*) printf '%s\n' "$cause" ;;
*) echo 'IC1_OBSERVER_CAUSE=unclassified' ;;
esac
fail wininspect_live_observation
}
grep -Fq 'IC1_OBSERVER=real_notepad_hwnd_readonly_pass' \
"$RUNNER_TEMP/ic1-observer-local.log" || fail observer_receipt_missing
echo 'MVP_WORKLOAD stage=wininspect_real_notepad_observed'


# Exercise real FastAPI broker policy and real X11→Wine keyboard dispatch.
# The Python harness isolates ONLY session metadata/evidence writers, never
# _send_keys or the X11 command. Do not publish private Wine/desktop traces.
Expand Down
149 changes: 149 additions & 0 deletions scripts/ci/qualify-mvp-wininspect-live.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
#!/usr/bin/env python3
"""Read-only Windows HWND observation of an actual running Notepad++ in Wine.

Designed for the isolated IC1 public-hosted runner. Do not publish application
titles, screenshots, registry, user paths or raw WinInspect RPC responses.
"""
import os
import time

from api.core import wininspect


def fail(stage: str) -> None:
raise RuntimeError("IC1_OBSERVER_CAUSE=" + stage)


def classify_daemon_startup() -> str:
"""Reduce a local daemon log to a fixed, non-identifying public cause."""
try:
# Never include log content or paths in a public CI result.
raw = wininspect._log_path()
with open(raw, "rb") as handle:
data = handle.read(131072).decode("utf-8", errors="replace")
except (OSError, ValueError):
return "daemon_log_unavailable"
if "TCP Server: Winsock not initialized" in data:
return "tcp_winsock_unavailable"
if "TCP Server: No sockets could be bound" in data:
return "tcp_no_sockets"
if "TCP Server: bind failed" in data or "TCP Server: listen failed" in data:
return "tcp_bind_or_listen_failed"
if "TCP Server listening on [" in data:
return "tcp_listener_reported_unreachable"
if "Starting TCP Server" in data:
return "tcp_start_requested_no_listener"
if "WinInspect Daemon " in data:
return "daemon_initialized_no_tcp"
if not data:
return "daemon_no_output"
return "daemon_log_preinit_only"



def qualified_notepad_window(match: object, info: object) -> bool:
"""Bind a read-only WinInspect lookup to the same visible Notepad++ HWND.

The exact source-defined getInfo response has hwnd/title/visible/pid.
Never accept an adapter fallback such as {"hwnd": ..., "raw": ...}.
"""
if not isinstance(match, dict) or not isinstance(info, dict):
return False
hwnd = match.get("hwnd")
if not isinstance(hwnd, str) or not hwnd.startswith("0x"):
return False
try:
numeric_hwnd = int(hwnd[2:], 16)
except ValueError:
return False
if numeric_hwnd == 0 or info.get("hwnd") != hwnd:
return False
title = info.get("title")
pid = info.get("pid")
return (
isinstance(title, str)
and "Notepad++" in title
and info.get("visible") is True
and type(pid) in (int, float)
and 0 < pid < 2**32
)


def main() -> None:
if os.environ.get("GITHUB_ACTIONS") != "true" or os.environ.get("GITHUB_EVENT_NAME") != "pull_request" or os.environ.get("WINEBOT_STATE_MODEL") != "layered":
fail("unqualified_venue")
if not wininspect.installed():
fail("binary_missing")
# First Wine 11 process launch on a fresh disposable prefix can be slower
# than the adapter's interactive 10-second default. Bound the RDTE window,
# retain fail-closed TCP readiness and classify process exit vs timeout.
os.environ["WINEBOT_WININSPECT_START_TIMEOUT_SECONDS"] = "35"
try:
state = wininspect.ensure_daemon(start=True)
except Exception:
fail("daemon_exception")
if not state.get("running"):
if "exit_code" in state:
fail("daemon_exited")
if state.get("started"):
fail(classify_daemon_startup())
fail("daemon_unavailable")
try:
capabilities = wininspect.capabilities()
except TimeoutError:
fail("rpc_timeout")
except ConnectionError:
fail("rpc_connection_error")
except wininspect.WinInspectError as exc:
# Only report fixed protocol/transport classes; never forward daemon
# strings, identity, application titles or arbitrary error details.
reason = str(exc)
if "E_PROTOCOL_VERSION" in reason or (
"expected " in reason and " got " in reason
):
fail("rpc_version_rejected")
if "response correlation failed" in reason:
fail("rpc_correlation_rejected")
if "connection closed while reading frame" in reason:
fail("rpc_connection_closed")
if "compressed WinInspect frames" in reason:
fail("rpc_unsupported_compression")
fail("rpc_daemon_rejected")
except (OSError, ValueError, KeyError, TypeError):
fail("rpc_transport_or_decode_error")
if not isinstance(capabilities, dict) or not capabilities:
fail("capabilities_missing")

deadline = time.monotonic() + 25
while time.monotonic() < deadline:
try:
matches = wininspect.find_windows(title_regex=r"Notepad[+][+]")
except Exception:
fail("observer_rpc_error")
for match in matches:
if not isinstance(match, dict):
continue
hwnd = match.get("hwnd")
if not isinstance(hwnd, str) or not hwnd.startswith("0x"):
continue
try:
info = wininspect.window_info(hwnd)
except Exception:
fail("window_info_rpc_error")
if qualified_notepad_window(match, info):
print("IC1_OBSERVER=real_notepad_hwnd_readonly_pass")
return
time.sleep(1)
fail("real_window_not_observed")


if __name__ == "__main__":
try:
main()
except Exception as exc:
if isinstance(exc, RuntimeError) and str(exc).startswith("IC1_OBSERVER_CAUSE="):
print(str(exc))
else:
# Never publish Wine/desktop responses, paths or raw tracebacks.
print("IC1_OBSERVER_CAUSE=unexpected_harness_exception")
raise SystemExit(1) from None
2 changes: 2 additions & 0 deletions scripts/ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ pytest \
tests/test_ci_public_conformance_summary.py \
tests/test_ci_unit_isolation.py \
tests/test_winepath_startup_retry.py \
tests/test_wininspect.py \
tests/test_wininspect_error_redaction.py \
tests/test_wininspect_daemon_launch.py \
tests/test_ci_vnext_evidence.py \
tests/test_lifecycle_cancel_window.py \
tests/test_health_system_memory.py \
Expand Down
Loading
Loading