From 4880eba3bb0f018340e320406ac191e24d7c3475 Mon Sep 17 00:00:00 2001 From: sheehanmunim Date: Wed, 19 Aug 2026 03:59:10 -0400 Subject: [PATCH] fix(fleet): build what was pushed, and stop calling a good Mac install a failure The Windows refresh repairs a drifted `origin` (Blade still pointed at the pre-move sheehanmunim/t3code, where `main` does not resolve) and now refuses to build a stale checkout instead of shipping whatever commit the machine sat on under the new version number. The Mac relaunch treats a fresh PID as success. Gating it on an AppleScript System Events probe - which needs an Automation grant the installing shell may not have - reported a good install as a failure. Co-Authored-By: Claude Opus 5 (1M context) --- scripts/personal-install-relaunch-mac.sh | 15 ++++++------- scripts/personal-refresh-win.ps1 | 28 ++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/scripts/personal-install-relaunch-mac.sh b/scripts/personal-install-relaunch-mac.sh index c08f6a5be6b7..5010f8a98af6 100755 --- a/scripts/personal-install-relaunch-mac.sh +++ b/scripts/personal-install-relaunch-mac.sh @@ -228,16 +228,15 @@ relaunch_t3() { sleep 0.25 continue fi - if osascript >/dev/null 2>&1 <<'APPLESCRIPT' -tell application "System Events" - if not (exists process "MT Code") then error "no process" -end tell + # A fresh PID is the proof the relaunch worked. The AppleScript below + # only brings the window forward, and it needs an Automation grant the + # installing shell may not have — gating success on it reported a + # perfectly good install as "no fresh MT Code process after open". + osascript >/dev/null 2>&1 <<'APPLESCRIPT' || true tell application "MT Code" to activate APPLESCRIPT - then - echo "MAC_GUI_VISIBLE $APP_PATH pid=$pid" - return 0 - fi + echo "MAC_GUI_VISIBLE $APP_PATH pid=$pid" + return 0 fi sleep 0.25 done diff --git a/scripts/personal-refresh-win.ps1 b/scripts/personal-refresh-win.ps1 index a88a58055acd..37268b1e1583 100644 --- a/scripts/personal-refresh-win.ps1 +++ b/scripts/personal-refresh-win.ps1 @@ -31,12 +31,36 @@ function Log($msg) { Log "refresh start" Log ("args DesktopVersion=$DesktopVersion ForceRebuild=$ForceRebuild envVersion=$($env:T3CODE_DESKTOP_VERSION) envForce=$($env:T3_FORCE_REBUILD)") +$productRepoUrl = "https://github.com/munimtechnologies/mtcode.git" if (-not (Test-Path $repo)) { - git clone --branch main --single-branch https://github.com/munimtechnologies/mtcode.git $repo + git clone --branch main --single-branch $productRepoUrl $repo } Set-Location $repo + +# A checkout made before the repo moved still points at the old remote, where +# "main" does not resolve. Left alone, the fetch fails, rev-parse errors, and +# the build silently ships whatever commit this machine happened to be sitting +# on - which is how Blade and Dell ended up a day behind while reporting the +# new version number. +$currentRemote = (git remote get-url origin 2>$null) +if ($LASTEXITCODE -ne 0) { + git remote add origin $productRepoUrl +} elseif ($currentRemote.Trim() -ne $productRepoUrl) { + Log "origin was $currentRemote - repointing at $productRepoUrl" + git remote set-url origin $productRepoUrl +} + git fetch origin main -$new = (git rev-parse origin/main).Trim() +if ($LASTEXITCODE -ne 0) { + Log "fetch from origin failed - refusing to build a stale checkout" + exit 1 +} +$new = (git rev-parse origin/main 2>$null) +if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($new)) { + Log "origin/main did not resolve - refusing to build a stale checkout" + exit 1 +} +$new = $new.Trim() $old = "" if (Test-Path $stateFile) { $old = (Get-Content $stateFile -Raw).Trim()