Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
12202f8
R084: add bounded CRE-compatible OCI probe for Wine11 broker and sensors
mark-e-deyoung Nov 30, 2026
3da480c
R084: run real Wine11 GUI and CRE sidecar broker smoke on public OCI
mark-e-deyoung Nov 30, 2026
45c8b8e
R084: parallel standard-runner Wine11 mode builds and OCI CRE smoke
mark-e-deyoung Nov 30, 2026
f560653
R084: document separate CRE OCI container interface and unqualified v…
mark-e-deyoung Nov 30, 2026
623dfd5
R084: resolve exact Ruff import and unused exception hook args
mark-e-deyoung Nov 30, 2026
e4037f0
R084: independently verify live hook disable and restored fresh-event…
mark-e-deyoung Nov 30, 2026
a7aedee
R084: require real Wine engine version and observed OCI retirement be…
mark-e-deyoung Nov 30, 2026
802fc3c
R084: verify denied targeted save and lease reacquisition after STOP
mark-e-deyoung Nov 30, 2026
521d692
R084: qualify second selectable Wine application vantage and cross-wi…
mark-e-deyoung Nov 30, 2026
85c13bb
R084: qualify actual lease expiry and explicit regrant before selecta…
mark-e-deyoung Nov 30, 2026
4540613
R084: correct literal shell patch materialization; retain all expiry …
mark-e-deyoung Nov 30, 2026
6178378
R084: qualify unresolved X11/AHK target refusal with independent effects
mark-e-deyoung Nov 30, 2026
69a3771
R084: preserve failed targeting assertions through STOP and confirmed…
mark-e-deyoung Nov 30, 2026
663b88d
Fail closed on unresolved or inactive AHK keyboard targets
mark-e-deyoung Dec 1, 2026
942afe2
Enroll AHK target guard and refusal regressions in mandatory keyboard…
mark-e-deyoung Dec 1, 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
52 changes: 52 additions & 0 deletions .github/workflows/cre-wine11-oci-bridge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CRE x WineBot Wine 11 OCI Bridge Smoke

on:
pull_request:
paths:
- '.github/workflows/cre-wine11-oci-bridge.yml'
- 'scripts/cre/**'
- 'docs/cre-wine11-oci-bridge.md'

permissions: {}

env:
DOCKER_BUILD_RECORD_UPLOAD: 'false'

concurrency:
group: winebot-cre-bridge-${{ github.ref }}
cancel-in-progress: false

defaults:
run:
shell: bash -euo pipefail {0}

