Address requirements review feedback

This commit is contained in:
Abhinav Vedmala
2026-06-15 19:31:51 +00:00
parent 8cf29c8c8e
commit 5e8d468b44
17 changed files with 231 additions and 72 deletions
@@ -6739,13 +6739,37 @@
]
},
"AuthCredentialsStoreMode": {
"enum": [
"file",
"keyring",
"auto",
"ephemeral"
],
"type": "string"
"description": "Determines where Codex stores CLI authentication credentials.",
"oneOf": [
{
"description": "Persist credentials in `CODEX_HOME/auth.json`.",
"enum": [
"file"
],
"type": "string"
},
{
"description": "Persist credentials in the operating system keyring. Fail if unavailable.",
"enum": [
"keyring"
],
"type": "string"
},
{
"description": "Use the operating system keyring when available; otherwise, fall back to `CODEX_HOME/auth.json`.",
"enum": [
"auto"
],
"type": "string"
},
{
"description": "Store credentials in memory only for the current process.",
"enum": [
"ephemeral"
],
"type": "string"
}
]
},
"AuthMode": {
"description": "Authentication mode for OpenAI-backed providers.",
@@ -7644,6 +7668,16 @@
],
"description": "[UNSTABLE] Optional default for where approval requests are routed for review."
},
"cli_auth_credentials_store": {
"anyOf": [
{
"$ref": "#/definitions/v2/AuthCredentialsStoreMode"
},
{
"type": "null"
}
]
},
"compact_prompt": {
"type": [
"string",
@@ -1008,13 +1008,37 @@
]
},
"AuthCredentialsStoreMode": {
"enum": [
"file",
"keyring",
"auto",
"ephemeral"
],
"type": "string"
"description": "Determines where Codex stores CLI authentication credentials.",
"oneOf": [
{
"description": "Persist credentials in `CODEX_HOME/auth.json`.",
"enum": [
"file"
],
"type": "string"
},
{
"description": "Persist credentials in the operating system keyring. Fail if unavailable.",
"enum": [
"keyring"
],
"type": "string"
},
{
"description": "Use the operating system keyring when available; otherwise, fall back to `CODEX_HOME/auth.json`.",
"enum": [
"auto"
],
"type": "string"
},
{
"description": "Store credentials in memory only for the current process.",
"enum": [
"ephemeral"
],
"type": "string"
}
]
},
"AuthMode": {
"description": "Authentication mode for OpenAI-backed providers.",
@@ -3957,6 +3981,16 @@
],
"description": "[UNSTABLE] Optional default for where approval requests are routed for review."
},
"cli_auth_credentials_store": {
"anyOf": [
{
"$ref": "#/definitions/AuthCredentialsStoreMode"
},
{
"type": "null"
}
]
},
"compact_prompt": {
"type": [
"string",
@@ -208,6 +208,39 @@
}
]
},
"AuthCredentialsStoreMode": {
"description": "Determines where Codex stores CLI authentication credentials.",
"oneOf": [
{
"description": "Persist credentials in `CODEX_HOME/auth.json`.",
"enum": [
"file"
],
"type": "string"
},
{
"description": "Persist credentials in the operating system keyring. Fail if unavailable.",
"enum": [
"keyring"
],
"type": "string"
},
{
"description": "Use the operating system keyring when available; otherwise, fall back to `CODEX_HOME/auth.json`.",
"enum": [
"auto"
],
"type": "string"
},
{
"description": "Store credentials in memory only for the current process.",
"enum": [
"ephemeral"
],
"type": "string"
}
]
},
"AutoCompactTokenLimitScope": {
"description": "Selects which part of the active context is charged against `model_auto_compact_token_limit`.",
"oneOf": [
@@ -261,6 +294,16 @@
],
"description": "[UNSTABLE] Optional default for where approval requests are routed for review."
},
"cli_auth_credentials_store": {
"anyOf": [
{
"$ref": "#/definitions/AuthCredentialsStoreMode"
},
{
"type": "null"
}
]
},
"compact_prompt": {
"type": [
"string",
@@ -65,13 +65,37 @@
]
},
"AuthCredentialsStoreMode": {
"enum": [
"file",
"keyring",
"auto",
"ephemeral"
],
"type": "string"
"description": "Determines where Codex stores CLI authentication credentials.",
"oneOf": [
{
"description": "Persist credentials in `CODEX_HOME/auth.json`.",
"enum": [
"file"
],
"type": "string"
},
{
"description": "Persist credentials in the operating system keyring. Fail if unavailable.",
"enum": [
"keyring"
],
"type": "string"
},
{
"description": "Use the operating system keyring when available; otherwise, fall back to `CODEX_HOME/auth.json`.",
"enum": [
"auto"
],
"type": "string"
},
{
"description": "Store credentials in memory only for the current process.",
"enum": [
"ephemeral"
],
"type": "string"
}
]
},
"ComputerUseRequirements": {
"properties": {
@@ -2,4 +2,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
/**
* Determines where Codex stores CLI authentication credentials.
*/
export type AuthCredentialsStoreMode = "file" | "keyring" | "auto" | "ephemeral";
+2 -1
View File
@@ -11,6 +11,7 @@ import type { JsonValue } from "../serde_json/JsonValue";
import type { AnalyticsConfig } from "./AnalyticsConfig";
import type { ApprovalsReviewer } from "./ApprovalsReviewer";
import type { AskForApproval } from "./AskForApproval";
import type { AuthCredentialsStoreMode } from "./AuthCredentialsStoreMode";
import type { ForcedChatgptWorkspaceIds } from "./ForcedChatgptWorkspaceIds";
import type { SandboxMode } from "./SandboxMode";
import type { SandboxWorkspaceWrite } from "./SandboxWorkspaceWrite";
@@ -20,4 +21,4 @@ export type Config = {model: string | null, review_model: string | null, model_c
* [UNSTABLE] Optional default for where approval requests are routed for
* review.
*/
approvals_reviewer: ApprovalsReviewer | null, sandbox_mode: SandboxMode | null, sandbox_workspace_write: SandboxWorkspaceWrite | null, forced_chatgpt_workspace_id: ForcedChatgptWorkspaceIds | null, forced_login_method: ForcedLoginMethod | null, web_search: WebSearchMode | null, tools: ToolsV2 | null, instructions: string | null, developer_instructions: string | null, compact_prompt: string | null, model_reasoning_effort: ReasoningEffort | null, model_reasoning_summary: ReasoningSummary | null, model_verbosity: Verbosity | null, service_tier: string | null, analytics: AnalyticsConfig | null, desktop: { [key in string]?: JsonValue } | null} & ({ [key in string]?: number | string | boolean | Array<JsonValue> | { [key in string]?: JsonValue } | null });
approvals_reviewer: ApprovalsReviewer | null, sandbox_mode: SandboxMode | null, sandbox_workspace_write: SandboxWorkspaceWrite | null, forced_chatgpt_workspace_id: ForcedChatgptWorkspaceIds | null, forced_login_method: ForcedLoginMethod | null, cli_auth_credentials_store: AuthCredentialsStoreMode | null, web_search: WebSearchMode | null, tools: ToolsV2 | null, instructions: string | null, developer_instructions: string | null, compact_prompt: string | null, model_reasoning_effort: ReasoningEffort | null, model_reasoning_summary: ReasoningSummary | null, model_verbosity: Verbosity | null, service_tier: string | null, analytics: AnalyticsConfig | null, desktop: { [key in string]?: JsonValue } | null} & ({ [key in string]?: number | string | boolean | Array<JsonValue> | { [key in string]?: JsonValue } | null });
@@ -4,6 +4,7 @@ use super::SandboxMode;
use super::WindowsSandboxSetupMode;
use super::shared::default_enabled;
use codex_experimental_api_macros::ExperimentalApi;
pub use codex_protocol::config_types::AuthCredentialsStoreMode;
use codex_protocol::config_types::AutoCompactTokenLimitScope;
use codex_protocol::config_types::ForcedLoginMethod;
use codex_protocol::config_types::ReasoningSummary;
@@ -257,6 +258,7 @@ pub struct Config {
pub sandbox_workspace_write: Option<SandboxWorkspaceWrite>,
pub forced_chatgpt_workspace_id: Option<ForcedChatgptWorkspaceIds>,
pub forced_login_method: Option<ForcedLoginMethod>,
pub cli_auth_credentials_store: Option<AuthCredentialsStoreMode>,
pub web_search: Option<WebSearchMode>,
pub tools: Option<ToolsV2>,
pub instructions: Option<String>,
@@ -408,16 +410,6 @@ pub struct ConfigRequirements {
pub windows_sandbox_private_desktop: Option<bool>,
}
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "lowercase")]
#[ts(export_to = "v2/")]
pub enum AuthCredentialsStoreMode {
File,
Keyring,
Auto,
Ephemeral,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
@@ -1634,6 +1634,7 @@ fn config_granular_approval_policy_is_marked_experimental() {
sandbox_workspace_write: None,
forced_chatgpt_workspace_id: None,
forced_login_method: None,
cli_auth_credentials_store: None,
web_search: None,
tools: None,
instructions: None,
@@ -1667,6 +1668,7 @@ fn config_approvals_reviewer_is_marked_experimental() {
sandbox_workspace_write: None,
forced_chatgpt_workspace_id: None,
forced_login_method: None,
cli_auth_credentials_store: None,
web_search: None,
tools: None,
instructions: None,
@@ -7,7 +7,6 @@ use crate::error_code::invalid_request;
use crate::outgoing_message::ConnectionRequestId;
use crate::outgoing_message::OutgoingMessageSender;
use codex_analytics::AnalyticsEventsClient;
use codex_app_server_protocol::AuthCredentialsStoreMode as ApiAuthCredentialsStoreMode;
use codex_app_server_protocol::ClientResponsePayload;
use codex_app_server_protocol::ComputerUseRequirements;
use codex_app_server_protocol::ConfigBatchWriteParams;
@@ -38,7 +37,6 @@ use codex_config::ManagedHooksRequirementsToml;
use codex_config::MatcherGroup as CoreMatcherGroup;
use codex_config::ResidencyRequirement as CoreResidencyRequirement;
use codex_config::SandboxModeRequirement as CoreSandboxModeRequirement;
use codex_config::types::AuthCredentialsStoreMode as CoreAuthCredentialsStoreMode;
use codex_core::ThreadManager;
use codex_features::canonical_feature_for_key;
use codex_features::feature_for_key;
@@ -386,14 +384,7 @@ fn map_requirements_toml_to_api(requirements: ConfigRequirementsToml) -> ConfigR
network: requirements.network.map(map_network_requirements_to_api),
allowed_login_methods: requirements.allowed_login_methods,
allowed_chatgpt_workspaces: requirements.allowed_chatgpt_workspaces,
cli_auth_credentials_store: requirements.cli_auth_credentials_store.map(
|mode| match mode {
CoreAuthCredentialsStoreMode::File => ApiAuthCredentialsStoreMode::File,
CoreAuthCredentialsStoreMode::Keyring => ApiAuthCredentialsStoreMode::Keyring,
CoreAuthCredentialsStoreMode::Auto => ApiAuthCredentialsStoreMode::Auto,
CoreAuthCredentialsStoreMode::Ephemeral => ApiAuthCredentialsStoreMode::Ephemeral,
},
),
cli_auth_credentials_store: requirements.cli_auth_credentials_store,
chatgpt_base_url: requirements.chatgpt_base_url,
sqlite_home: requirements.sqlite_home,
log_dir: requirements.log_dir,
@@ -9,6 +9,7 @@ use codex_app_server_protocol::ApprovalsReviewer;
use codex_app_server_protocol::AppsConfig;
use codex_app_server_protocol::AppsDefaultConfig;
use codex_app_server_protocol::AskForApproval;
use codex_app_server_protocol::AuthCredentialsStoreMode;
use codex_app_server_protocol::ConfigBatchWriteParams;
use codex_app_server_protocol::ConfigEdit;
use codex_app_server_protocol::ConfigLayerSource;
@@ -83,6 +84,7 @@ async fn config_read_returns_effective_and_layers() -> Result<()> {
r#"
model = "gpt-user"
sandbox_mode = "workspace-write"
cli_auth_credentials_store = "keyring"
"#,
)?;
let codex_home_path = codex_home.path().canonicalize()?;
@@ -109,6 +111,10 @@ sandbox_mode = "workspace-write"
} = to_response(resp)?;
assert_eq!(config.model.as_deref(), Some("gpt-user"));
assert_eq!(
config.cli_auth_credentials_store,
Some(AuthCredentialsStoreMode::Keyring)
);
assert_eq!(
origins.get("model").expect("origin").name,
ConfigLayerSource::User {
@@ -5,9 +5,11 @@ use std::collections::BTreeMap;
/// Merges one OTEL requirements layer into an output assembled high-to-low.
///
/// Exporters and scalar settings are exact leaves, while trace metadata is
/// recursively merged by key. Keeping this policy typed prevents exporter
/// variants, credentials, and TLS settings from being combined field by field.
/// `log_user_prompt` and `environment` use the first value supplied by a
/// higher-priority layer. Each exporter is also selected as a complete value:
/// for example, the endpoint from one layer is never combined with the headers
/// or TLS settings from another. Span attributes and tracestate are merged by
/// key instead.
pub(super) fn merge(
output: &mut Option<Sourced<OtelConfigToml>>,
incoming: Option<OtelConfigToml>,
+1 -15
View File
@@ -13,6 +13,7 @@ pub use crate::mcp_types::McpServerTransportConfig;
pub use crate::mcp_types::RawMcpServerConfig;
pub use codex_protocol::config_types::AltScreenMode;
pub use codex_protocol::config_types::ApprovalsReviewer;
pub use codex_protocol::config_types::AuthCredentialsStoreMode;
use codex_protocol::config_types::EnvironmentVariablePattern;
pub use codex_protocol::config_types::ModeKind;
pub use codex_protocol::config_types::Personality;
@@ -83,21 +84,6 @@ impl fmt::Display for SessionPickerViewMode {
}
}
/// Determine where Codex should store CLI auth credentials.
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "lowercase")]
pub enum AuthCredentialsStoreMode {
#[default]
/// Persist credentials in CODEX_HOME/auth.json.
File,
/// Persist credentials in the keyring. Fail if unavailable.
Keyring,
/// Use keyring when available; otherwise, fall back to a file in CODEX_HOME.
Auto,
/// Store credentials in memory only for the current process.
Ephemeral,
}
/// Determine where Codex should store and read MCP credentials.
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "lowercase")]
+5 -5
View File
@@ -281,24 +281,24 @@
]
},
"AuthCredentialsStoreMode": {
"description": "Determine where Codex should store CLI auth credentials.",
"description": "Determines where Codex stores CLI authentication credentials.",
"oneOf": [
{
"description": "Persist credentials in CODEX_HOME/auth.json.",
"description": "Persist credentials in `CODEX_HOME/auth.json`.",
"enum": [
"file"
],
"type": "string"
},
{
"description": "Persist credentials in the keyring. Fail if unavailable.",
"description": "Persist credentials in the operating system keyring. Fail if unavailable.",
"enum": [
"keyring"
],
"type": "string"
},
{
"description": "Use keyring when available; otherwise, fall back to a file in CODEX_HOME.",
"description": "Use the operating system keyring when available; otherwise, fall back to `CODEX_HOME/auth.json`.",
"enum": [
"auto"
],
@@ -5274,4 +5274,4 @@
},
"title": "ConfigToml",
"type": "object"
}
}
+1 -1
View File
@@ -9453,7 +9453,7 @@ sandbox_private_desktop = false
])
);
assert!(config.startup_warnings.iter().any(|warning| {
warning.contains("Configured leaves under `shell_environment_policy` are overridden")
warning.contains("Configured values under `shell_environment_policy` are overridden")
}));
Ok(())
}
+12 -1
View File
@@ -38,6 +38,12 @@ pub(crate) fn resolve_config(
}
}
/// Applies required OTEL settings to user-configured OTEL settings.
///
/// Required settings and complete exporters replace their configured values,
/// while span attributes and tracestate are merged by key. Invalid required
/// trace metadata returns an error; configured conflicts produce startup
/// warnings.
pub(super) fn apply_requirement(
configured: &mut Option<OtelConfigToml>,
requirement: &Sourced<OtelConfigToml>,
@@ -103,7 +109,12 @@ pub(super) fn apply_requirement(
));
}
super::requirements::push_leaf_override_warning("otel", conflict, source, startup_warnings);
super::requirements::push_structured_requirement_override_warning(
"otel",
conflict,
source,
startup_warnings,
);
Ok(())
}
+18 -5
View File
@@ -9,12 +9,23 @@ use codex_protocol::config_types::ForcedLoginMethod;
use super::otel;
/// Runtime values that cannot be applied by mutating [`ConfigToml`] alone.
///
/// Other managed settings are written back into `ConfigToml`. These values need
/// additional credential-store compatibility handling or intersection with the
/// configured authentication restrictions before constructing the final config.
pub(super) struct AppliedConfigRequirements {
pub cli_auth_credentials_store_mode: AuthCredentialsStoreMode,
pub forced_login_method: Option<ForcedLoginMethod>,
pub forced_chatgpt_workspace_id: Option<Vec<String>>,
}
/// Applies managed requirements to regular config before final config construction.
///
/// Managed values replace or merge with their configured counterparts, and
/// conflicts produce source-aware startup warnings. Effective authentication
/// values that need additional resolution are returned separately. Invalid or
/// conflicting requirements return an error.
pub(super) fn apply_to_config(
config: &mut ConfigToml,
requirements: &ConfigRequirements,
@@ -163,7 +174,7 @@ fn apply_shell_environment_policy_requirement(
configured_set.extend(required.clone());
}
push_leaf_override_warning(
push_structured_requirement_override_warning(
"shell_environment_policy",
conflict,
source,
@@ -182,10 +193,12 @@ fn apply_feedback_requirement(
let FeedbackConfigToml { enabled } = value;
let configured = configured.get_or_insert_default();
let conflict = replace_required_leaf(&mut configured.enabled, enabled);
push_leaf_override_warning("feedback", conflict, source, startup_warnings);
push_structured_requirement_override_warning("feedback", conflict, source, startup_warnings);
}
pub(super) fn push_leaf_override_warning(
/// Emits one source-aware warning when a structured requirement replaces one
/// or more configured values.
pub(super) fn push_structured_requirement_override_warning(
field_name: &str,
conflict: bool,
source: &RequirementSource,
@@ -196,10 +209,10 @@ pub(super) fn push_leaf_override_warning(
}
tracing::warn!(
?source,
"configured value contains leaves overridden by exact requirements for {field_name}"
"configured values are overridden by requirements for {field_name}"
);
startup_warnings.push(format!(
"Configured leaves under `{field_name}` are overridden by requirements from {source}."
"Configured values under `{field_name}` are overridden by requirements from {source}."
));
}
+17
View File
@@ -21,6 +21,23 @@ use wildmatch::WildMatchPattern;
use crate::openai_models::ReasoningEffort;
/// Determines where Codex stores CLI authentication credentials.
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema, TS)]
#[serde(rename_all = "lowercase")]
#[ts(export_to = "v2/")]
pub enum AuthCredentialsStoreMode {
/// Persist credentials in `CODEX_HOME/auth.json`.
#[default]
File,
/// Persist credentials in the operating system keyring. Fail if unavailable.
Keyring,
/// Use the operating system keyring when available; otherwise, fall back to
/// `CODEX_HOME/auth.json`.
Auto,
/// Store credentials in memory only for the current process.
Ephemeral,
}
/// Selects which part of the active context is charged against
/// `model_auto_compact_token_limit`.
#[derive(