Repository navigation
fix(artifacts): recheck failed DMG detaches before reporting cleanup failure - #1155
Merged
Merged
Conversation
…failure NativeDmgArtifactReader.close() detached each device once and, when a detach failed, asked `hdiutil info` once whether the device was still attached. On APFS images, detaching the synthesized container ejects the image disk too. `hdiutil info` can still list that ejected device briefly, and a just-read volume can report busy. Either way a real cleanup succeeded but close() reported "DMG detach or mount-root cleanup failed" and kept the mount root. macOS CI hit this intermittently in verify:macos-bundle: `hdiutil detach /dev/disk23` failed with "No such file or directory" (already ejected) and the device was still counted as attached. The #1103 review also raised the missing recheck. After the first pass, recheck the remaining devices up to three times with 250/500/1000 ms settle delays. Drop any that hdiutil no longer lists, retry the detach of any still listed, and fail only for devices that stay attached. The host seam gains an optional delay so tests run without real waits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
…ion gate The new busy-device and recheck cases copied the fake hdiutil host and the APFS close sequence from neighbouring tests, which pushed jscpd to its 2.5% threshold in Static checks. Share one single-device host between the busy and retained-attachment cases and one APFS close helper between the ejected-device cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
N0zoM1z0
approved these changes
Oct 9, 2026
N0zoM1z0
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed detach/recheck ordering, retained-attachment recovery, and attach-failure cleanup. The delayed rechecks keep persistent failures actionable and avoid treating an already-ejected APFS device as a cleanup failure. Independent Linux validation: build, static checks, 11 tests passed (3 macOS-only tests skipped). The exact-head real Apple artifact CLI/MCP CI also passed.
This was referenced Oct 9, 2026
darsrc
pushed a commit
to darsrc/rea
that referenced
this pull request
Oct 10, 2026
…failure (morluto#1155) * fix(artifacts): recheck failed DMG detaches before reporting cleanup failure NativeDmgArtifactReader.close() detached each device once and, when a detach failed, asked `hdiutil info` once whether the device was still attached. On APFS images, detaching the synthesized container ejects the image disk too. `hdiutil info` can still list that ejected device briefly, and a just-read volume can report busy. Either way a real cleanup succeeded but close() reported "DMG detach or mount-root cleanup failed" and kept the mount root. macOS CI hit this intermittently in verify:macos-bundle: `hdiutil detach /dev/disk23` failed with "No such file or directory" (already ejected) and the device was still counted as attached. The morluto#1103 review also raised the missing recheck. After the first pass, recheck the remaining devices up to three times with 250/500/1000 ms settle delays. Drop any that hdiutil no longer lists, retry the detach of any still listed, and fail only for devices that stay attached. The host seam gains an optional delay so tests run without real waits. * test(artifacts): share DMG detach fixtures to stay under the duplication gate The new busy-device and recheck cases copied the fake hdiutil host and the APFS close sequence from neighbouring tests, which pushed jscpd to its 2.5% threshold in Static checks. Share one single-device host between the busy and retained-attachment cases and one APFS close helper between the ejected-device cases. ---------
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
NativeDmgArtifactReader.close()detaches each device once. When a detach fails, it askshdiutil infoonce whether the device is still attached, and counts it as a cleanup failure if so. That single check is racy:hdiutil infocan still list the ejected device for a moment.In both cases the cleanup actually succeeds or would succeed, but
close()throwsDMG detach or mount-root cleanup failedand keeps the mount root. Inventory and extraction callers then report the false failure.This is the intermittent "Real Apple artifact CLI/MCP E2E" failure in
verify:macos-bundle(for example on #1070, #1097 andfix/hopper-block-endpoints). Since #1103 added the cause to the message, the job log shows the mechanism:The device was already gone, but it was still counted as attached. The #1103 review raised the same missing recheck ("Recheck failed devices after completing the detach loop"), and it was still unaddressed on
main.Change
hdiutil infono longer lists;hdiutildiagnostic and the mount root kept, as before.NativeDmgHostgains an optionaldelay, so tests exercise the recheck without real waits. The attach-failure cleanup path goes throughclose()and gets the same behavior.Verification
npm run test:focused -- tests/boundary/providers/native/nativeDmgArtifactReader.test.ts. Two new cases: a device listed once more after its container's detach ejected it, which matches the CI log; and a device that is busy on its first detach, then detaches within the same close. Both fail onmain. The existing APFS, retained-attachment and attach-cleanup cases still pass.hdiutiltest "classifies a real hdiutil verify refusal…" fails on this Mac identically on unmodifiedmain. It's environmental and passes on CI runners.hdiutil createimages throughrea inspect-artifact. All succeeded, andhdiutil infoshowed no leftover devices.npm run check:fastNo real Hopper or Ghidra verification was run, because this change does not touch those providers.
🤖 Generated with Claude Code