Skip to content

Project profile history into native Foundation Models sessions - #349

Open
qoli wants to merge 59 commits into
huggingface:mainfrom
qoli:codex/upstream-profile-native-history
Open

qoli wants to merge 59 commits into
huggingface:mainfrom
qoli:codex/upstream-profile-native-history

Conversation

@qoli

@qoli qoli commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Scope

Native Foundation Models 27 history projection and initial context reuse, separate from #315's shared runtime and remote Tool loops. Depends on #315 cf4ad0d; Isolated layer comparison.

  • Seed profile-backed native history from the resolved projection, not the canonical transcript; remove only the duplicate current prompt.
  • Reuse that already-resolved context for the first native adapter evaluation, including detached evaluation without TaskLocal inheritance. Consume it once so subsequent native evaluations resolve afresh.
  • Leave ordinary dynamic-instructions timing unchanged and preserve the canonical transcript.
  • No new native delegate or Tool loop: upstream Honour the tool execution delegate in SystemLanguageModel #297's delegate/recording path remains authoritative. The profile constructor stays Compatibility SPI.

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.

The native projection/initial-context reuse layer inherits upstream system-Tool request-usage isolation and final-request accounting. It still adds no delegate or Tool loop and leaves ordinary dynamic-instructions timing unchanged.

Fresh local verification (2026-10-23)

Head bbe7085. CI=1 GIT_CONFIG_GLOBAL=/dev/null swift test: 953 tests / 101 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.

Native sessions are constructed offline; tests cover projection/canonical separation and first/subsequent/ordinary evaluation counts. No Apple Intelligence generation acceptance is claimed.

qoli added 30 commits October 9, 2026 16:06
…dynamic-profiles

# Conflicts:
#	Sources/AnyLanguageModel/LanguageModelSession.swift
#	Sources/AnyLanguageModel/SessionProperties.swift
#	Sources/AnyLanguageModelMacros/SessionPropertyEntryMacro.swift
#	Tests/AnyLanguageModelTests/APICompatibilityAnyLanguageModelTests.swift
#	Tests/AnyLanguageModelTests/APICompatibilityFoundationModelsTests.swift
#	Tests/AnyLanguageModelTests/SessionPropertyTests.swift
…dynamic-profiles

# Conflicts:
#	Sources/AnyLanguageModel/SessionProperties.swift
#	Tests/AnyLanguageModelTests/SessionPropertyTests.swift
…dynamic-profiles

# Conflicts:
#	Sources/AnyLanguageModel/LanguageModelSession.swift
…ofile-tool-continuations

# Conflicts:
#	Sources/AnyLanguageModel/DynamicProfile.swift
#	Sources/AnyLanguageModel/LanguageModelSession.swift
qoli added 26 commits October 19, 2026 09:06
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.

1 participant