Repository navigation
ci: let the deadline of the workspace image restore stop the Linux and macOS mounts - #346256
Merged
Ladislau Szomoru (lszomoru) merged 1 commit intoNov 5, 2026
Conversation
…d macOS mounts The mount commands of Linux (sudo blockdev and sudo mount) and macOS (diskutil image attach) ran synchronously, which held back the timer of the deadline: a stalled mount could still reach the timeout of the step with the image half attached, and a slow mount could report the image after the deadline. They now run asynchronously, and the deadline stops them; a mount that completed before they stopped is unmounted, and the Linux loop device detached, as after any other error. The restore also checks the deadline once more before it reports the image, as synchronous work can hold back its timer. Co-authored-by: Alex Dima <alexdima@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Aiday Marlen Kyzy (aiday-mar)
approved these changes
Nov 5, 2026
Dirk Bäumer (dbaeumer)
approved these changes
Nov 5, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Synchronous Git configuration can overrun the deadline and still report success while leaving the late image mounted.
1 open issue
What changed in this PR
This follow-up extends workspace-image restore deadline handling to Linux and macOS, addressing synchronous mount commands that could block timeout handling.
Changes:
- Runs Linux and macOS mount commands asynchronously and waits for process exit before cleanup.
- Cleans up mounts after failures and checks the deadline before accepting a restored image.
- Shares the process-exit helper with Windows without changing its attach behavior.
| File | Description |
|---|---|
.github/workflows/workspace_image/image.ts |
Adds deadline-aware mount commands, failure cleanup, and a final restore deadline check. |
Review effort: Balanced
| if (!fs.existsSync(path.join(ws, '.git'))) { | ||
| throw new Error('The image holds no .git'); | ||
| } | ||
| checkDeadline(); |
Ladislau Szomoru (lszomoru)
deleted the
lszomoru/agents/workspace-image-restore-mounts
branch
November 5, 2026 15:17
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.

Follow-up to #346254, for its review comment, which came in after it merged.
The mount commands of
image.ts restoreon Linux (sudo blockdevandsudo mount) and macOS (diskutil image attach) ran synchronously, which held back the timer of the deadline that #346254 added: a stalled mount could still reach the timeout of the step with the image half attached, and a slow mount could report the image after the deadline.What changed
runUntilDeadline), and the deadline stops them. As on Windows, the restore waits for the process to exit before it cleans up.No job restores an image yet, and the commands that build the images are unchanged.
How to test
Validation of this change:
./node_modules/.bin/tsc --noEmit --strict --module nodenext --moduleResolution nodenext --target es2024 --lib es2024,dom --types node --skipLibCheck --erasableSyntaxOnly --noUnusedLocals --noUnusedParameters .github/workflows/workspace_image/image.ts: passed./node_modules/.bin/eslint .github/workflows/workspace_image/image.ts: passedcd build && node --test lib/test/detectMissingCaches.test.ts lib/test/detectChanges.test.ts lib/test/workspaceImage.test.ts lib/test/agentHostTestSelection.test.ts: 34 passedimage.ts restoreon macOS against a local mock of the API and of an artifact, with a fakediskutilfirst on thePATH: an attach that stalls for 30 s with a 3 s deadline now stops after 3.2 s withused=falseand an empty workspace (before, it blocked for 30 s); an attach that completes without a valid image unmounts it and reportsused=false.sudo.