Repository navigation
Description
Summary
Unify the LLM policy source of truth between the Python backend and the desktop Rust backend. Today desktop/macos/Backend-Rust/src/llm/model_qos.rs (12.6K) is a hand-maintained second implementation of the MODEL_QOS profiles that backend/utils/llm/model_config.py also implements, and the Rust lane carries its own BYOK (byok.rs, 23.7K), Vertex routing (vertex.rs), and provider-fallback policy next to a ~100K routes/chat_completions.rs + ~82K routes/proxy.rs serving lane. Nothing shares a source of truth, so policy drift between lanes is only caught by human review — 75 commits in Backend-Rust since 2026-05-15 means the drift surface is live.
This is the follow-up implementation to an exit criterion in #9517: that issue gates the gateway migration's "done" on the ownership decision being made; this issue tracks making the decision and doing the work.
Current state (verified in tree)
LLM provider/model/BYOK policy currently lives in four places:
backend/utils/llm/— Python selection policy (model_config.py: MODEL_QOS profiles, pinned features, provider-only feature sets) + client construction (being retired per chore(backend): define enforced exit criteria for the LLM gateway feature-mode migration (retire direct provider selection in utils/llm) #9517).backend/llm_gateway/— the migration-target serving plane.desktop/macos/Backend-Rust/src/—llm/model_qos.rs,byok.rs,vertex.rs,fallback.rs,routes/chat_completions.rs,routes/proxy.rs.- Desktop bridge/harness modes — being converged into
SessionExecutionProfileby refactor(macOS): converge chat, PTT, agents, tools, and continuity onto single owners #9515 domain 6.
Decision required (pick one, record it here)
- (a) Gateway as the single serving/policy plane for desktop too. The Rust backend proxies LLM traffic to
llm-gateway;model_qos.rsand duplicated BYOK/provider policy are deleted. Rust keeps only transport/auth/paywall concerns it genuinely owns. - (b) Rust lane as a declared bounded owner for desktop. The policy artifact is shared, not duplicated: QoS profiles / pinned features / provider constraints generated from one canonical source (checked-in manifest) consumed by both
model_config.pyandmodel_qos.rs, with a CI drift check that fails when either side diverges from the manifest.
Evaluation inputs for the decision: desktop latency budget for an extra gateway hop, BYOK key locality (keys that must not transit the gateway), offline/local-model paths, and paywall/rate-limit coupling in routes/rate_limit.rs.
Definition of done
- Decision (a) or (b) recorded in this issue with the evaluation inputs above.
- Zero hand-maintained duplicate policy tables:
model_qos.rsvsmodel_config.pydrift is mechanically impossible (deleted, or generated + CI drift check) — not just reviewed for. - BYOK/credential-scope policy has one authoritative definition; the other lane consumes or proxies it.
- Rust-lane provider fallbacks flow through the existing
fallback::record_fallbackfixed-field contract (present infallback.rs; verify byok/vertex branch coverage). - AGENTS.md service map +
docs/doc/developer/describe the final ownership, not the migration. - chore(backend): define enforced exit criteria for the LLM gateway feature-mode migration (retire direct provider selection in utils/llm) #9517's Rust-lane exit criterion checked off, referencing this issue's outcome.
Non-goals
- Retiring the Rust backend or moving its non-LLM concerns (auth, updates, webhooks, screen activity).
- Realtime voice transport provider selection (desktop-owned; see refactor(macOS): converge chat, PTT, agents, tools, and continuity onto single owners #9515).
- The Python-side resolver consolidation itself (that's chore(backend): define enforced exit criteria for the LLM gateway feature-mode migration (retire direct provider selection in utils/llm) #9517's core scope).
Related
- chore(backend): define enforced exit criteria for the LLM gateway feature-mode migration (retire direct provider selection in utils/llm) #9517 — gateway migration exit criteria (parent; holds the gate, this holds the work).
- refactor(macOS): converge chat, PTT, agents, tools, and continuity onto single owners #9515 — macOS convergence, domain 6
SessionExecutionProfile(the desktop consumer of whatever profile schema wins). - refactor(backend): converge conversation lifecycle onto a single mutation owner #9516–audit(macOS): ProactiveAssistants plural-authority audit (gated on memory V3 Gate 3) #9520, park(macOS): no-increase ratchet for direct APIClient call sites (~102 Source files) #9527 — the broader complexity-collapse initiative.
Activity
Git-on-my-level commentedon Jul 12, 2026
Consolidated into #9517 — the Rust-lane decision, evaluation inputs, and exit criteria now live in that issue's "Desktop Backend-Rust lane" section. Closing to keep one tracker.