Skip to content

fix(release): convert UDZO to temp path + compact (DMG repackage)#955

Merged
senamakel merged 1 commit into
tinyhumansai:mainfrom
senamakel:fix/dmg-repackage-temp-path
Apr 27, 2026
Merged

fix(release): convert UDZO to temp path + compact (DMG repackage)#955
senamakel merged 1 commit into
tinyhumansai:mainfrom
senamakel:fix/dmg-repackage-temp-path

Conversation

@senamakel
Copy link
Copy Markdown
Member

@senamakel senamakel commented Apr 27, 2026

Summary

Supersedes the retry-only approach in #952. The macOS release pipeline kept failing on Re-package DMG after notarization with:

Preparing imaging engine…
hdiutil: convert failed - internal error

Investigation against actual GitHub macOS runner logs confirmed the failure is structural, not transient — it fires in ~6ms, every attempt, before any real work. Root cause: hdiutil convert -ov -o "$DMG_PATH" reopens the source path for write while the imaging engine still holds a handle on the input DMG, producing the unspecific "internal error".

  • Convert UDZO to a temporary output path, then mv over the original. The in-place overwrite is what trips the engine; a separate output path sidesteps it.
  • hdiutil compact the writable image first to discard the zero blocks left over from the 1GB resize, so the UDZO output isn't carrying hundreds of MB of empty space.
  • Retry loop preserved (now cleans up the temp file between attempts) — it never helped against the structural bug, but it's still the right belt-and-braces for genuine flakes.

Reference failing run: https://github.com/tinyhumansai/openhuman/actions/runs/24970255766/job/73111881422

Test plan

  • Dispatch a staging release; confirm Re-package DMG after notarization succeeds and the resulting DMG is correctly compressed (not the bloated 1GB writable layout).
  • Confirm the final DMG mounts, contains OpenHuman.app plus the Applications symlink, and stapled validation still passes.

Summary by CodeRabbit

  • Chores
    • Improved release build process by optimizing disk image creation. Enhanced compaction and conversion procedures to reduce file sizes and increase reliability, with better cleanup handling during retries.

`hdiutil convert -ov -o "$DMG_PATH"` fails consistently on the macOS GitHub
runner with "hdiutil: convert failed - internal error" (~6ms in, before
real work begins). The retry-on-flake fix from the previous commit doesn't
help — the failure isn't transient, it's structural: the source DMG handle
is still held by the imaging engine when the same path is reopened for
write. The retries just hit the same condition three times.

- Convert to a temporary output path, then `mv` over the original. The
  in-place overwrite is what trips the imaging engine.
- `hdiutil compact` the writable image first to discard the zero blocks
  left over from the 1GB resize, so the UDZO pass has less to do and
  the final DMG isn't artificially huge.

Retry loop preserved for genuine transient flakes, but cleans up the
temp file between attempts.
@senamakel senamakel requested a review from a team April 27, 2026 01:29
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

The repackage-dmg.sh script is updated to compact the writable DMG image before UDZO conversion to reclaim space and reduce conversion failures. Output is now written to a temporary path and moved over the original, with cleanup on each retry attempt and final failure.

Changes

Cohort / File(s) Summary
DMG Repackaging Optimization
scripts/release/repackage-dmg.sh
Adds hdiutil compact step before UDZO conversion to reduce file size; shifts conversion output to a temporary file with subsequent move-over operation; ensures temporary output cleanup during retries and on failure paths.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A humble bunny optimizes the way,
Compacting DMG files to save the day,
With temp files nestled and moves so neat,
The repackage dance is now more sweet! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the main changes: converting UDZO to a temporary path and adding compact functionality for DMG repackaging, which aligns with the primary objectives of the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@senamakel senamakel merged commit cc53614 into tinyhumansai:main Apr 27, 2026
8 of 9 checks passed
AusAgentSmith pushed a commit to AusAgentSmith/openhuman that referenced this pull request May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant