mirror of
https://github.com/openai/codex.git
synced 2026-04-24 22:54:54 +00:00
Turn on cloud requirements for business too (#10283)
Need to check "enterprise" and "business"
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
//! Cloud-hosted config requirements for Codex.
|
//! Cloud-hosted config requirements for Codex.
|
||||||
//!
|
//!
|
||||||
//! This crate fetches `requirements.toml` data from the backend as an alternative to loading it
|
//! This crate fetches `requirements.toml` data from the backend as an alternative to loading it
|
||||||
//! from the local filesystem. It only applies to Enterprise ChatGPT customers.
|
//! from the local filesystem. It only applies to Business (aka Enterprise CBP) or Enterprise ChatGPT
|
||||||
|
//! customers.
|
||||||
//!
|
//!
|
||||||
//! Today, fetching is best-effort: on error or timeout, Codex continues without cloud requirements.
|
//! Today, fetching is best-effort: on error or timeout, Codex continues without cloud requirements.
|
||||||
//! We expect to tighten this so that Enterprise ChatGPT customers must successfully fetch these
|
//! We expect to tighten this so that Enterprise ChatGPT customers must successfully fetch these
|
||||||
@@ -119,7 +120,12 @@ impl CloudRequirementsService {
|
|||||||
|
|
||||||
async fn fetch(&self) -> Option<ConfigRequirementsToml> {
|
async fn fetch(&self) -> Option<ConfigRequirementsToml> {
|
||||||
let auth = self.auth_manager.auth().await?;
|
let auth = self.auth_manager.auth().await?;
|
||||||
if !(auth.is_chatgpt_auth() && auth.account_plan_type() == Some(PlanType::Enterprise)) {
|
if !auth.is_chatgpt_auth()
|
||||||
|
|| !matches!(
|
||||||
|
auth.account_plan_type(),
|
||||||
|
Some(PlanType::Business | PlanType::Enterprise)
|
||||||
|
)
|
||||||
|
{
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,10 +275,9 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn fetch_cloud_requirements_skips_non_enterprise_plan() {
|
async fn fetch_cloud_requirements_skips_non_business_or_enterprise_plan() {
|
||||||
let auth_manager = auth_manager_with_plan("pro");
|
|
||||||
let service = CloudRequirementsService::new(
|
let service = CloudRequirementsService::new(
|
||||||
auth_manager,
|
auth_manager_with_plan("pro"),
|
||||||
Arc::new(StaticFetcher { contents: None }),
|
Arc::new(StaticFetcher { contents: None }),
|
||||||
CLOUD_REQUIREMENTS_TIMEOUT,
|
CLOUD_REQUIREMENTS_TIMEOUT,
|
||||||
);
|
);
|
||||||
@@ -280,6 +285,27 @@ mod tests {
|
|||||||
assert!(result.is_none());
|
assert!(result.is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn fetch_cloud_requirements_allows_business_plan() {
|
||||||
|
let service = CloudRequirementsService::new(
|
||||||
|
auth_manager_with_plan("business"),
|
||||||
|
Arc::new(StaticFetcher {
|
||||||
|
contents: Some("allowed_approval_policies = [\"never\"]".to_string()),
|
||||||
|
}),
|
||||||
|
CLOUD_REQUIREMENTS_TIMEOUT,
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
service.fetch().await,
|
||||||
|
Some(ConfigRequirementsToml {
|
||||||
|
allowed_approval_policies: Some(vec![AskForApproval::Never]),
|
||||||
|
allowed_sandbox_modes: None,
|
||||||
|
mcp_servers: None,
|
||||||
|
rules: None,
|
||||||
|
enforce_residency: None,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn fetch_cloud_requirements_handles_missing_contents() {
|
async fn fetch_cloud_requirements_handles_missing_contents() {
|
||||||
let result = parse_for_fetch(None);
|
let result = parse_for_fetch(None);
|
||||||
|
|||||||
Reference in New Issue
Block a user