Skip to content

Commit 8ef55c7

Browse files
committed
fix: use resolve_scoped_name for provider lookup in inference set
The provider lookup in upsert_cluster_inference_route used get_message_by_name directly, which fails for per-user providers stored under scoped keys (e.g. 'owner-uuid/claude'). Switch to resolve_scoped_name which tries the scoped key first then falls back to global, matching the pattern used in the provider gRPC service. Signed-off-by: Paolo Dettori <dettori@us.ibm.com>
1 parent 0a01b7b commit 8ef55c7

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

crates/openshell-server/src/inference.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -297,13 +297,19 @@ async fn upsert_cluster_inference_route(
297297
return Err(Status::invalid_argument("model_id is required"));
298298
}
299299

300-
let provider = store
301-
.get_message_by_name::<Provider>(provider_name)
302-
.await
303-
.map_err(|e| Status::internal(format!("fetch provider failed: {e}")))?
304-
.ok_or_else(|| {
305-
Status::failed_precondition(format!("provider '{provider_name}' not found"))
306-
})?;
300+
let provider_record = crate::auth::ownership::resolve_scoped_name(
301+
store,
302+
Provider::object_type(),
303+
provider_name,
304+
principal,
305+
admin_role,
306+
)
307+
.await?
308+
.ok_or_else(|| {
309+
Status::failed_precondition(format!("provider '{provider_name}' not found"))
310+
})?;
311+
let provider = Provider::decode(provider_record.payload.as_slice())
312+
.map_err(|e| Status::internal(format!("decode provider failed: {e}")))?;
307313

308314
let empty = std::collections::HashMap::new();
309315
let provider_labels = provider.metadata.as_ref().map_or(&empty, |m| &m.labels);

0 commit comments

Comments
 (0)