fix: remove Swift 6 captured-var warnings in Server startup - #185
Merged
Merged
Conversation
Three `var`s were captured by concurrently-executing closures, which is a warning today and an error in the Swift 6 language mode: - Server.swift:1337 `isVision`: made mutable by the VLM→LLM fallback (#173) and read in the /health handler. - Server.swift:1056 / 1368 `mtpAssistantModelRef`: read inside `container.perform` and in the chat-completion route. Each is now captured through a `let` snapshot taken after its last mutation (`loadedAsVision`, `loadedMTPAssistant`, and a local `assistant` for the mainModelRef wiring; DualModelMTP is class-bound via Module, so setting through the `let` still reaches the same object). Clean rebuild on Xcode 27 / Swift 6.4 shows no captured-var warnings. Smoke-tested on a Mac mini M6: Qwen3.6-35B (VLM fallback) /health "vision":false, Qwen3.8-27B "vision":true, Gemma 4 + bf16 MTP assistant "MTP assistant ready (3 tokens/round)", and all three answer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Reviewed (code-review skill, M5 agent): no issues found. Both snapshots are taken after the last write: |
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.
Three startup
vars were captured by concurrently-executing closures. Today that's a warning; in the Swift 6 language mode it's an error:Server.swift:1337isVision/healthServer.swift:1056,:1368mtpAssistantModelRefcontainer.performand in the chat routeEach is now captured through a
letsnapshot taken after its last mutation:loadedAsVision,loadedMTPAssistant, and a localassistantfor themainModelRefwiring.DualModelMTPis class-bound (viaModule), so setting through theletstill reaches the same object. No behaviour change.Verified
unsloth/Qwen3.6-35B-A3B-UD-MLX-4bit(VLM fallback) returns/health"vision":false,Qwen3.8-27B-4bitreturns"vision":true, and Gemma 4 with--mtp --mtp-assistant-model …assistant-bf16printsMTP assistant ready (3 tokens/round). All three answer a request.Independent of #183; the hunks don't overlap.
🤖 Generated with Claude Code