Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Clarify cloud requirements error messages (#19078)

Gav Verma2ef2d675d65a
diff --git a/codex-rs/app-server/src/codex_message_processor.rs b/codex-rs/app-server/src/codex_message_processor.rs
index e1ee055757..75a457acbd 100644
--- a/codex-rs/app-server/src/codex_message_processor.rs
+++ b/codex-rs/app-server/src/codex_message_processor.rs
@@ -10513,7 +10513,7 @@ mod tests {
let err = std::io::Error::other(CloudRequirementsLoadError::new(
CloudRequirementsLoadErrorCode::RequestFailed,
/*status_code*/ None,
- "failed to load your workspace-managed config",
+ "Failed to load cloud requirements (workspace-managed policies).",
));
let error = config_load_error(&err);
@@ -10523,7 +10523,7 @@ mod tests {
Some(json!({
"reason": "cloudRequirements",
"errorCode": "RequestFailed",
- "detail": "failed to load your workspace-managed config",
+ "detail": "Failed to load cloud requirements (workspace-managed policies).",
}))
);
}
diff --git a/codex-rs/cloud-requirements/src/lib.rs b/codex-rs/cloud-requirements/src/lib.rs
index aeed90e8b0..ca9ec56fe9 100644
--- a/codex-rs/cloud-requirements/src/lib.rs
+++ b/codex-rs/cloud-requirements/src/lib.rs
@@ -50,9 +50,16 @@ const CLOUD_REQUIREMENTS_CACHE_TTL: Duration = Duration::from_secs(30 * 60);
const CLOUD_REQUIREMENTS_FETCH_ATTEMPT_METRIC: &str = "codex.cloud_requirements.fetch_attempt";
const CLOUD_REQUIREMENTS_FETCH_FINAL_METRIC: &str = "codex.cloud_requirements.fetch_final";
const CLOUD_REQUIREMENTS_LOAD_METRIC: &str = "codex.cloud_requirements.load";
-const CLOUD_REQUIREMENTS_LOAD_FAILED_MESSAGE: &str = "failed to load your workspace-managed config";
-const CLOUD_REQUIREMENTS_PARSE_FAILED_MESSAGE: &str = "Your workspace-managed config is invalid and could not be parsed. Please contact your workspace admin.";
-const CLOUD_REQUIREMENTS_AUTH_RECOVERY_FAILED_MESSAGE: &str = "Your authentication session could not be refreshed automatically. Please log out and sign in again.";
+const CLOUD_REQUIREMENTS_LOAD_FAILED_MESSAGE: &str =
+ "Failed to load cloud requirements (workspace-managed policies).";
+const CLOUD_REQUIREMENTS_PARSE_FAILED_MESSAGE: &str = concat!(
+ "Cloud requirements (workspace-managed policies) are invalid and could not be parsed. ",
+ "Please contact your workspace admin."
+);
+const CLOUD_REQUIREMENTS_AUTH_RECOVERY_FAILED_MESSAGE: &str = concat!(
+ "Your authentication session could not be refreshed automatically. ",
+ "Please log out and sign in again."
+);
const CLOUD_REQUIREMENTS_CACHE_WRITE_HMAC_KEY: &[u8] =
b"codex-cloud-requirements-cache-v3-064f8542-75b4-494c-a294-97d3ce597271";
const CLOUD_REQUIREMENTS_CACHE_READ_HMAC_KEYS: &[&[u8]] =
@@ -2097,10 +2104,7 @@ enabled = false
.await
.expect("cloud requirements task")
.expect_err("cloud requirements retry exhaustion should fail closed");
- assert_eq!(
- err.to_string(),
- "failed to load your workspace-managed config"
- );
+ assert_eq!(err.to_string(), CLOUD_REQUIREMENTS_LOAD_FAILED_MESSAGE);
assert_eq!(err.code(), CloudRequirementsLoadErrorCode::RequestFailed);
assert_eq!(
fetcher.request_count.load(Ordering::SeqCst),