Skip to content

chore: fix Swift 6 / Xcode 26.4 strict concurrency build errors#727

Merged
RaajeevChandran merged 1 commit intoosaurus-ai:mainfrom
vernonstinebaker:chore/swift6-xcode26-fixes
Mar 26, 2026
Merged

chore: fix Swift 6 / Xcode 26.4 strict concurrency build errors#727
RaajeevChandran merged 1 commit intoosaurus-ai:mainfrom
vernonstinebaker:chore/swift6-xcode26-fixes

Conversation

@vernonstinebaker
Copy link
Copy Markdown
Contributor

Summary

Xcode 26.4 (released March 24, 2026) enforces Swift 6 strict concurrency checking more aggressively than Xcode 16.x. Errors that were warnings or silent in 16.x become hard build failures in 26.4, breaking compilation for anyone who has upgraded. This PR fixes all affected files.

Changes

  • Behavior change
  • UI change
  • Refactor / chore
  • Tests
  • Docs

What changed

Dependency updates (Package.swift / Package.resolved):

  • swift-sdk upToNextMinor(from: "0.10.0")from: "0.12.0": fixes a NetworkTransport data race reported upstream in fix #203 NetworkTransport race, with main-isolated variables modelcontextprotocol/swift-sdk#206. Also adds annotations: and _meta: tuple labels to Tool.Content cases that required call-site updates.
  • FluidAudio from: "0.12.1"from: "0.12.6": AsrManager was converted to an actor upstream, fixing StreamingAsrManager sending-risk data race errors that surface under Xcode 26.4's stricter checker.

Source fixes:

  • MCPProviderTool.swift — update .text, .image, .audio, .resource pattern matches to the new MCP SDK 0.12 tuple labels (annotations:, _meta: added to each case)
  • MCPProviderManager.swift — same .text(let text).text(let text, _, _) pattern update
  • WorkEngine.swift — add Sendable to WorkEngineDelegate protocol so the delegate value can cross actor isolation boundaries without a data race
  • HostAPIBridgeServer.swift — add explicit [plugin] capture list in Task { @MainActor in } closure to satisfy Swift 6 sendability checker for var plugin

Test Plan

swift test --package-path Packages/OsaurusCore

All tests pass except two known pre-existing failures (toolLoadBuffersSpec requires a loaded model; prefillDidFinish_calledAfterFirstToken is flaky under concurrent test execution due to shared InferenceProgressManager.shared state).

Build verified on macOS with Xcode 26.4.

Checklist

  • I have read CONTRIBUTING.md
  • I added/updated tests where reasonable
  • I updated docs/README as needed
  • I verified build on macOS with Xcode 16.4+

Xcode 26.4 enforces Swift 6 strict concurrency checking more aggressively
than 16.x, exposing build failures in two dependencies and three source
files that were previously only warnings or silent.

Dependency updates:
- swift-sdk 0.10.x → from: "0.12.0": fixes NetworkTransport data race
  (upstream PR osaurus-ai#206). Also adds annotations/metadata fields to
  Tool.Content cases that required call-site pattern updates.
- FluidAudio 0.12.1 → from: "0.12.6": AsrManager converted to actor,
  fixing StreamingAsrManager sending-risk data race errors.

Source fixes:
- MCPProviderTool.swift: update .text/.image/.audio/.resource pattern
  matches for new MCP SDK 0.12 tuple labels (annotations:, _meta:)
- MCPProviderManager.swift: same .text pattern match update
- WorkEngine.swift: add Sendable to WorkEngineDelegate so the delegate
  can be sent across actor boundaries without data races
- HostAPIBridgeServer.swift: explicit capture list [plugin] in
  Task { @mainactor in } closure to satisfy Swift 6 sendability checker
@RaajeevChandran
Copy link
Copy Markdown
Contributor

Good to merge!

@RaajeevChandran RaajeevChandran merged commit 2385dbb into osaurus-ai:main Mar 26, 2026
1 check passed
@vernonstinebaker vernonstinebaker deleted the chore/swift6-xcode26-fixes branch March 27, 2026 01:00
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