Doubao-powered voice input for Linux, Wayland and Omarchy
fix(workflow): stabilize Midscene model E2E (#33)
Leyangdef8be7a1ead
diff --git a/.github/workflows/midscene-omarchy-4.0.3.yml b/.github/workflows/midscene-omarchy-4.0.3.ymlindex 2389f95..9665d04 100644--- a/.github/workflows/midscene-omarchy-4.0.3.yml+++ b/.github/workflows/midscene-omarchy-4.0.3.yml@@ -57,7 +57,9 @@ permissions:packages: readconcurrency:- group: midscene-model-e2e+ # Keep only one pending run for this workflow and ref. Ubuntu, Omarchy, main,+ # and unrelated PRs must not replace one another in GitHub's concurrency queue.+ group: midscene-model-e2e-${{ github.workflow }}-${{ github.ref }}cancel-in-progress: falsejobs:@@ -74,6 +76,9 @@ jobs:MIDSCENE_MODEL_REASONING_ENABLED: ${{ secrets.MIDSCENE_MODEL_REASONING_ENABLED }}MIDSCENE_COMPUTER_HEADLESS_LINUX: "true"MIDSCENE_REPLANNING_CYCLE_LIMIT: "40"+ # GitHub runners intermittently time out while Node races IPv4 and IPv6+ # addresses. The configured model endpoint is reachable over IPv4.+ NODE_OPTIONS: "--dns-result-order=ipv4first --no-network-family-autoselection"outputs:report-artifact-id: ${{ steps.report.outputs.artifact-id }}steps:diff --git a/.github/workflows/midscene-ubuntu-22.04.yml b/.github/workflows/midscene-ubuntu-22.04.ymlindex 5f107b7..f334086 100644--- a/.github/workflows/midscene-ubuntu-22.04.yml+++ b/.github/workflows/midscene-ubuntu-22.04.yml@@ -36,7 +36,9 @@ permissions:contents: readconcurrency:- group: midscene-model-e2e+ # Keep only one pending run for this workflow and ref. Ubuntu, Omarchy, main,+ # and unrelated PRs must not replace one another in GitHub's concurrency queue.+ group: midscene-model-e2e-${{ github.workflow }}-${{ github.ref }}cancel-in-progress: falsejobs:@@ -106,7 +108,8 @@ jobs:libasound2 libatk-bridge2.0-0 libdrm2 libgbm1 libgtk-3-0 \libnotify4 libnss3 libpng16-16 libsecret-1-0 libx11-6 \libxinerama1 libxkbcommon-x11-0 libxss1 libxtst6 \- python3-cairo python3-gi x11-xserver-utils xdg-utils xvfb+ python3-cairo python3-gi python3-tomli \+ x11-xserver-utils xdg-utils xvfb- name: Install pinned Midscene dependenciesworking-directory: tests/e2e@@ -154,7 +157,34 @@ jobs:- name: Verify polishing overlay with Midsceneworking-directory: tests/e2e- run: timeout --signal=TERM --kill-after=10s 10m npm test -- --project ubuntu-polishing+ env:+ NODE_OPTIONS: --dns-result-order=ipv4first --no-network-family-autoselection --require=./node_modules/@computer-use/libnut/dist/import_libnut.js+ run: |+ set -o pipefail+ polishing_passed=false+ for test_attempt in 1 2 3 4; do+ attempt_log="/tmp/ubuntu-polishing-midscene-attempt-${test_attempt}.log"+ if timeout --signal=TERM --kill-after=10s 10m \+ npm test -- --project ubuntu-polishing 2>&1 | tee "$attempt_log"; then+ polishing_passed=true+ break+ fi++ if ! grep -Eq 'Connection error|ETIMEDOUT|ECONNRESET|EAI_AGAIN|UND_ERR_CONNECT_TIMEOUT|failed to call AI model service' "$attempt_log"; then+ echo "Ubuntu polishing Midscene failed for a non-network reason; not retrying." >&2+ exit 1+ fi+ if [[ $test_attempt -lt 4 ]]; then+ retry_delay=$((15 * test_attempt))+ echo "Transient model connection failure on polishing attempt ${test_attempt}; retrying in ${retry_delay} seconds." >&2+ sleep "$retry_delay"+ fi+ done++ if [[ $polishing_passed != true ]]; then+ echo "Ubuntu polishing Midscene exhausted four model-connection attempts." >&2+ exit 1+ fi- name: Upload Midscene reportif: always()diff --git a/tests/e2e/cases/polishing.yaml b/tests/e2e/cases/polishing.yamlindex 0456502..34e840a 100644--- a/tests/e2e/cases/polishing.yaml+++ b/tests/e2e/cases/polishing.yaml@@ -12,6 +12,6 @@ cases:- aiAct: Click Start reduced motion once in the test controls window.- aiAssert: The overlay shows English Polishing status, three clearly visible stars, and the separate transcript Please send the notes tomorrow.- aiAct: Click Finish polishing once in the test controls window.- - aiAssert: The overlay status reads Polished - Sending text and the three polishing stars have disappeared.+ - aiAssert: Within the dark transcript overlay, the status reads Polished - Sending text and its top-right status row no longer contains the three small polishing star icons. Ignore the desktop wallpaper and any system logo outside the dark overlay.- aiAct: Click Hide overlay once in the test controls window.- aiAssert: The dark transcript overlay is gone. The Polishing overlay test controls window remains visible.diff --git a/tests/e2e/polish_fixture.py b/tests/e2e/polish_fixture.pyindex 79a42f3..6894680 100644--- a/tests/e2e/polish_fixture.py+++ b/tests/e2e/polish_fixture.py@@ -1,8 +1,17 @@"""Native polishing overlay fixture; no microphone, network, or input injection."""import signal+import sysimport gi+# Ubuntu 22.04 supplies PyGObject for its system Python 3.10. The application+# requires Python 3.11+, but this isolated fixture must use the system Python to+# share GTK bindings, so provide the standard-library module through tomli.+if sys.version_info < (3, 11):+ import tomli++ sys.modules["tomllib"] = tomli+gi.require_version("Gtk", "4.0")from gi.repository import GLib, Gtk@@ -15,7 +24,7 @@ def main():set_language("en")overlay = Overlay()window = Gtk.Window(title="Polishing overlay test controls")- window.set_default_size(480, 320)+ window.set_default_size(520, 520)box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=12)for side in ("start", "end", "top", "bottom"):getattr(box, "set_margin_" + side)(24)@@ -39,6 +48,7 @@ def main():]for title, callback in actions:button = Gtk.Button(label=title)+ button.set_size_request(-1, 44)button.connect("clicked", lambda _button, action=callback: action())box.append(button)loop = GLib.MainLoop()diff --git a/tests/e2e/run-omarchy-midscene.sh b/tests/e2e/run-omarchy-midscene.shindex f59ad9b..2027bee 100755--- a/tests/e2e/run-omarchy-midscene.sh+++ b/tests/e2e/run-omarchy-midscene.sh@@ -13,6 +13,8 @@ readonly SSH_PORT=2222readonly PLUGIN_DIR="/home/omarchy/.config/omarchy/plugins/md.lifeos.doubao-say"readonly SHIM_DIR="$(mktemp -d)"readonly PLUGIN_ARCHIVE="$(mktemp /tmp/doubao-say-omarchy-plugin-XXXXXX.tar)"+readonly MODEL_TEST_ATTEMPTS=4+readonly MODEL_NETWORK_FAILURE_PATTERN='Connection error|ETIMEDOUT|ECONNRESET|EAI_AGAIN|UND_ERR_CONNECT_TIMEOUT|failed to call AI model service'export NODE_OPTIONS="${NODE_OPTIONS:-} --require=$ROOT_DIR/tests/e2e/node_modules/@computer-use/libnut/dist/import_libnut.js"VM_PID=""@@ -180,7 +182,7 @@ start_guest_fixture() {MIDSCENE_PASSED=falseATTEMPT_LOG=""-for _test_attempt in 1 2 3; do+for ((_test_attempt = 1; _test_attempt <= MODEL_TEST_ATTEMPTS; _test_attempt++)); dostart_guest_fixtureATTEMPT_LOG="/tmp/omarchy-midscene-attempt-${_test_attempt}.log"if npm --prefix tests/e2e test -- \@@ -189,18 +191,19 @@ for _test_attempt in 1 2 3; dobreakfi- if ! grep -Eq 'Connection error|ETIMEDOUT|failed to call AI model service' "$ATTEMPT_LOG"; then+ if ! grep -Eq "$MODEL_NETWORK_FAILURE_PATTERN" "$ATTEMPT_LOG"; thenecho "Omarchy Midscene failed for a non-network reason; not retrying." >&2exit 1fi- if [[ $_test_attempt -lt 3 ]]; then- echo "Transient model connection failure on attempt $_test_attempt; retrying in 10 seconds." >&2- sleep 10+ if ((_test_attempt < MODEL_TEST_ATTEMPTS)); then+ retry_delay=$((15 * _test_attempt))+ echo "Transient model connection failure on attempt $_test_attempt; retrying in $retry_delay seconds." >&2+ sleep "$retry_delay"fidoneif [[ $MIDSCENE_PASSED != true ]]; then- echo "Omarchy Midscene exhausted three model-connection attempts." >&2+ echo "Omarchy Midscene exhausted $MODEL_TEST_ATTEMPTS model-connection attempts." >&2exit 1fi@@ -226,7 +229,7 @@ done# Reuse the same live Hyprland session for a visual comparison against# Omarchy's OCR and hyprctl-based acceptance checks.MENU_PASSED=false-for _test_attempt in 1 2 3; do+for ((_test_attempt = 1; _test_attempt <= MODEL_TEST_ATTEMPTS; _test_attempt++)); doATTEMPT_LOG="/tmp/omarchy-menu-midscene-attempt-${_test_attempt}.log"if OMARCHY_SSH_KEY="$SSH_KEY" npm --prefix tests/e2e test -- \--project omarchy-shell 2>&1 | tee "$ATTEMPT_LOG"; then@@ -234,17 +237,18 @@ for _test_attempt in 1 2 3; dobreakfi- if ! grep -Eq 'Connection error|ETIMEDOUT|failed to call AI model service' "$ATTEMPT_LOG"; then+ if ! grep -Eq "$MODEL_NETWORK_FAILURE_PATTERN" "$ATTEMPT_LOG"; thenecho "Omarchy menu visual test failed for a non-network reason; not retrying." >&2exit 1fi- if [[ $_test_attempt -lt 3 ]]; then- echo "Transient model connection failure on menu attempt $_test_attempt; retrying in 10 seconds." >&2- sleep 10+ if ((_test_attempt < MODEL_TEST_ATTEMPTS)); then+ retry_delay=$((15 * _test_attempt))+ echo "Transient model connection failure on menu attempt $_test_attempt; retrying in $retry_delay seconds." >&2+ sleep "$retry_delay"fidoneif [[ $MENU_PASSED != true ]]; then- echo "Omarchy menu visual test exhausted three model-connection attempts." >&2+ echo "Omarchy menu visual test exhausted $MODEL_TEST_ATTEMPTS model-connection attempts." >&2exit 1fi