Repository navigation
AI-3610: save the Swift package cache only from main - #2235
Merged
Merged
Conversation
A pull request's copy of the Swift package cache (about 1.1 GB) is readable only by that pull request. These copies push the repo cache over its limit, and GitHub then deletes entries of all workflows, main's Swift entry included. Pull requests now restore main's entry.
dangusev
marked this pull request as ready for review
November 23, 2026 16:30
kanat
added a commit
that referenced
this pull request
Nov 23, 2026
## Why
The `swift` job of CI (client SDKs) fails at "Build swift_demo" on
`main` and on unrelated PRs since 14:17 today:
`StreamWebRTC.framework/Headers/RTCPeerConnection.h has been modified
since the module file`. Runner image and Xcode are the same in the last
pass and the failures (`xcode-27-arm64 20261104.0337.1`, Xcode 27.0).
What changed is the SPM cache.
## How it works
```
run 45192193934 (main, 14:15) cache miss -> fetch -> cancelled mid-fetch
└─ cache/save (if: always()) saves the half-fetched spm dir, 347 MB
every later run
├─ that entry restored (exactly or by restore-key)
├─ core build: repos missing, resolves the newest Package.swift allows
│ StreamWebRTC 156.0.7 -> DerivedData (modules from 156.0.7 headers)
└─ swift_demo build: its Package.resolved pins StreamWebRTC 145.17.0
copies 145.17.0 headers into the SAME DerivedData
-> "has been modified since the module file"
```
The last pass (run
[45164527848](https://github.com/GetStream/Agents/actions/runs/45164527848))
restored a 1.15 GB cache, and the core build reused the checkouts
swift_demo had left (StreamWebRTC 145.17.0), so both builds agreed by
luck.
| Change | Result |
|---|---|
| swift_demo builds into `$RUNNER_TEMP/SwiftDemoDerivedData` | the two
builds never share modules, whatever versions each resolves |
| cache/save: `!cancelled()`, the core build succeeded and the
swift_demo build did not fail, in place of `always()`; kept with #2235's
push-only term (`github.event_name == 'push'`) | a cancelled or failed
fetch is not saved as a key that is then never saved again |
| key prefix `spm-` -> `swiftpm-` | main stops restoring the partial
entry |
Sharing DerivedData saved no compile work: in the passing run swift_demo
recompiled stream-core-swift, swift-protobuf, stream-video-swift and
stream-chat-swift anyway, because it pins stream-chat-swift `develop`
(`examples/voice_agents/swift_demo/app/SwiftDemo.xcodeproj/project.pbxproj:305-308`).
Both builds still share the checkout directory. Every build and test
step stays.
## Validation
| Run | Commit | swift job |
|---|---|---|
|
[45164527848](https://github.com/GetStream/Agents/actions/runs/45164527848)
| main 323143f, warm cache | pass |
|
[45192548920](https://github.com/GetStream/Agents/actions/runs/45192548920)
| main 06a1d64, partial cache | fail |
|
[45198669130](https://github.com/GetStream/Agents/actions/runs/45198669130)
| PR #2219, partial cache | fail |
|
[45204272824](https://github.com/GetStream/Agents/actions/runs/45204272824/job/137795720232)
attempt 1, cold cache | head 30bb4eb | pass: core resolved
StreamWebRTC 156.0.7, swift_demo 145.17.0 (the failing mix), 173 tests
passed |
|
[45204272824](https://github.com/GetStream/Agents/actions/runs/45204272824/job/137810817020)
attempt 2, warm cache (1.1 GB exact hit) | head 30bb4eb | pass: both
builds on StreamWebRTC 145.17.0, 173 tests passed |
The swift_demo build took 6m14s and 6m07s of its 10-minute limit; it
took 5m39s with the shared DerivedData in the last pass. `actionlint`
reports only the existing `runs-on: xcode-27` label it does not know.
AI-3583
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
kanat
added a commit
that referenced
this pull request
Nov 23, 2026
## Why `client-sdks.yml` cancelled in-progress runs on every ref, main included. Since #2235 only a push to main saves the Swift package cache, and since #2225 a cancelled run saves nothing. An empty-cache swift job takes about 21 minutes, so when main gets a push faster than that, no run finishes and the cache is never saved. After #2225 merged, main runs 45229507749 (17:36 UTC) and 45232221644 (17:51 UTC) were cancelled by the next push; run 45233683223 finished and saved `swiftpm-…` on `refs/heads/main` (`gh api repos/GetStream/Agents/actions/caches?key=swiftpm-`). AI-3639. ## How it works `cancel-in-progress` is an expression, which GitHub allows ([docs](https://docs.github.com/en/actions/using-jobs/using-concurrency): "can specify `cancel-in-progress` as an expression", example `${{ !contains(github.ref, 'release/')}}`). It is now `github.event_name == 'pull_request'`. | Event | group | cancel-in-progress | Result | |---|---|---|---| | push to main | `…-push-main` | `false` | the running run finishes and saves the cache; a newer push waits as pending; a still newer push replaces the pending one (docs: "any existing `pending` job or workflow in the same concurrency group will be canceled") | | pull_request from branch X | `…-pull_request-X` | `true` | a new push cancels the older run of the same PR, as before | | pull_request from a fork's `main` | `…-pull_request-main` | `true` | its own group: it never cancels or replaces a run of main's push group (the event is in the key for this) | The workflow has only `push` and `pull_request` triggers (`client-sdks.yml:3-30`), so no other event reaches the expression. ## Validation - `actionlint .github/workflows/client-sdks.yml`: only the known `xcode-27` runner-label warning. - Other workflows: `run_tests.yml:68` saves a mypy cache only on push, and `ci-go`, `ci-python`, `ci-sdks`, `integration`, `python-versions`, `run_tests` cancel on main too. Not changed here; a cancelled mypy-cache run only costs a cold mypy cache, not 21 minutes. - Unverified until merge: that main runs now queue and the cache is saved. Watch the first pushes to main that touch the paths of this workflow: no run of `CI (client SDKs)` on main should end `cancelled`, and `gh api repos/GetStream/Agents/actions/caches?key=swiftpm-` should list an entry on `refs/heads/main`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Why
The repo cache holds 11.77 GB in 34 entries. The default limit is 10 GB. Above the limit, GitHub deletes the entries used least recently, from all workflows. The Swift job saves its package cache (about 1.1 GB) from pull requests too, and a pull request's copy is readable only by that pull request. On 2026-11-23 the same Swift cache was in the repo cache three times: on main, on #2224 and on #2225.
From 2026-10-24 to 2026-11-23:
The key inputs changed on main once in that period (#1880), so the misses come from deletions. AI-3610 has the full cache breakdown.
How it works
Package.swift,Package.resolvedor the keyThe mypy cache already saves only on push (
.github/workflows/run_tests.yml:67). The change is the save condition at.github/workflows/client-sdks.yml:243.In the 30 days above, one pull request changed the key inputs (#1880, 1 Swift run). #2225 changes the key prefix and edits the same
if:, so the second of the two to merge needs a rebase. After #2225 merges, the oldspm-entries on main (about 1.45 GB) can be deleted withgh cache delete.Validation
actionlintis not installed here, so it did not run.🤖 Generated with Claude Code