Skip to content

Drop every module cache before saving the CI cache - #393

Merged
mattt merged 2 commits into
mattt:mainfrom
oliverames:ci-drop-all-module-caches
Nov 21, 2026
Merged

mattt merged 2 commits into
mattt:mainfrom
oliverames:ci-drop-all-module-caches

Conversation

@oliverames

@oliverames oliverames commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Hi @mattt. This follows the macOS 26 job failures on #390 (and the other recent PRs). The failure is not a test: the macOS 26 job fails in different steps on different runs (Test once, Build on the latest run) with a stale module cache.

error: Clang dependency scanner failure: fatal error: file '/Applications/Xcode_26.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/clang/include/module.modulemap' has been modified since the module file '/Users/runner/Library/Developer/Xcode/DerivedData/.../HelperDerivedData/ModuleCache.noindex/3NAHVDSC2YQWF/_Builtin_float-FTUUUU4ZHFEK.pcm' was built
fatal error: could not build module 'CoreFoundation'

There are two parts to it. First, the cleanup step removes only DerivedData/ModuleCache.noindex, but the iMCP Helper target keeps a second module cache at DerivedData/<project>/Build/Intermediates.noindex/iMCP.build/HelperDerivedData/ModuleCache.noindex, and that is what ends up in the saved archive. Second, Xcode 26.0 and 26.0.1 share build 17A400, so the cache key didn't change when the image moved to 26.0.1. The archive saved with the Helper's module cache inside still matches the key, gets restored, and the build fails before any test runs.

This PR removes every ModuleCache.noindex under DerivedData before the cache is saved, and adds a v2 to the cache key so the bad 17A400 archives already saved on main stop being restored. GitHub caches can't be overwritten under the same key, so without the version bump they'd keep coming back until they're evicted.

I could not verify this in CI from my fork (the workflow runs on PRs to main, and my branch is from upstream/main), but the path in the error and the cleanup step line up exactly, and this PR's own macOS 26 job passes. Deleting the 17A400 entries from the Actions cache would do the same as the key bump if you'd rather keep the key as it was.

The macOS 26 job fails with a stale module cache after a runner image
update: the cached .pcm was built by Xcode 26.0 and the image now has
26.0.1. The Helper target keeps its own module cache under
DerivedData/.../HelperDerivedData/ModuleCache.noindex, which the old
cleanup (DerivedData/ModuleCache.noindex only) left in the archive.
Remove every ModuleCache.noindex under DerivedData.
Xcode 26.0 and 26.0.1 share build 17A400, so the archives saved with the
Helper's module cache inside still match the old key.
@oliverames

Copy link
Copy Markdown
Contributor Author

@mattt I found a second half to this. Xcode 26.0 and 26.0.1 share build 17A400, so the cache key didn't change when the runner image moved, and the archive that already has the Helper's module cache inside it keeps matching and getting restored. GitHub won't overwrite a cache under the same key, so the cleanup alone wouldn't have helped until those entries aged out.

I added a v2 to the key so the bad 17A400 archives stop being restored. If you'd rather keep the key as it was, deleting the 17A400 entries from the Actions cache does the same thing. I updated the description to match.

@mattt
mattt merged commit 25e1f05 into mattt:main Nov 21, 2026
2 checks passed
@mattt

mattt commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Thanks, @oliverames. Merged! A push to each of your other PRs will start a fresh CI run with the new cache key.

@oliverames
oliverames deleted the ci-drop-all-module-caches branch November 25, 2026 15:12
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.

2 participants