Skip to content

Add hybrid chat routing with standard leaf diagnostics - #631

Draft
mattleibow wants to merge 10 commits into
mainfrom
mattleibow-hybrid-leaf-diagnostics
Draft

mattleibow wants to merge 10 commits into
mainfrom
mattleibow-hybrid-leaf-diagnostics

Conversation

@mattleibow

@mattleibow mattleibow commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds Hybrid (local + cloud) to ChatPlayground. A short Apple Intelligence classifier returns local or cloud. MEAI's RoutingChatClient selects the shared Apple/Azure pipeline, with OrderedFailoverChatClient providing cloud-to-local recovery. Tools, recordings and the Logs sidebar use the existing pipelines.

Cloud receives the original conversation and options automatically, without redaction or per-turn approval. Do not use Hybrid for data that must stay on-device. Classification considers only the last user message and is best-effort. Classifier errors propagate; streaming failures do not recover after output begins.

All three MEAI packages now use one central 10.11.0 version, replacing project-specific overrides. OpenAI and required runtime dependencies are updated through the existing feeds. Tests retain focused routing, forwarding, failover, diagnostics and recording coverage, plus a shared 42-case real-model classifier suite.

Validation

  • AI host suites and all 42 Apple routing cases passed.
  • Mac Catalyst 27 sample and Android device-test builds passed.
  • Broader DevFlow suite: 1,211 passed; 16 failures reproduce with identical names and messages using the previous package versions. These concern path handling, culture and loopback binding.

@mattleibow
mattleibow added this pull request to stack #632 October 6, 2026 18:50
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

✅ Expert Code Review: 2 independent reviewers found no issues. Methodology: 2-model adversarial consensus. (1 reviewer failed to complete — reduced coverage, no tiebreaker)

Generated by Expert Code Review (auto) for #631 · copilot · gpt56 · 262.7 AIC · ⌖ 12.2 AIC · ⊞ 37.6K · ◷

@mattleibow
mattleibow force-pushed the mattleibow-hybrid-leaf-diagnostics branch from ca8305a to 38a4223 Compare October 6, 2026 19:03
@mattleibow
mattleibow force-pushed the mattleibow-hybrid-leaf-diagnostics branch 2 times, most recently from 0770751 to dda886f Compare October 6, 2026 19:37
@mattleibow
mattleibow force-pushed the mattleibow-hybrid-leaf-diagnostics branch from c4be118 to 3a6496e Compare October 6, 2026 19:50
@mattleibow
mattleibow force-pushed the mattleibow-hybrid-leaf-diagnostics branch from 65327f8 to cb7d52e Compare October 6, 2026 20:41
@mattleibow
mattleibow force-pushed the mattleibow-hybrid-leaf-diagnostics branch from cb7d52e to ad4c0e8 Compare October 6, 2026 20:58
@mattleibow
mattleibow force-pushed the mattleibow-hybrid-leaf-diagnostics branch 3 times, most recently from c873189 to ef8399f Compare October 7, 2026 08:36
@mattleibow
mattleibow removed this pull request from stack #632 October 7, 2026 08:37
@mattleibow
mattleibow changed the base branch from mattleibow-chat-logging-sidebar to mattleibow-apple-foundation-models-image-input October 7, 2026 08:38
@mattleibow
mattleibow added this pull request to stack #635 October 7, 2026 08:39
@mattleibow
mattleibow force-pushed the mattleibow-hybrid-leaf-diagnostics branch from ef8399f to c0de37d Compare October 7, 2026 08:54
@mattleibow
mattleibow removed this pull request from stack #635 October 7, 2026 08:57
@mattleibow
mattleibow changed the base branch from mattleibow-apple-foundation-models-image-input to mattleibow-plan-apple-ai-metrics October 7, 2026 08:58
@mattleibow
mattleibow added this pull request to stack #636 October 7, 2026 08:59
@jfversluis
jfversluis force-pushed the mattleibow-hybrid-leaf-diagnostics branch from c0de37d to 42a8937 Compare October 7, 2026 13:38
@mattleibow
mattleibow marked this pull request as draft October 7, 2026 13:43
@mattleibow
mattleibow force-pushed the mattleibow-hybrid-leaf-diagnostics branch 2 times, most recently from 287ee65 to ef69e6d Compare October 7, 2026 17:02
@jfversluis
jfversluis force-pushed the mattleibow-hybrid-leaf-diagnostics branch 2 times, most recently from 46e5d47 to 0418f32 Compare October 7, 2026 20:59
Base automatically changed from mattleibow-plan-apple-ai-metrics to main October 9, 2026 13:21
@mattleibow
mattleibow force-pushed the mattleibow-hybrid-leaf-diagnostics branch 2 times, most recently from 276f501 to 9a2f650 Compare October 16, 2026 00:33
mattleibow and others added 10 commits October 16, 2026 19:28
Integrate only hybrid source e4e08ab on logging tip 2041d69. Preserve routing/failover policy and scoped dependencies, remove the custom fallback warning, and instrument owned leaves and outer pipeline with built-in logging and privacy-disabled telemetry.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4461f2b8-6920-4602-a59e-599a8c6368e6
Copilot-CLI-Session: 91d4b2dd-12bc-4dbe-9b10-b58e13055853
Restore AddChatFeature(aiSettings) ownership of Apple, Hybrid, Azure and Replay registration and availability checks. MauiProgram remains the feature composition entry point; client factories stay private to ChatServiceCollectionExtensions. Update sample documentation without changing routing or diagnostics.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4461f2b8-6920-4602-a59e-599a8c6368e6
Copilot-CLI-Session: 91d4b2dd-12bc-4dbe-9b10-b58e13055853
Remove summary generation, payload selection and the IsHybrid settings flag. Preserve standard routing, fallback and diagnostics with independently snapshotted original text and ordinary generation options.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4461f2b8-6920-4602-a59e-599a8c6368e6
Copilot-CLI-Session: 91d4b2dd-12bc-4dbe-9b10-b58e13055853
Follow SemanticRoutingChatClient's per-request last-user-message selection pattern. Remove bound leaf wrappers and classifier input DTOs, keeping full original text and ordinary options for answers and built-in transient failover/diagnostics.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4461f2b8-6920-4602-a59e-599a8c6368e6
Copilot-CLI-Session: 91d4b2dd-12bc-4dbe-9b10-b58e13055853
Clone options at each leaf with ConfigureOptionsChatClient and copy mutable stop sequences so a failed cloud attempt cannot alter local recovery. Cover response and streaming cloud mutations while preserving caller state and the simplified router.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4461f2b8-6920-4602-a59e-599a8c6368e6
Copilot-CLI-Session: 91d4b2dd-12bc-4dbe-9b10-b58e13055853
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replace structured route/reason generation with a plain local/cloud classifier. Reuse the production classifier in focused model-backed device cases and trim redundant SDK-contract host coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Extract the platform-independent generic test base and keep Apple as a thin subclass. Expand the corpus to 42 cases; retain the observed greeting-in-a-poem misroute as a failing RequiresModel regression without changing the production prompt.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use the user-approved local expectation for the greeting-in-verse case and document that tolerance without changing the classifier prompt.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@mattleibow
mattleibow force-pushed the mattleibow-hybrid-leaf-diagnostics branch from 2eb0942 to a723334 Compare October 16, 2026 17:28

This branch has not been deployed

No deployments
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