From 2236a96ed4f8ede72341cbe8eb95fb96782a485a Mon Sep 17 00:00:00 2001 From: type-two Date: Wed, 8 Jul 2026 21:22:14 +1000 Subject: [PATCH] fix(flowext): a locked screen wedges the rig; and `open location` opened the wrong browser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. LOCKED SCREEN. With CGSSessionScreenIsLocked=Yes, every AppleScript window/tab query hangs ~2 min and returns -1712 "AppleEvent timed out". This is NOT a browser bug — with m3ultra locked, `count of windows` hung identically for Chrome, Brave, Finder AND System Events, while app-level properties (name/version/running) answered instantly. launch.sh now checks the lock first and exits 0 with an instruction, so the 10-min tick retries instead of leaving two osascript processes wedged. 2. `open location "$URL"` is Standard Additions: it hands the URL to the DEFAULT browser, never to $BROWSER. m3ultra's default is Brave while the extension lives in Chrome, so the fresh-open path would have opened the wrong browser entirely. Now makes the tab inside the target app. 3. Wrapped the tell block in `with timeout of 30 seconds` so a wedged app can't hold the job. Verified: detector reports unlocked on ultra / LOCKED on m3ultra; after the fix m3ultra logs the instruction and exits with no hung osascript, ultra still logs "focused on Flow". Co-Authored-By: Claude Opus 4.8 --- launch.sh | 50 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/launch.sh b/launch.sh index 24c24c2..0ef06b7 100755 --- a/launch.sh +++ b/launch.sh @@ -37,24 +37,40 @@ fi # # Must name the browser the EXTENSION is loaded into. ultra = Brave, m3ultra = Chrome. BROWSER="${FLOW_BROWSER:-Brave Browser}" + +# A LOCKED SCREEN wedges every AppleScript window/tab query for ~2 min, then -1712 +# "AppleEvent timed out". Not a browser bug: with the screen locked, Finder, System Events +# and Brave all hang on `count of windows` identically. Bail out loudly instead. +if ioreg -n Root -d1 -r | tr -d ' ' | grep -q '"CGSSessionScreenIsLocked"=Yes'; then + echo "screen is LOCKED on $(hostname -s) — cannot drive $BROWSER (every window query would" \ + "hang, then -1712). Unlock it; for an unattended rig also set System Settings >" \ + "Lock Screen > 'Require password after screen saver begins' = Never." + exit 0 # not an error: the 10-min tick retries once someone unlocks +fi + +# `open location` hands the URL to the DEFAULT browser (Brave here) — never to $BROWSER. +# Make the tab inside the target app instead. Timeout so a wedged app can't hold the job. osascript <