Skip to content

improve: build macOS release architectures concurrently - #135753

Merged
steipete merged 2 commits into
mainfrom
codex/macos-release-build-reuse
Sep 2, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/macos-release-build-reuse

Conversation

@steipete

@steipete steipete commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Universal macOS packaging builds its arm64 and x86_64 native dependency graphs serially, leaving release time on the table even when the host can build both architectures. This runs the two graphs concurrently while keeping the total Swift compiler job budget bounded by available CPUs.

Why This Change Was Made

The packaging owner now delegates each architecture to an isolated app and MLX package root, with separate SwiftPM scratch paths, a verified read-only Peekaboo source snapshot, invocation-owned resource backups, and an exclusive architecture lock. The existing managed-child process owner joins workers and descendants before restoring patched sources or detaching snapshots. A failed build cancels its sibling; cleanup failure retains work and ownership locks for diagnosis. Assembly begins only after both builds verify the expected source revision.

The old serial graph loop and shared temporary-package/snapshot cleanup path are removed. The existing shell build logic is extracted into one worker owner, rather than duplicated. Production delta is +197 lines after accounting for the move; the additional code owns concurrent scheduling, cancellation, and verified cleanup. Tests add 132 net lines. No new operator configuration is introduced.

User Impact

Maintainers can produce universal macOS releases sooner without changing the packaged application's behavior. This is an internal release-tooling change, so no product changelog entry is needed.

Evidence

  • Before: an execution barrier in the original serial graph loop observed only arm64 starting and exited 41 while waiting for the second architecture.
  • node scripts/run-vitest.mjs test/scripts/package-mac-app.test.ts: 81 tests passed. Executable fixtures cover concurrent success, worker failure, source-revision mismatch, parent cancellation, cleanup failure and retained locks, resource restoration, snapshot verification, and existing packaging behavior.
  • Hosted CI caught the missing Knip executable entry and a Linux-incompatible mount path in the snapshot fixture. The canonical entry is now declared and both unused-file scans pass. Five focused snapshot scenarios pass, including retention when the mount is active or listing fails; this expands the owner suite to 83 cases.
  • After the final lint edits, the five executable parallel-build scenarios passed again. Bash syntax checks, targeted formatting, and type-aware lint passed. The scoped Codex autoreview found no actionable P0 findings.
  • Two real SwiftPM packages sharing source files built arm64 and x86_64 concurrently with separate package/scratch roots and two jobs each: 7.55s and 7.56s worker times, 7.56s total. Both binaries had the requested architecture; package manifests remained unchanged. This proves the SwiftPM isolation contract, not a complete signed application release.
  • The complete packager, extracted worker, managed-child lifecycle owner, relevant SwiftPM CLI/source contracts, and focused tests were inspected. A full application rebuild and Apple upload were deliberately not repeated for this post-release follow-up.

Alternative considered: simply backgrounding the original loop would share shell state, package lockfiles and cleanup ownership; architecture-local workers keep those responsibilities explicit. Remaining limitation: no end-to-end signed universal application was rebuilt for this change.

@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XL maintainer Maintainer-authored PR labels Sep 2, 2026
@steipete steipete self-assigned this Sep 2, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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. labels Sep 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 9:46 PM ET / September 2, 2026, 01:46 UTC.

ClawSweeper review

What this changes

This PR runs arm64 and x86_64 macOS Swift build graphs concurrently in isolated workers before assembling the universal application.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for normal maintainer gating: the introduced scheduler correctly waits for architecture-local builds and verified cleanup before assembly, but the supplied exact-head CI rollup is still incomplete/truncated.

Priority: P2
Reviewed head: 764454e7c343f4bad1dc74bf5726ca46d722f9d1

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The scheduler has focused lifecycle coverage and bounded real-build evidence, with no introduced correctness defect found.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This maintainer-authored internal release-tooling PR is exempt from the external-contributor proof gate; its body nevertheless reports two real concurrent SwiftPM architecture builds, while explicitly not claiming a complete signed universal-package run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored internal release-tooling PR is exempt from the external-contributor proof gate; its body nevertheless reports two real concurrent SwiftPM architecture builds, while explicitly not claiming a complete signed universal-package run.
Evidence reviewed 6 items Assembly waits for the scheduler: The package owner starts the scheduler, waits for its successful exit, and only then reads architecture outputs and begins app assembly.
Cleanup ownership is fail-safe: The scheduler joins all build workers before per-architecture cleanup; an unverified worker tree or cleanup failure retains the lock and returns a nonzero result.
Strict child lifecycle contract: The shared managed-child owner finalizes process groups and output pipes when strict process-tree exit is requested, matching the scheduler's use of that mode.
Findings None None.
Security None None.

How this fits together

The macOS packager builds Swift application and helper binaries for each CPU architecture, then combines their outputs into one signed app. This change replaces its serial build stage with a scheduler that collects verified per-architecture results before assembly.

flowchart LR
  A[Mac release packager] --> B[Architecture scheduler]
  B --> C[arm64 worker]
  B --> D[x86_64 worker]
  C --> E[Verified build results]
  D --> E
  E --> F[Universal app assembly]
Loading

Before merge

  • Resolve merge risk (P1) - The supplied check rollup remains incomplete and truncated for the exact PR head, so merge readiness cannot yet be established.
  • Complete next step (P2) - No repair is indicated; maintainers should wait for the exact-head CI gate before deciding to merge.
