Skip to content

fix: bundle macOS native dependencies before signing - #197383

Merged
jalehman merged 1 commit into
mainfrom
fix/macos-package-dylib-closure
Nov 12, 2026
Merged

jalehman merged 1 commit into
mainfrom
fix/macos-package-dylib-closure

Conversation

@jalehman

@jalehman jalehman commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes macOS builds that crash at launch because Sparkle is missing, or whose MLX voice helper can find a required Swift library only on the build machine.

User Impact

Packaged apps include the locked Sparkle framework and point the MLX helper at the bundled compatibility library. Packaging fails before signing or replacing an existing output if a native dependency cannot resolve within the app or the system libraries.

Why This Change Was Made

Swift Build's products directory does not contain the resolved Sparkle binary artifact. The packager silently skipped that missing path. Separately, MLX is its own executable and cannot inherit the main app's Frameworks runpath.

Use SwiftPM's locked artifact directly, fix the helper's install name before signing, and extend the existing native inventory/portability owner to check each executable and its dependency chain. The existing stricter private-runtime audit remains unchanged. No dependency versions, signing identities, entitlements, or installed application state change.

Evidence

  • Real incident bundles: the production guard rejects the defective app's missing Sparkle dependency and accepts the repaired app (54 native files, including universal binaries).
  • On macOS, node scripts/run-vitest.mjs test/scripts/mac-runtime.test.ts test/scripts/package-mac-app.test.ts --maxWorkers=1: 196 passed, 90.58 seconds in Vitest / 99.39 seconds including the wrapper. The new compiled native regression took 973 ms. CI seconds are not yet available.
  • Three focused regressions fail against the original production files and pass with the repair: resolved Sparkle embedding, missing-artifact rejection, and dependency validation before signing. The native fixture also verifies sibling-runpath isolation, the real install-name repair, and missing transitive dependencies.
  • Scoped tooling typecheck, targeted lint, format, Bash/Node syntax, and both production/full-tree unused-file scans pass. The initial borrowed-install typecheck refusal was resolved using a physically owned dependency copy; shared installs were not modified.
  • Independent read-only P0–P2 subagent review against base 4576d88153188f35067baff75f60586e311ea9a6: no verified findings. A subsequent one-line test-boundary adjustment made the native regression fail on the original behavior rather than a missing marker; its red/green run passed. This is a narrative review, not a helper-validated result.
  • Simplification: removed silent Sparkle omission; reused the existing inventory/parser and preserved the runtime-only policy. Necessary growth is the executable-local/transitive dependency traversal. The separate 141-line test allocation covers these packaging regressions without raising the shared scalar.

Fresh exact-head pnpm mac:package release/arm64 packaging passed from an independent checkout with private state and an ad-hoc debug bundle identity. Final-output verification passed dependency closure (54 native images), deep/strict codesign, exact source metadata, embedded Sparkle, and the MLX bundled compatibility-library route. The package also passed its signed private-runtime proof. This is arm64 packaging proof, not a Developer ID/notarized release, universal build, installation, GUI, or personal Keychain acceptance. Exact-head CI and PR tooling Darwin passed, including the required CI gate. Scope-skipped lanes are not additional passing proof. Hosted ClawSweeper review completed on this exact head with no actionable findings and no before-merge items; it recommends maintainer review. Its evidence limitation is that the public PR contains narrative packaging results rather than raw terminal output.

@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: macos App: macos scripts Repository scripts size: M labels Nov 11, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 11, 2026
@jalehman
jalehman marked this pull request as ready for review November 11, 2026 21:21
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 11, 2026
@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR embeds the locked Sparkle artifact, repairs the MLX helper’s library reference, and checks native dependencies before signing.

Example: Packaging an arm64 app when Sparkle exists in SwiftPM’s artifacts directory but not its release products directory.

  • Before: Packaging silently omits Sparkle.framework, producing an app that cannot launch.
  • After: Packaging embeds Sparkle.framework and rejects unresolved native dependencies before signing or replacing the previous output.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused repair and meaningful native regressions support correctness, while independently inspectable end-to-end evidence is limited.
Proof confidence 🦐 gold shrimp (3/6) Under the task’s explicit maintainer-authored classification, the ordinary contributor proof gate does not apply; the body reports mac:package exercising Sparkle embedding, MLX routing, dependency closure, and signing on arm64, but supplies narrative results rather than raw output.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A packaged macOS app can fail to launch, and its local voice helper can depend on a build-machine Swift library.
Reason: Self-contained native dependencies are an existing packaging contract, and the task explicitly establishes maintainer-authored direction.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR repairs concrete macOS packaging failures still present on main, with no verified introduced defect.

