fix(ios): INTERNAL builder trims its caches before disk refuses archive jobs

Merged
AZ
16d ago
+223-9

Summary

cmux23, the cmux INTERNAL iOS TestFlight builder, fell to 39.9 GiB free and its admission hook refused every archive job (run 39731717858, 2026-10-22). The watch loop never cleaned the pre-rename ~/cnx-ios-builds root, kept failed builds' .work (source and DerivedData) for 3 days, and never trimmed xcframework keys or the cargo target.

  • Build folders: also capped to the newest 5 (in addition to the 3-day rule).
  • Below 60 GiB free, and only while no runner job runs (Runner.Worker), the watch loop removes the legacy root, .work, xcframeworks beyond the newest 3 keys, and the cargo target. SwiftPM checkouts stay.
  • admit: when disk is the only reason it would refuse an admitted archive job, it trims once and checks again (the hook runs before the job's steps, and the concurrency group allows one build).
  • Design doc's watch-loop section updated.

The mini runs its own copy of this script; after merge it must be copied per the doc's Operations section (scp scripts/ci/ios_internal_builder.py cmux23:ios-internal-builder/).

Testing

python3 -m unittest tests.test_ios_internal_builder: 35 tests pass, 5 new (newest-N build folders, pressure trim keeps SwiftPM and outputs, tick trims only when low and idle, admit trims and re-checks only for an admitted job).

Changelog

  • Fixed: the cmux INTERNAL iOS builder frees its own caches before low disk refuses builds.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes the cmux INTERNAL iOS TestFlight builder (cmux23) so it frees its own caches before low disk makes its admission hook refuse archive jobs (cmux23 hit 39.9 GiB free on 2026-10-22 and refused every archive job).

  • Caps build folders to the newest 5 and, below 60 GiB free, trims the legacy ~/cnx-ios-builds root, failed builds' .work, xcframeworks beyond the newest 3 keys, and the cargo target; SwiftPM checkouts stay. Trims run only while no Runner.Worker (from any runner bin), testflight-build.sh, or build-xcframework.sh runs, and victims are renamed into .trash before deletion so a build that starts mid-delete gets a fresh directory.
  • The admission hook trims once and re-checks when disk is the only reason it would refuse an admitted archive job, logging a trim error if one occurs.
  • Updates the design doc's watch-loop section; after merge, copy the updated script to the mini runner per the doc's Operations section (scp scripts/ci/ios_internal_builder.py cmux23:ios-internal-builder/).