jobs:
smoke:
if: >-
github.event_name == 'pull_request' &&
github.repository == 'SemperSupra/WineBot' &&
github.event.pull_request.head.repo.full_name == github.repository
strategy:
fail-fast: false
matrix:
mode: [runtime, instrumented]
runs-on: ubuntu-24.04
timeout-minutes: 45
permissions:
contents: read
env:
CRE_SOURCE_SHA: ${{ github.event.pull_request.head.sha }}
steps:
- name: Checkout exact public source without retained credentials
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- name: Reclaim disposable build space
run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /usr/share/swift
- name: Verify Python and shell syntax
run: |
python3 -B -c 'import ast; ast.parse(open("scripts/cre/sidecar_probe.py", encoding="utf-8").read())'
bash -n scripts/cre/qualify-oci-bridge.sh
- name: Build exact Wine 11 mode and exercise separate CRE-compatible sidecar
run: bash scripts/cre/qualify-oci-bridge.sh '${{ matrix.mode }}'
64 changes: 48 additions & 16 deletions api/routers/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,37 +257,69 @@ async def _send_keys(

script_id = uuid.uuid4().hex[:8]
script_path = os.path.join(session_dir, "scripts", f"key_{script_id}.ahk")
os.makedirs(os.path.dirname(script_path), exist_ok=True)

script_lines = [
"#NoTrayIcon",
"#NoEnv",
"#SingleInstance Force",
"SetKeyDelay, 20, 20",
]
# Prefer AHK native title matching (window_title) over X11 IDs.
# X11 window IDs from xdotool do not correspond to AHK HWNDs.
if window_title:
# Resolve a literal title to exactly one visible native HWND. Never let a
# failed target request degrade to Send on the current foreground window.
# An untyped window_id may belong to X11, so it is not a native selector.
if window_title is not None:
if (
not window_title.strip()
or len(window_title) > 1024
or any(ord(char) < 32 or ord(char) == 127 for char in window_title)
):
return {"ok": False, "backend": "ahk", "error": "ahk_target_invalid", "stderr": ""}
# Encode title as data, not an AHK command parameter or selector.
# Chr expressions avoid AHK escape and selector interpretation.
title_expression = " . ".join(f"Chr({ord(char)})" for char in window_title)
script_lines.extend([
'WinActivate, %s' % window_title,
'WinWaitActive, %s,, 2' % window_title,
])
elif window_id:
hex_id = window_id
if window_id.startswith("0x"):
hex_id = window_id # already hex
script_lines.extend([
"WinActivate, ahk_id %s" % hex_id,
"WinWaitActive, ahk_id %s,, 2" % hex_id,
f"requested := {title_expression}",
"target := 0",
"WinGet, matches, List",
"Loop, %matches%",
"{",
" candidate := matches%A_Index%",
" WinGetTitle, actualTitle, ahk_id %candidate%",
" if (InStr(actualTitle, requested, true) = 1)",
" {",
" if (target)",
" ExitApp, 42",
" target := candidate",
" }",
"}",
"if (!target)",
" ExitApp, 42",
"WinGet, targetPID, PID, ahk_id %target%",
"if (!targetPID)",
" ExitApp, 42",
"WinActivate, ahk_id %target%",
"WinWaitActive, ahk_id %target%,, 2",
"if (ErrorLevel)",
" ExitApp, 42",
"WinGet, currentPID, PID, ahk_id %target%",
"WinGetTitle, currentTitle, ahk_id %target%",
"if (currentPID != targetPID || InStr(currentTitle, requested, true) != 1)",
" ExitApp, 42",
'if (!WinActive("ahk_id " . target))',
" ExitApp, 42",
])
elif window_id is not None:
return {"ok": False, "backend": "ahk", "error": "ahk_native_title_required", "stderr": ""}
script_lines.append("Send, %s" % ahk_keys)
script_lines.append("ExitApp")

with open(script_path, "w") as f:
os.makedirs(os.path.dirname(script_path), exist_ok=True)
with open(script_path, "w", encoding="utf-8") as f:
f.write("\n".join(script_lines) + "\n")

cmd = ["ahk", to_wine_path(script_path)]
result = safe_command(cmd, timeout=timeout)
if not result.get("ok") and result.get("exit_code") == 42:
return {"ok": False, "backend": "ahk", "error": "ahk_target_unresolved_or_inactive", "stderr": ""}
return {
"ok": result.get("ok", False),
"backend": "ahk",
Expand Down
163 changes: 163 additions & 0 deletions docs/cre-wine11-oci-bridge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# CRE × WineBot 11 — OCI bridge smoke (R084)

This is a source-exact, public-only cross-product **interface feasibility** test,
not a release of the private CRE runtime. It makes two separate, parallel
standard free-tier hosted builds from the same pinned WineHQ 11 WineBot source:
one ordinary runtime and one instrumented image.

## Placement

The WineBot target runs in its existing read-only, resource-limited Docker
container with six external synthetic fixture volumes. A **separate** CRE-
compatible probe runs as a container with only the WineBot internal session
network, UID/GID 1000, read-only root, all capabilities dropped, no privilege
escalation, capped memory/PIDs/CPU, and one role-specific API token per process.
It does not share WineBot state volumes, the Docker socket or host PID namespace.
An independent third container, with network disabled and a read-only fixture
volume, checks the actual saved Notepad data.

The sidecar currently reuses the locally built WineBot OCI filesystem to avoid
a third, unpinned interpreter image. The Python probe is a narrowly scoped
public implementation of the **integration surface**, not the private CRE
workspace binary, a production CRE sidecar image, or a general debugger.
It does not add a competing scheduler, credential issuer or control broker.

## What is exercised

| Boundary | Runtime | Instrumented |
| --- | --- | --- |
| Exact source and passive winebot.runtime/1 discovery | Required | Required |
| Native Wine 11 Notepad GUI, granted brokered AHK keyboard and save | Required | Required |
| Observer-only credential and denied keyboard/trace mutation | Required | Required |
| Windows AHK hook keydown+keyup, independent of broker key-sent | Must be absent | Required |
| Operator toggle of Windows hook stop/start with readback | Disabled | Required |
| Disabled hook emits no fresh window key events during a distinct independently verified real GUI save | Not applicable | Required |
| Restarted hook emits fresh keydown/up during independently verified restoration of original text | Not applicable | Required |
| WinInspect observation capability discovery | 409 disabled | Not-installed, unverified |
| STOP_NOW, denied fresh grant/renewal and complete targeted edit/save, unchanged independent saved content | Required | Required |
| Still-running AHK sensor emits no fresh fixture-window keys during denied edit/save | Not applicable | Required |
| Independent persisted byte check from a network-none container | Required | Required |
| No host Docker socket, guest data mount, capabilities or writable root in the probe | Required | Required |

The actual control action remains mediated by WineBot; the probe cannot bypass
the broker. The observer cannot actuate. Published logs use fixed stage markers;
credentials, screenshots, event payloads, process contents and private CRE
source are never published. Only disposable generated test volumes are removed.

## What is *not* qualified

The private CRE instrumented runtime is **not built or deployed** by this test.
The CRE workspace's frozen API 1.1 and cre.products/1 remain with their owner.
WinInspect v0.5.0/wire 0.4.0 is not admitted; no genuine WinInspect provider or
event feed is claimed. Dynamic watchpoint/GDB attachment to Wine internals,
Wine server/kernel/syscall and driver hooks, arbitrary vantage-point selection,
QEMU/VHE GPU/MMIO/DMA/IRQ, native WinBot oracle, independently authenticated
multi-actor control, hostile guest isolation, native assistive technology,
virtual-machine fidelity and physical hardware remain separate gates.

For those deeper vantages, prefer a separately approved host or VM monitor
and typed least-authority relay; **do not** add Docker privileged mode, host
PID or SYS_PTRACE to the default target/observer just to make a test pass.
Linux containers isolate processes; they are not substitutes for a hypervisor
or a physical device probe.

## Reproduction and custody

The workflow at .github/workflows/cre-wine11-oci-bridge.yml is PR-only,
same-repository-only, and executes two mode jobs in parallel on public hosted
Ubuntu 24.04, each with a hard 45-minute timeout. The entrypoint is
scripts/cre/qualify-oci-bridge.sh; it checks exact commit identity, source
cleanliness and the unconditional R075 publication hold before any build.
A partial or stale receipt is never treated as success.

The hook differential uses the existing Windows event timestamp filter and window scope. A separate network-none verifier checks the initial, disabled-sensor and final saved data; stale hook records cannot satisfy the restarted-sensor predicate. It does not establish arbitrary key fidelity, reliable capture of every transition, or synchronized remote clocks.

Acceptance requires both actual built-mode CI jobs to pass (not merely syntax
checks), fixed independent sensor and actuator stage markers and byte readback.
New registry publication, hardware approval and protected-main merge are
forbidden. All eight pre-hardware gates remain open; status is
NOT_READY_FOR_HARDWARE_TEST.

Authoritative handoffs:
- WineBot: https://github.com/mark-e-deyoung/winebot-research/issues/3
- CRE: https://github.com/mark-e-deyoung/ghidra-tools/issues/4
- WineBot owning delivery PR: https://github.com/SemperSupra/WineBot/pull/250

## R084 follow-on: positive retirement and engine-version checks

The final `qualified` marker now requires independent actual `wine --version`
major 11 or later and successful Docker provider inventory **after** explicit
Compose teardown and removal of this run's six synthetic external volumes.
Exact pre-teardown Compose container IDs, the Compose project label, the unique
sidecar/verifier workcell label and names, and both expected network and volume
names must be absent from successful inventories. An inventory failure is a
failed qualification, not evidence of absence. Emergency cleanup remains best
effort on failure and cannot generate PASS. No global prune or deletion of
unrelated objects; this checks Docker-scoped retirement, not arbitrary host
process or hardware retirement. The verifier checks decoded fixture file text,
not a fixed encoding or byte-identical cross-platform file representation.

## R084 follow-on: post-STOP denied-effect witness

The independent verifier checks saved content immediately before STOP and
again after a complete denied targeted edit/save sequence. The synthetic
writer must receive refusal for renewal and for a fresh valid acknowledged
grant, followed by 423 for each key request; the session must still report
STOP, USER control and no lease. Instrumented mode also requires its previously
positive Windows hook to remain running and report no fresh fixture-window
keydown/up during the bounded denied sequence. The runtime mode checks saved
content and broker state, not independent absence of keyboard delivery.
This is a bounded same-session effect witness; it does not prove every
in-memory GUI state remained unchanged, all events were captured, the control
broker survives crashes, or arbitrary actors are isolated.

## R084 follow-on: selectable application vantage

The fixture now starts two actual Wine Notepad windows with separate synthetic
files. The restricted observer discovers both through the existing X11
`/windows` inventory and requires disjoint nonempty numeric X11 identifiers.
The brokered writer selects the second title, checks both identities remain
observable, and edits/saves only that window. The network-none verifier checks
the second file changed and the original did not; both are checked again after
STOP. In instrumented mode the independent AHK hook must record fresh
keydown/up for the selected sibling and none for the original during the
bounded operation. Runtime does not claim independent Windows key sensing.
This correlates two application-level observation sources and independently
checked effects. X11 identifiers are not Windows HWNDs; title matching is not
a proof of arbitrary unique native targeting or capture of every event.
No private CRE runtime, new provider, system-call, debugger, VM or hardware
vantage is added. No identifiers, event payloads or fixture files are uploaded.

## R084 follow-on: lease expiry and explicit recovery

Before selecting the second window, renew the existing hybrid-control grant
for two seconds and wait for actual elapsed time. A complete targeted edit/save
must be denied with 423, renewal must be denied with 403, and the same session
must report USER control, no lease and WAIT rather than STOP. The independent
network-none verifier checks both original and sibling saved text unchanged.
Instrumented mode requires no fresh hook events for either fixture window
during the denied sequence while the hook remains active. A new acknowledged
challenge/grant must then succeed; the existing real sibling edit, hook pair
and independently verified saved contents establish recovery of useful
actuation before the separate STOP experiment. Runtime claims no independent
key sensing. This is a bounded same-session lease-expiry and recovery witness,
not durable authority across process crashes, concurrent actor isolation, or
arbitrary host/VM/device instrumentation.

## R084 follow-on: unresolved target fail-closed witness

While a valid acknowledged lease remains active and both positively exercised
fixture windows remain live, request a fixed nonexistent window title using
explicit X11 and AHK keyboard backends. A complete synthetic edit/save sequence
must receive target/dispatch refusal (not lease denial), and instrumented mode
must see no fresh fixture-window hook events. Independently verify both saved
texts unchanged even if a backend reports unexpected success. Fixed result
markers identify the backend and refusal/hook predicate without publishing
raw event or response data. An actual failure is a production-owner blocker,
not permission to relax this test or modify other workcells. X11 identifiers
and AHK title matching remain distinct; this does not prove arbitrary native
handle, stale-window race or in-flight cancellation behavior.

### Unresolved-target failure containment

The exact predecessor `61783783c388b4e6720a67f2fada80022c1611a5` failed the AHK missing-window refusal in both Wine 11 modes (public Actions run [46414370762](https://github.com/SemperSupra/WineBot/actions/runs/46414370762)). Instrumented AHK hook absence and independent sibling saved-content preservation also failed; xdotool refusal passed. This is a production actuator targeting defect, not permission to repair the actuator in this workcell. The negative assertions remain mandatory. The runner now attempts both independent readbacks, STOP and the same confirmed Docker retirement even after a missing-target failure. A successful STOP or retirement never turns an actuator/effect failure into qualification. Post-STOP content checks retain the original expected content; a pre-existing mismatch can therefore still fail them. This is failure-path evidence, not a production fix or arbitrary vantage integration. No raw evidence, registry push or bridge artifact upload.
Loading