Skip to content

Doubao-powered voice input for Linux, Wayland and Omarchy

ci: retry transient Midscene model failures

quanru192ddfb92883
diff --git a/.github/workflows/midscene-experimental.yml b/.github/workflows/midscene-experimental.yml
index 9541f9c..b486c8c 100644
--- a/.github/workflows/midscene-experimental.yml
+++ b/.github/workflows/midscene-experimental.yml
@@ -34,6 +34,29 @@ jobs:
with:
persist-credentials: false
+ - name: Require Midscene model configuration
+ run: |
+ test -n "$MIDSCENE_MODEL_API_KEY"
+ test -n "$MIDSCENE_MODEL_NAME"
+ test -n "$MIDSCENE_MODEL_BASE_URL"
+ test -n "$MIDSCENE_MODEL_FAMILY"
+
+ - name: Check Midscene model before the expensive VM install
+ run: |
+ payload=$(jq -nc --arg model "$MIDSCENE_MODEL_NAME" '{
+ model: $model,
+ messages: [{role: "user", content: "Reply OK."}],
+ max_tokens: 1
+ }')
+ curl --fail --silent --show-error \
+ --connect-timeout 15 --max-time 90 \
+ --retry 4 --retry-all-errors --retry-delay 5 \
+ -H "Authorization: Bearer $MIDSCENE_MODEL_API_KEY" \
+ -H "Content-Type: application/json" \
+ --data "$payload" \
+ "${MIDSCENE_MODEL_BASE_URL%/}/chat/completions" \
+ >/dev/null
+
- name: Install Omarchy VM
run: tests/midscene/install-omarchy-vm.sh
@@ -43,13 +66,6 @@ jobs:
cache: npm
cache-dependency-path: tests/midscene/package-lock.json
- - name: Require Midscene model configuration
- run: |
- test -n "$MIDSCENE_MODEL_API_KEY"
- test -n "$MIDSCENE_MODEL_NAME"
- test -n "$MIDSCENE_MODEL_BASE_URL"
- test -n "$MIDSCENE_MODEL_FAMILY"
-
- name: Install Midscene and VNC bridge
run: |
sudo apt-get install -y --no-install-recommends \
diff --git a/tests/midscene/run-omarchy-midscene.sh b/tests/midscene/run-omarchy-midscene.sh
index 87a4995..a4823e5 100755
--- a/tests/midscene/run-omarchy-midscene.sh
+++ b/tests/midscene/run-omarchy-midscene.sh
@@ -84,27 +84,51 @@ tar -C "$ROOT_DIR" --exclude='__pycache__' -cf - \
ssh_guest "rm -rf '$PLUGIN_DIR' && mkdir -p '$PLUGIN_DIR' && tar -C '$PLUGIN_DIR' -xf -"
ssh_session "omarchy plugin validate '$PLUGIN_DIR'"
-ssh_session "rm -rf /tmp/doubao-midscene-config; \
- mkdir -p /tmp/doubao-midscene-config; \
- export PYTHONPATH='$PLUGIN_DIR/src'; \
- export XDG_CONFIG_HOME=/tmp/doubao-midscene-config; \
- export PYTHONDONTWRITEBYTECODE=1; \
- setsid -f python3 '$PLUGIN_DIR/tests/midscene/gtk_fixture.py' \
- >/tmp/doubao-midscene-fixture.log 2>&1"
-
-for _attempt in $(seq 1 30); do
- if ssh_session "grep -q 'READY: synthetic Doubao Say GTK fixture' /tmp/doubao-midscene-fixture.log && \
- hyprctl -j clients | jq -e '[.[] | select(.title == \"Doubao Say\")] | length == 1'" \
- >/dev/null 2>&1; then
+start_guest_fixture() {
+ ssh_session "pkill -f '[g]tk_fixture.py' >/dev/null 2>&1 || true; \
+ rm -rf /tmp/doubao-midscene-config; \
+ mkdir -p /tmp/doubao-midscene-config; \
+ export PYTHONPATH='$PLUGIN_DIR/src'; \
+ export XDG_CONFIG_HOME=/tmp/doubao-midscene-config; \
+ export PYTHONDONTWRITEBYTECODE=1; \
+ setsid -f python3 '$PLUGIN_DIR/tests/midscene/gtk_fixture.py' \
+ >/tmp/doubao-midscene-fixture.log 2>&1"
+
+ for _ready_attempt in $(seq 1 30); do
+ if ssh_session "grep -q 'READY: synthetic Doubao Say GTK fixture' /tmp/doubao-midscene-fixture.log && \
+ hyprctl -j clients | jq -e '[.[] | select(.title == \"Doubao Say\")] | length == 1'" \
+ >/dev/null 2>&1; then
+ return 0
+ fi
+ sleep 2
+ done
+
+ ssh_session "cat /tmp/doubao-midscene-fixture.log" >&2 || true
+ return 1
+}
+
+MIDSCENE_PASSED=false
+ATTEMPT_LOG=""
+for _test_attempt in 1 2 3; do
+ start_guest_fixture
+ ATTEMPT_LOG="/tmp/omarchy-midscene-attempt-${_test_attempt}.log"
+ if OMARCHY_E2E=true npm --prefix tests/midscene test -- \
+ e2e/omarchy-onboarding.test.ts 2>&1 | tee "$ATTEMPT_LOG"; then
+ MIDSCENE_PASSED=true
break
fi
- sleep 2
-done
-ssh_session "grep -q 'READY: synthetic Doubao Say GTK fixture' /tmp/doubao-midscene-fixture.log"
-ssh_session "hyprctl -j clients | jq -e '[.[] | select(.title == \"Doubao Say\")] | length == 1'"
+ if ! grep -Eq 'Connection error|ETIMEDOUT|failed to call AI model service' "$ATTEMPT_LOG"; then
+ echo "Omarchy Midscene failed for a non-network reason; not retrying." >&2
+ exit 1
+ fi
+ echo "Transient model connection failure on attempt $_test_attempt; retrying in 10 seconds." >&2
+ sleep 10
+done
-OMARCHY_E2E=true npm --prefix tests/midscene test -- \
- e2e/omarchy-onboarding.test.ts
+if [[ $MIDSCENE_PASSED != true ]]; then
+ echo "Omarchy Midscene exhausted three model-connection attempts." >&2
+ exit 1
+fi
ssh_session "hyprctl -j clients | jq -e '[.[] | select(.title == \"Doubao Say\")] | length == 1'"