You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add Foundation Models 27 dynamic profile composition APIs - #314
Composition retains the installed Foundation Models 27 callback isolation annotations.
historyTransform and its stored closure accept ordinary escaping functions/captures, not @sendable. Package/SDK compilation and the non-Sendable runtime capture regression are retained.
Normal history-preserving merges synchronize upstream main 7d43219, including #357 per-request usage accounting, #341 Ollama reasoning, #358 host-scoped Chat Completions reasoning, #300 response-start timeouts, #362 cancellation collection, #364 partial structured snapshots and #366/#367 bounds/reasoning/system-Tool fixes. Earlier #336 final-request usage, #340 HTTPTransport, #297/#325/#331/#343/#352/#354/#356 remain intact. No force-push, new checkout, replacement PR or extra fallback.
Only the updated #313 composition dependency is merged. No runtime, provider loop or constructor behavior moves into this layer; historyTransform remains non-@sendable.
Fresh local verification (2026-10-23)
Head 5359f3d. CI=1 GIT_CONFIG_GLOBAL=/dev/null swift test: 913 tests / 98 suites passed. The separate upstream macro test target also passed 2 tests / 1 suite. Strict formatting/diff checks passed. These are compile/offline tests, not live API, model-weight or Apple Intelligence inference acceptance.
Two streams created back-to-back can append both prompts before their asynchronous profile resolutions run. Both snapshots then end with the second prompt, so this lookup dispatches onPrompt for that prompt and skips the first request's prompt. Pass the actual request prompt into lifecycle preparation instead of inferring it from shared history, and deduplicate prompt dispatch per request across continuations.
Profile sessions now enter SystemLanguageModel's dynamic-instructions branch, but makeFoundationModelsSession builds its history from session.transcript (SystemLanguageModel.swift:404–412), not the resolved request projection. Thus a profile's historyTransform is ignored even on the initial system-model request, resending entries the transform removed. Build native history from the resolved RequestContext.transcript, filtering its instructions and duplicate current prompt without changing durable history.
The additional prompt-dispatch and native-history findings are also addressed in 9b76d74. Lifecycle preparation receives the actual request prompt and shares a per-request dispatch state across continuations, including concurrent streams. Native Foundation Models session construction now uses the resolved request projection. Regression coverage includes history mutation removing the current prompt, concurrent prompt callbacks, and native projected history without changing durable history. The 34 focused profile/property/options tests pass.
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
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.
Scope
Profile composition only: DynamicProfile, Profile, erasure, conditional builders, modifiers and request-time resolution. No profile session constructor, lifecycle executor, native projection or provider Tool loop.
Depends on #313 and main's #352 (replacement for closed #311). Isolated layer comparison.
Upstream 1.1 synchronization
Normal history-preserving merges synchronize upstream main 7d43219, including #357 per-request usage accounting, #341 Ollama reasoning, #358 host-scoped Chat Completions reasoning, #300 response-start timeouts, #362 cancellation collection, #364 partial structured snapshots and #366/#367 bounds/reasoning/system-Tool fixes. Earlier #336 final-request usage, #340 HTTPTransport, #297/#325/#331/#343/#352/#354/#356 remain intact. No force-push, new checkout, replacement PR or extra fallback.
Only the updated #313 composition dependency is merged. No runtime, provider loop or constructor behavior moves into this layer; historyTransform remains non-@sendable.
Fresh local verification (2026-10-23)
Head 5359f3d.
CI=1 GIT_CONFIG_GLOBAL=/dev/null swift test: 913 tests / 98 suites passed. The separate upstream macro test target also passed 2 tests / 1 suite. Strict formatting/diff checks passed. These are compile/offline tests, not live API, model-weight or Apple Intelligence inference acceptance.