Priority: P1
Reviewed head: 8eec478962592edf2443193fc28d5fac38e21f8f

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No inspectable terminal output accompanies the reported exact-head arm64 packaging run.
Agent review details

How this fits together

The macOS packager assembles Swift products, frameworks, helpers, and the private Bun runtime into a staged app, verifies its dependencies, signs it, and publishes the verified bundle.

flowchart LR
  A[Locked SwiftPM artifacts] --> C[Staged app assembly]
  B[Swift executables and private runtime] --> C
  C --> D[Executable local dependency audit]
  D --> E[Signing and runtime verification]
  E --> F[Verified app replacement]
Loading

Technical review

Best possible solution:

Keep dependency assembly and validation in the existing packaging and portability owners, preserving signing policy and verified output replacement.

Do we have a high-confidence way to reproduce the issue?

Source shows the silent missing-framework path and absent MLX reference repair; the author reports native red/green regressions, but this read-only review executed no target code.

Is this the best way to solve the issue?

The patch fixes dependency production and routing before validating the assembled artifact, and each added test covers a distinct failure without introducing a competing owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 17140700d7b5.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned introduction and current-main comparison: The introduced diff contains the packaging repair; the three production owners remain unchanged between the merge base and fetched main, so main does not already contain it. (scripts/package-mac-app.sh:436, 8eec47896259)
  • Missing Sparkle producer repair: The base returns a products-directory path and conditionally skips embedding; the patch selects the resolved XCFramework and fails when its binary is absent. (scripts/lib/mac-swift-build.sh:44, 8eec47896259)
  • Helper repair and publication ordering: The MLX install-name change targets the bundled Frameworks directory; dependency closure runs before signing, process shutdown, and output replacement. (scripts/package-mac-app.sh:431, 8eec47896259)
  • Distinct native regression coverage: A compiled native fixture checks missing Sparkle, independent helper runpaths, the actual install-name repair, and missing transitive libraries; packaging fixtures cover resolved-artifact embedding and rejection. (test/scripts/mac-runtime.test.ts:1402, 8eec47896259)
  • Existing runtime contract preserved: The private-runtime caller retains its stricter audit; app-wide traversal reuses the inventory and Mach-O parser rather than replacing that contract. (scripts/verify-mac-runtime.mjs:60, 8eec47896259)
  • Discussion and supplied execution evidence: The complete body reports exact-head arm64 packaging, dependency closure over 54 native images, strict signing verification, and signed-runtime checks; no raw terminal capture or media accompanies those claims, and both comments are review-status messages. (8eec47896259)

Likely related people:

  • Vincent Koc: Raw commit 59fab88 adds scripts/package-mac-app.sh:9 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 59fab88896ba; files: scripts/package-mac-app.sh)
  • Dallin Romney: Raw commit 993ec29 adds scripts/package-mac-app.sh:319 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 993ec298df4e; files: scripts/package-mac-app.sh)

PR surface

Tests +141, Docs +2, Other +121. Total +264 across 8 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 143 2 +141
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 5 139 18 +121
Total 8 284 20 +264

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test changes Production/tooling +137/-18; tests +143/-2 Growth adds executable-local dependency traversal using the existing parser and inventory, with focused artifact, helper-path, transitive-dependency, and ordering regressions.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The existing packager can produce an app that crashes at launch or a voice helper dependent on libraries available only on the build host.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach redacted terminal output from the reported exact-head packaging and final dependency verification.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 11, 2026, 4:39 PM ET / 21:39 UTC.

@jalehman
jalehman merged commit f817a8b into main Nov 12, 2026
224 of 229 checks passed
@jalehman
jalehman deleted the fix/macos-package-dylib-closure branch November 12, 2026 05:55
@jalehman

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 13, 2026
maplel pushed a commit to maplel/openclaw that referenced this pull request Nov 24, 2026
(cherry picked from commit f817a8b)
Source-x: f817a8b
Backport scope: scripts/lib/mac-swift-build.sh sparkle_framework_for_arch selects locked XCFramework artifact; scripts/package-mac-app.sh mandatory Sparkle embedding/MLX install-name repair; scripts/lib/mac-runtime-portability.mjs app-mode per-executable closure before signing/replacement.
Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit f91f5e9709a84f61806b428ca86b1e2bb502c54b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant