Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(inference): answer the #6120 review threads

M3gA-Mindf0bdf2459a94
diff --git a/app/src/services/api/aiSettingsApi.ts b/app/src/services/api/aiSettingsApi.ts
index d85f9bc186..e9dabffcd2 100644
--- a/app/src/services/api/aiSettingsApi.ts
+++ b/app/src/services/api/aiSettingsApi.ts
@@ -314,9 +314,11 @@ export async function loadAISettings(): Promise<AISettings> {
};
// Diagnostic: detect partial BYOK routing — some workloads have a BYOK cloud
- // provider configured while others are left at default/openhuman. The Rust
- // factory inherits the BYOK provider for unset workloads, but this log makes
- // it easy to trace the config state from the frontend side.
+ // provider configured while others are left at default/openhuman. Each route
+ // is independent (#6109): an unset workload stays on the managed backend and
+ // does NOT pick up a sibling's BYOK provider. This log makes the split state
+ // easy to trace from the frontend side, which is the common source of "why is
+ // this workload not using my key?".
const byokProvider = (['chat', 'reasoning', 'agentic', 'coding'] as const).find(w => {
const ref_ = routing[w];
return ref_.kind === 'cloud';
@@ -329,7 +331,9 @@ export async function loadAISettings(): Promise<AISettings> {
const byokSlug = (routing[byokProvider] as { kind: 'cloud'; providerSlug: string })
.providerSlug;
console.debug(
- '[ai-settings] partial BYOK routing detected — unset workloads will inherit from: ' + byokSlug
+ '[ai-settings] partial BYOK routing detected — ' +
+ byokSlug +
+ ' is configured for one workload; the unset chat-tier workloads stay on the managed backend'
);
}
diff --git a/src/openhuman/inference/provider/factory_part_01.rs b/src/openhuman/inference/provider/factory_part_01.rs
index 5b5b831fcb..d47b69da54 100644
--- a/src/openhuman/inference/provider/factory_part_01.rs
+++ b/src/openhuman/inference/provider/factory_part_01.rs
@@ -329,7 +329,12 @@ pub(crate) fn role_uses_implicit_cloud_fallback(role: &str, config: &Config) ->
///
/// Empty / `"cloud"` resolves to `primary_cloud`. **Every** role behaves this
/// way: a route that is not set falls through to the managed backend, and no
-/// role inherits another role's provider.
+/// role uses a sibling's BYOK provider as a fallback.
+///
+/// The deliberate *aliases* in [`configured_route_for_role`] are unaffected and
+/// remain: `burst` reads `agentic_provider` and `summarization` reads
+/// `memory_provider`. Those are two names for one configured route, which is a
+/// different thing from an unset route borrowing a set one.
///
/// Until #6109 the three chat-tier roles (`chat`, `reasoning`, `coding`) took a
/// configured BYOK provider from *any* sibling first, so setting one route moved
diff --git a/tests/raw_coverage/inference_provider_auth_e2e.rs b/tests/raw_coverage/inference_provider_auth_e2e.rs
index c8983d929b..6162f3f982 100644
--- a/tests/raw_coverage/inference_provider_auth_e2e.rs
+++ b/tests/raw_coverage/inference_provider_auth_e2e.rs
@@ -419,15 +419,21 @@ async fn inference_resolve_model_maps_hints_and_tiers_to_the_routed_model() {
);
}
- // The part that is easy to get wrong, and the reason this is two phases:
- // `provider_for_role` lets the **three chat-tier roles** (chat, reasoning,
- // coding) inherit any configured BYOK route via
- // `resolve_byok_fallback_provider_string`. So pinning *only* `coding` also
- // moves chat and reasoning off the managed backend. Asserting it here means
- // a change to that scoping is a test failure rather than a silent re-route
- // of the user's conversations.
- for (id, hint) in [(71_013, "hint:reasoning"), (71_014, "hint:chat")] {
- let inherited = harness
+ // The part that is easy to get wrong, and the reason this is two phases.
+ //
+ // This block used to assert the opposite: `provider_for_role` let the three
+ // chat-tier roles inherit any configured BYOK route from a sibling, so
+ // pinning *only* `coding` also moved chat and reasoning off the managed
+ // backend — the user's ordinary conversations silently billed to their own
+ // key, with no setting saying so. #6109 removed that inheritance; each route
+ // now stands alone. The assertion is inverted rather than deleted, because
+ // "setting one route does not move the others" is precisely the property
+ // that needs a guard.
+ for (id, hint, tier) in [
+ (71_013, "hint:reasoning", "reasoning-v1"),
+ (71_014, "hint:chat", "chat-v1"),
+ ] {
+ let sibling = harness
.rpc(
id,
"openhuman.inference_resolve_model",
@@ -435,16 +441,16 @@ async fn inference_resolve_model_maps_hints_and_tiers_to_the_routed_model() {
)
.await;
assert_eq!(
- payload(&inherited, hint).get("model"),
- Some(&json!("zai/glm-4.7")),
- "{hint} inherits the BYOK route configured for a sibling chat-tier \
- role — setting one of chat/reasoning/coding moves all three"
+ payload(&sibling, hint).get("model"),
+ Some(&json!(tier)),
+ "{hint} was never configured, so it must stay on the managed backend \
+ rather than inherit the BYOK route pinned for `coding` (#6109)"
);
}
- // …and the inheritance stops there. Agentic, burst, vision and the
- // background workloads stay on the managed backend, because they run
- // tier-specific models a BYOK provider does not serve.
+ // Agentic, burst, vision and the background workloads stay on the managed
+ // backend for the same reason, and always did — they run tier-specific
+ // models a BYOK provider does not serve.
for (id, hint, tier) in [
(71_015, "hint:agentic", "agentic-v1"),
(71_016, "hint:burst", "burst-v1"),