Clarify cloud requirements error messages (#19078)

## Why
The current cloud-requirements failures say `workspace-managed config`,
which is ambiguous and can read like it refers to local managed config
such as `managed_config.toml`.

This code path only applies to cloud requirements, so the user-facing
message should name that source directly.

## What changed
- Updated the load failure in
[`codex-rs/cloud-requirements/src/lib.rs`](https://github.com/openai/codex/blob/46e704d1f93054daa9a3b5a9100333c540c81d50/codex-rs/cloud-requirements/src/lib.rs)
to say `failed to load cloud requirements (workspace-managed policies)`.
- Updated the parse failure in the same file to use the same `cloud
requirements (workspace-managed policies)` terminology.
- Kept `workspace-managed` hyphenated because it is used as a compound
modifier.
- Updated the matching assertion in
[`codex-rs/app-server/src/codex_message_processor.rs`](https://github.com/openai/codex/blob/46e704d1f93054daa9a3b5a9100333c540c81d50/codex-rs/app-server/src/codex_message_processor.rs).
- Reused `CLOUD_REQUIREMENTS_LOAD_FAILED_MESSAGE` in the
`codex-cloud-requirements` test where the test is asserting that
crate-local contract directly.

## Testing
`cargo test -p codex-cloud-requirements`
This commit is contained in:
Gav Verma authored and GitHub committed 2026-04-22 23:07:08 -07:00
1 parent 951be1a8a1
commit 2ef2d675d6
2 files changed
+13 -9

No files matched your search

@@ -10513,7 +10513,7 @@ mod tests {
let err = std::io::Error::other(CloudRequirementsLoadError::new( let err = std::io::Error::other(CloudRequirementsLoadError::new(
CloudRequirementsLoadErrorCode::RequestFailed, CloudRequirementsLoadErrorCode::RequestFailed,
/*status_code*/ None, /*status_code*/ None,
"failed to load your workspace-managed config", "Failed to load cloud requirements (workspace-managed policies).",
)); ));
let error = config_load_error(&err); let error = config_load_error(&err);
@@ -10523,7 +10523,7 @@ mod tests {
Some(json!({ Some(json!({
"reason": "cloudRequirements", "reason": "cloudRequirements",
"errorCode": "RequestFailed", "errorCode": "RequestFailed",
"detail": "failed to load your workspace-managed config", "detail": "Failed to load cloud requirements (workspace-managed policies).",
})) }))
); );
} }
+11 -7
View File
@@ -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_ATTEMPT_METRIC: &str = "codex.cloud_requirements.fetch_attempt";
const CLOUD_REQUIREMENTS_FETCH_FINAL_METRIC: &str = "codex.cloud_requirements.fetch_final"; 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_METRIC: &str = "codex.cloud_requirements.load";
const CLOUD_REQUIREMENTS_LOAD_FAILED_MESSAGE: &str = "failed to load your workspace-managed config"; const CLOUD_REQUIREMENTS_LOAD_FAILED_MESSAGE: &str =
const CLOUD_REQUIREMENTS_PARSE_FAILED_MESSAGE: &str = "Your workspace-managed config is invalid and could not be parsed. Please contact your workspace admin."; "Failed to load cloud requirements (workspace-managed policies).";
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_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] = const CLOUD_REQUIREMENTS_CACHE_WRITE_HMAC_KEY: &[u8] =
b"codex-cloud-requirements-cache-v3-064f8542-75b4-494c-a294-97d3ce597271"; b"codex-cloud-requirements-cache-v3-064f8542-75b4-494c-a294-97d3ce597271";
const CLOUD_REQUIREMENTS_CACHE_READ_HMAC_KEYS: &[&[u8]] = const CLOUD_REQUIREMENTS_CACHE_READ_HMAC_KEYS: &[&[u8]] =
@@ -2097,10 +2104,7 @@ enabled = false
.await .await
.expect("cloud requirements task") .expect("cloud requirements task")
.expect_err("cloud requirements retry exhaustion should fail closed"); .expect_err("cloud requirements retry exhaustion should fail closed");
assert_eq!( assert_eq!(err.to_string(), CLOUD_REQUIREMENTS_LOAD_FAILED_MESSAGE);
err.to_string(),
"failed to load your workspace-managed config"
);
assert_eq!(err.code(), CloudRequirementsLoadErrorCode::RequestFailed); assert_eq!(err.code(), CloudRequirementsLoadErrorCode::RequestFailed);
assert_eq!( assert_eq!(
fetcher.request_count.load(Ordering::SeqCst), fetcher.request_count.load(Ordering::SeqCst),