YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(enterprise): bundle mlx.metallib — v2.5.29 crashed at launch on macOS
Louis Beaumonte1664841a93f
diff --git a/.github/workflows/release-enterprise.yml b/.github/workflows/release-enterprise.ymlindex 49b3c4980..fe2528319 100644--- a/.github/workflows/release-enterprise.yml+++ b/.github/workflows/release-enterprise.yml@@ -503,6 +503,124 @@ jobs:fidone+ - name: Inject mlx.metallib into Contents/MacOS/ + re-sign+ # MLX's runtime library search looks for mlx.metallib next to the+ # binary (Contents/MacOS/), not in the app's Resources dir. Tauri's+ # `bundle.resources` always lands in Contents/Resources/, so we have+ # to physically copy the file into Contents/MacOS/ ourselves.+ #+ # Without this the enterprise build ships parakeet-mlx (see the+ # --features list in the build step) but no Metal shader library:+ # MLX throws "Failed to load the default metallib", its default C+ # error handler calls exit() mid-startup, and static-destructor+ # teardown races the ONNX CoreML model compile threads → SIGSEGV+ # at launch (v2.5.29 enterprise crash).+ #+ # Mirrors "Inject mlx.metallib into Contents/MacOS/ + re-sign" in+ # release-app.yml: copy + re-sign + rebuild DMG BEFORE notarization+ # (adding files to a signed bundle invalidates the cdhash). Unlike+ # the consumer step this also rebuilds the updater tarball here,+ # since this workflow has no separate staple/tarball step and the+ # R2 upload ships macos/*.app.tar.gz for auto-updates.+ shell: bash+ env:+ APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}+ TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}+ TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}+ run: |+ set -euo pipefail+ TARGET="aarch64-apple-darwin"+ BUNDLE_DIR="${GITHUB_WORKSPACE}/apps/screenpipe-app-tauri/src-tauri/target/${TARGET}/release/bundle"+ APP_DIR="${BUNDLE_DIR}/macos"++ shopt -s nullglob+ apps=( "${APP_DIR}"/*.app )+ if [ ${#apps[@]} -eq 0 ]; then+ echo "::error::no .app bundle in ${APP_DIR} — Tauri build did not produce one"+ exit 1+ fi+ APP="${apps[0]}"+ RES_LIB="${APP}/Contents/Resources/mlx.metallib"++ # The enterprise build always compiles parakeet-mlx, so a missing+ # or placeholder metallib means we would ship the launch crash —+ # hard-fail instead of soft-skipping like the consumer workflow+ # (which also builds non-mlx targets).+ if [ ! -f "$RES_LIB" ]; then+ echo "::error::no Contents/Resources/mlx.metallib — check bundle.resources in tauri.enterprise.conf.json"+ exit 1+ fi+ SIZE=$(stat -f%z "$RES_LIB")+ if [ "$SIZE" -lt 1000000 ]; then+ echo "::error::Resources/mlx.metallib is only ${SIZE} bytes (placeholder) — build.rs metallib download failed; parakeet-mlx would crash at runtime"+ exit 1+ fi++ echo "=== Injecting mlx.metallib into Contents/MacOS/ (${SIZE} bytes) ==="+ cp "$RES_LIB" "${APP}/Contents/MacOS/mlx.metallib"++ # Re-unlock the keychain before re-signing — same retry pattern the+ # build step uses, since codesign needs the cert.+ BUILD_KC="$HOME/Library/Keychains/build.keychain-db"+ if [ -f "$BUILD_KC" ]; then+ security unlock-keychain -p "build_password" "$BUILD_KC"+ security set-keychain-settings -t 3600 "$BUILD_KC"+ fi++ # Re-sign the bundle. --deep so all inner binaries stay covered;+ # --force so the existing signature is replaced. Same identity ++ # entitlements + hardened-runtime flags Tauri used.+ codesign --force --deep \+ --sign "$APPLE_SIGNING_IDENTITY" \+ --options runtime \+ --entitlements apps/screenpipe-app-tauri/src-tauri/entitlements.plist \+ --timestamp \+ "$APP"+ codesign --verify --deep --strict --verbose=2 "$APP"+ echo "${APP##*/} re-signed with mlx.metallib in Contents/MacOS/"++ # Rebuild the DMG from the patched .app, keeping the Applications+ # symlink so users still get the drag-to-install affordance.+ DMG_DIR="${BUNDLE_DIR}/dmg"+ dmgs=( "${DMG_DIR}"/*.dmg )+ if [ ${#dmgs[@]} -gt 0 ]; then+ DMG="${dmgs[0]}"+ echo "=== Replacing DMG: ${DMG##*/} ==="+ rm -f "$DMG"+ DMG_STAGE="${RUNNER_TEMP:-/tmp}/screenpipe-enterprise-dmg-stage-$$"+ mkdir -p "$DMG_STAGE"+ cp -R "$APP" "$DMG_STAGE/"+ ln -s /Applications "$DMG_STAGE/Applications"+ hdiutil create \+ -volname "screenpipe enterprise" \+ -srcfolder "$DMG_STAGE" \+ -ov \+ -format UDZO \+ -imagekey zlib-level=9 \+ "$DMG"+ rm -rf "$DMG_STAGE"+ codesign --force --sign "$APPLE_SIGNING_IDENTITY" --timestamp "$DMG"+ codesign --verify --verbose=2 "$DMG"+ echo "${DMG##*/} re-created + signed from patched .app"+ else+ echo "no DMG produced — skipping DMG rebuild"+ fi++ # Rebuild the updater tarball so auto-updates ship the patched+ # .app, and re-sign it — the Tauri-built .sig covers the+ # pre-patch bytes and would no longer match.+ APP_NAME="${APP##*/}"+ TARBALL="${APP_DIR}/${APP_NAME}.tar.gz"+ if [ -f "$TARBALL" ]; then+ echo "=== Rebuilding updater tarball ${APP_NAME}.tar.gz ==="+ rm -f "$TARBALL" "${TARBALL}.sig"+ ( cd "$APP_DIR" && tar czf "${APP_NAME}.tar.gz" "${APP_NAME}" )+ ( cd "${GITHUB_WORKSPACE}/apps/screenpipe-app-tauri" && bunx tauri signer sign "$TARBALL" )+ echo "${APP_NAME}.tar.gz rebuilt and re-signed"+ else+ echo "no updater tarball produced — skipping tarball rebuild"+ fi+- name: Notarize and staple DMGenv:APPLE_ID: ${{ secrets.APPLE_ID }}diff --git a/apps/screenpipe-app-tauri/src-tauri/tauri.enterprise.conf.json b/apps/screenpipe-app-tauri/src-tauri/tauri.enterprise.conf.jsonindex 50ac859cb..3d361b9f7 100644--- a/apps/screenpipe-app-tauri/src-tauri/tauri.enterprise.conf.json+++ b/apps/screenpipe-app-tauri/src-tauri/tauri.enterprise.conf.json@@ -40,6 +40,7 @@],"resources": ["assets/*",+ "mlx.metallib","PermissionFlow_PermissionFlow.bundle"],"macOS": {