Agent review details

Security

None.

PR surface

Tests +132, Other +197. Total +329 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 199 67 +132
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 4 696 499 +197
Total 5 895 566 +329

Review metrics

Metric Value Why it matters
Production versus test delta production +197, tests +132 The production growth is the isolated scheduler, cancellation, verification, and cleanup ownership replacing the serial packaging path; focused tests cover its failure modes.

Stored data model

Persistent data-model change detected: serialized state: scripts/build-mac-swift.mts, unknown-data-model-change: scripts/build-mac-swift.mts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Complete exact-head CI (recommended)
    Wait for the current head's required CI results to finish green before merging this release-build scheduler.

Technical review

Best possible solution:

Retain the isolated scheduler design and land only after the exact head has completed the required CI gates; the owner has already accepted the intentionally bounded signed-package validation scope.

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

Not applicable: this is an internal release-packaging performance change, not a reported user-facing defect. The changed behavior has focused scheduler-harness coverage and reported real SwiftPM runs.

Is this the best way to solve the issue?

Yes. Isolated architecture workers preserve per-build package, snapshot, resource-patch, and cleanup ownership, whereas backgrounding the former loop would retain shared lifecycle state.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against fc277615d8e4.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded macOS release-tooling improvement rather than a user-facing outage.
  • merge-risk: 🚨 availability: The new scheduler determines whether macOS application builds complete, clean up, and reach assembly safely.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal release-tooling PR is exempt from the external-contributor proof gate; its body nevertheless reports two real concurrent SwiftPM architecture builds, while explicitly not claiming a complete signed universal-package run.

Evidence

What I checked:

  • Assembly waits for the scheduler: The package owner starts the scheduler, waits for its successful exit, and only then reads architecture outputs and begins app assembly. (scripts/package-mac-app.sh:303, 764454e7c343)
  • Cleanup ownership is fail-safe: The scheduler joins all build workers before per-architecture cleanup; an unverified worker tree or cleanup failure retains the lock and returns a nonzero result. (scripts/build-mac-swift.mts:101, 764454e7c343)
  • Strict child lifecycle contract: The shared managed-child owner finalizes process groups and output pipes when strict process-tree exit is requested, matching the scheduler's use of that mode. (scripts/lib/managed-child-process.mts:425, 764454e7c343)
  • Focused behavior coverage: The test harness drives the real parent scheduler path with a barrier that distinguishes concurrent execution, and covers success, worker failure, source mismatch, cancellation, and cleanup failure. (test/scripts/package-mac-app.test.ts:14, 764454e7c343)
  • Feature-history routing: The scheduler handoff was introduced by this PR's first commit; its raw parent is the verified merge base and the current package call site derives from that commit. (scripts/package-mac-app.sh:305, b94e950aff4f)
  • Prior proof disposition: The maintainer comment explicitly accepts the bounded SwiftPM proof and records that the prior optional full signed universal-package rank-up was intentionally skipped for this post-release tooling change.

Likely related people:

  • unknown: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Allow the exact-head CI rollup to complete green before merging.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-02T01:27:19.107Z sha 764454e :: needs maintainer review before merge. :: none

@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer disposition of the completed review on 764454e7c343f4bad1dc74bf5726ca46d722f9d1: accept the documented full-package validation gap for this post-release tooling improvement. The requested scope is focused testing and landing, without repeating a signed application release. The original 81-case packaging suite, the executable concurrent success/failure/cancellation/cleanup fixtures, the additional active-mount and failed-list retention cases, and two real concurrent SwiftPM architecture builds provide the bounded evidence. Exact-head hosted CI remains mandatory. The optional rank-up request for another complete signed universal build is explicitly skipped; no claim is made that the focused SwiftPM fixture proves final application signing or packaging.

The detected “serialized state” is invocation-owned build output under the existing temporary app staging directory: verified source/output facts and a cleanup-complete receipt. Normal success removes it with staging; uncertain cleanup retains it with the owned lock for diagnosis. It is not Gateway/runtime persisted state, a database schema, or an upgrade migration.

CI follow-up: the first exact-head run hit a CLI help-process deadlock guard after printing help and startup traces. The same unaffected shard passed on the preceding head. Its failed job was retried once, together with the two Swift jobs that had no runner and no executed steps, after all active work completed. The remaining completed checks were retained.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 2, 2026
@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Exact-head CI run 33579008526, attempt 3 is green on 764454e7c343f4bad1dc74bf5726ca46d722f9d1. Native prepare accepted the hosted evidence and preserved that head without rebasing or adding another build.

Both unrelated timing failures passed their single failed-job retry. Named follow-up: replace the fixed 100 ms settlement in OnboardingAISetupTests.swift with an explicit completion signal for the separately scheduled manual activation; the first executed Swift run observed isBusy before that completion in the cancel/manual case. The source was not changed here. The CLI help-process timeout also passed on retry. Completed jobs were retained throughout.

The full signed universal-package proof gap remains as documented and accepted in the maintainer disposition above.

@steipete
steipete merged commit 00baa02 into main Sep 2, 2026
495 of 502 checks passed
@steipete
steipete deleted the codex/macos-release-build-reuse branch September 2, 2026 02:10
@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 2, 2026
)

* perf: build macOS release architectures concurrently

* fix: register macOS scheduler and isolate mount fixtures
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL 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