Skip to content

perf(computer): trim Windows disks and keep background app installs out of them - #526

Merged
earakely-scale merged 4 commits into
mainfrom
edgararakelyan/fd-5328-windows-trim
Nov 7, 2026
Merged

earakely-scale merged 4 commits into
mainfrom
edgararakelyan/fd-5328-windows-trim

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

What this does

Makes Windows disks smaller (FD-5328, parts 1 and 2):

  • Trim before shutdown. Before a Windows base or composed layer shuts down to be packed, agent-env clears what Windows keeps that a computer doesn't need (update downloads, temp files, the delivery-optimization cache) and trims the free space.
  • Discards reach the image. The launcher attaches a Windows disk with discard=unmap,detect-zeroes=unmap and presents it as an SSD (rotation_rate=1), so Windows' TRIM reaches the image.
  • Rewrite after shutdown. The image is rewritten with qemu-img convert: a base on its own, a layer over its base (-B), so it keeps only the clusters Windows uses.
  • No background app installs. The base no longer lets Windows install apps in the background. Those installs ended up in every composed layer and would rerun at every boot. Edge's updater (which installed the Copilot app, 555 MB) is disabled, and Windows' first-sign-in installers for the new Outlook and Dev Home are removed.

compact.ps1 is part of the base's recipe, so a base installed before this is installed again, trimmed, on its next compose.

Measured

On an EC2 c8i.4xlarge with nested KVM, running agent-env run tst/integration/computer/windows probe and reset:

main trim only trim, no background installs (this PR)
Base disk (disk/base.img) 16.2 GB 11.7 GB 11.6 GB (−28%)
Composed layer (cua-driver) 777 MB 1.43 GB 749 MB
Install until the session user is signed in 757 s 775 s 764 s
Compose, probe and reset pass pass pass

The first trimmed run grew the layer because Windows installed apps in the background while it was composed: the Copilot app (555 MB, through Edge's updater) and the new Outlook (77 MB). The base now turns those off, which matters for deploys too, since they would otherwise run at every boot.

Docker reports a Windows image at about twice its disk's size because containerd keeps the compressed blob and the unpacked copy. The sizes above are the disks', from docker history.

Not in this PR

  • FD-5328 part 3: stop copying the base into a launcher image for every launcher version. Docker 28+ can mount an image's files into a container (--mount type=image), which on the test box read the composed disk's base.img and disk.img in place. That's a design choice of its own, coming separately.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable issues were found.

Summary

Windows builds now clear caches and trim free space before shutdown, then rewrite the disk before packing it.

  • Windows base disks and layers are cleaned and compacted before packing.
  • Windows bases no longer install extra apps in the background.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Install base or provision layer] --> B[Clear caches and trim free space]
    B --> C[Shut down Windows]
    C --> D[Rewrite disk with qemu-img convert]
    D --> E{Composed layer?}
    E -->|Yes| F[Make backing path relative]
    E -->|No| G[Pack base image]
    F --> H[Pack layer over base]
Loading

Reviews (1) · Last reviewed commit: "style(computer): rewrap setup.ps1's head..." · Reviewed by Greptile

earakely-scale and others added 4 commits November 7, 2026 07:10
…e before packing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… it uses, a layer over its base

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… Edge updater, new Outlook or Dev Home

They wrote 630 MB into a composed layer, the Copilot app (555 MB) through Edge's updater
and the new Outlook, and would run at every boot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale requested a review from a team as a code owner November 7, 2026 16:30
@earakely-scale
earakely-scale merged commit 6d63fe7 into main Nov 7, 2026
34 checks passed
@earakely-scale
earakely-scale deleted the edgararakelyan/fd-5328-windows-trim branch November 7, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant