From d73edcabd88eaa195de686cc5cb158601d4ece28 Mon Sep 17 00:00:00 2001 From: alex anikin <60673011+anikinsasha@users.noreply.github.com> Date: Mon, 13 Jul 2026 20:18:45 -0700 Subject: [PATCH] fix(Interceptor): test-profile auto-launch fails while Chrome is already running MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On macOS, `open -a --args …` silently drops the arguments when the browser is already running — it just activates the existing window. Since the operator's working Chrome is normally open, LaunchTestProfile.sh could never open the test-profile window, so EnsureTestProfile's auto-recovery always timed out waiting for the pinned context and every workflow stopped at the gate. Invoke the browser binary directly instead: Chrome's process singleton forwards --profile-directory/--new-window to the running instance, so the profile window opens whether or not the browser was already up. `open -a` remains as a fallback when the binary isn't at the expected path. New optional override: INTERCEPTOR_TEST_BROWSER_BIN. Also add preferences.env.example documenting the contract variables the three gate/launch tools read (INTERCEPTOR_TEST_CONTEXT_ID, INTERCEPTOR_TEST_CHROME_PROFILE, optional browser overrides, working-profile deny-list) — currently they're only discoverable by reading the scripts, and a wrong guess at the variable name fails as 'no test profile configured'. --- .../Interceptor/Tools/LaunchTestProfile.sh | 20 +++++++++--- .../Interceptor/preferences.env.example | 31 +++++++++++++++++++ 2 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 LifeOS/install/skills/Interceptor/preferences.env.example diff --git a/LifeOS/install/skills/Interceptor/Tools/LaunchTestProfile.sh b/LifeOS/install/skills/Interceptor/Tools/LaunchTestProfile.sh index 18f39a791b..f7ad247069 100755 --- a/LifeOS/install/skills/Interceptor/Tools/LaunchTestProfile.sh +++ b/LifeOS/install/skills/Interceptor/Tools/LaunchTestProfile.sh @@ -56,10 +56,22 @@ fi case "$(uname -s)" in Darwin) - # No -n flag here — we want to reuse the existing Chrome process so the new - # window shares the user-data-dir lock with Default. Chrome handles - # --profile-directory by opening a window for that profile in the existing - # instance. + # Direct binary, not `open -a … --args`: when the browser is ALREADY + # RUNNING, `open` silently drops the --args (macOS behavior), so the + # profile window never opens and the isolation gate times out waiting + # for the context. Invoking the binary directly forwards the args to + # the running instance via Chrome's process singleton — the profile + # window opens whether or not the browser was already up. + CHROME_BIN="${INTERCEPTOR_TEST_BROWSER_BIN:-/Applications/${BROWSER}.app/Contents/MacOS/${BROWSER}}" + if [ -x "$CHROME_BIN" ]; then + "$CHROME_BIN" \ + --profile-directory="$CHROME_PROFILE" \ + --new-window \ + "$START_URL" >/dev/null 2>&1 & + exit 0 + fi + # Fallback (binary not at the expected path): reliable only when the + # browser is not already running. exec open -a "$BROWSER" --args \ --profile-directory="$CHROME_PROFILE" \ --new-window \ diff --git a/LifeOS/install/skills/Interceptor/preferences.env.example b/LifeOS/install/skills/Interceptor/preferences.env.example new file mode 100644 index 0000000000..81de8ca742 --- /dev/null +++ b/LifeOS/install/skills/Interceptor/preferences.env.example @@ -0,0 +1,31 @@ +# Interceptor per-machine preferences — the contract read by +# Tools/PreflightIsolation.sh, Tools/EnsureTestProfile.sh, and +# Tools/LaunchTestProfile.sh. +# +# Copy to: +# ~/.claude/LIFEOS/USER/CUSTOMIZATIONS/SKILLS/Interceptor/preferences.env +# and fill in the two required values. + +# REQUIRED — the pinned test context the agent is allowed to drive. +# Set this friendly name ONCE in the extension popup's Context ID field +# (click the Interceptor toolbar icon → Context ID → Save). Friendly names +# survive extension reloads; raw UUIDs rot on every reload. +INTERCEPTOR_TEST_CONTEXT_ID="interceptor-test" + +# REQUIRED for auto-launch — the dedicated test profile's on-disk directory +# name (e.g. "Profile 2"). Map directory → profile name via Chrome's +# "Local State" file (profile.info_cache), or chrome://version → Profile Path. +# There is deliberately no default: guessing a profile could open the +# operator's working window. +INTERCEPTOR_TEST_CHROME_PROFILE="" + +# Optional — browser app name (default "Google Chrome"). +#INTERCEPTOR_TEST_BROWSER="Google Chrome" + +# Optional — direct path to the browser binary, used so launches work while +# the browser is already running (macOS `open -a … --args` drops the args). +#INTERCEPTOR_TEST_BROWSER_BIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" + +# Optional — comma-separated context IDs of the operator's WORKING profiles; +# the preflight gate hard-denies driving any of these. +#INTERCEPTOR_WORKING_PROFILE_IDS=""