mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Warn about ignored configuration settings (#44691)
## Why Unrecognized settings can be silently ignored, leaving typos or deprecated configuration unnoticed. ## What changed - Collect warnings for unrecognized fields in effective configuration and requirements layers, including unknown feature keys in configuration. - Report sources and field names without configuration values, show up to three entries, and provide migration hints for `network_proxy`, `allowed_permissions`, and `include_view_image_tool`. - Emit project-specific warnings when starting a thread and suppress repeated startup warnings in the app server and TUI. ## Testing Add coverage for merged configuration, disabled layers, startup and project warning delivery, omission of configuration values, and warning deduplication. GitOrigin-RevId: 464cef87882502b19865ae10b50b6f82defb7296
This commit is contained in:
1 parent
9e22e74e8d
commit
e53c444964
11 files changed
+305
-44
No files matched your search
@@ -241,6 +241,9 @@ impl ChatWidget {
|
||||
if self.warning_display_state.startup_complete {
|
||||
self.on_warning(message);
|
||||
} else if self.warning_display_state.should_display(&message) {
|
||||
self.warning_display_state
|
||||
.startup_config_warnings
|
||||
.insert(message.clone());
|
||||
self.add_to_history(history_cell::StartupWarningsCell::new(vec![message]));
|
||||
self.request_redraw();
|
||||
}
|
||||
|
||||
@@ -1008,26 +1008,31 @@ async fn config_warning_during_turn_remains_inline() {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn live_app_server_config_warning_prefixes_summary() {
|
||||
async fn startup_config_warning_is_not_repeated_by_thread() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
let message = "Codex is ignoring 1 unrecognized configuration setting. Check for typos or deprecated settings.";
|
||||
|
||||
chat.handle_server_notification(
|
||||
for notification in [
|
||||
ServerNotification::ConfigWarning(ConfigWarningNotification {
|
||||
summary: "Invalid configuration; using defaults.".to_string(),
|
||||
summary: message.to_string(),
|
||||
details: None,
|
||||
path: None,
|
||||
range: None,
|
||||
}),
|
||||
/*replay_kind*/ None,
|
||||
);
|
||||
ServerNotification::Warning(WarningNotification {
|
||||
thread_id: Some("thread-1".to_string()),
|
||||
message: message.to_string(),
|
||||
}),
|
||||
] {
|
||||
chat.handle_server_notification(notification, /*replay_kind*/ None);
|
||||
}
|
||||
|
||||
let cells = drain_insert_history_transcript(&mut rx);
|
||||
assert_eq!(cells.len(), 1, "expected one warning history cell");
|
||||
let rendered = lines_to_single_string(&cells[0]);
|
||||
assert!(
|
||||
rendered.contains("Invalid configuration; using defaults."),
|
||||
"expected config warning summary, got {rendered}"
|
||||
);
|
||||
assert_eq!(cells.len(), 1);
|
||||
insta::assert_snapshot!(lines_to_single_string(&cells[0]), @"
|
||||
⚠ Codex is ignoring 1 unrecognized configuration setting. Check for typos or
|
||||
deprecated settings.
|
||||
");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
@@ -8,13 +8,16 @@ const FALLBACK_MODEL_METADATA_WARNING_SUFFIX: &str =
|
||||
pub(super) struct WarningDisplayState {
|
||||
/// Completed resume history does not end startup; active work does.
|
||||
pub(super) startup_complete: bool,
|
||||
/// Initialization config warnings may also arrive as ordinary thread warnings.
|
||||
pub(super) startup_config_warnings: HashSet<String>,
|
||||
fallback_model_metadata_slugs: HashSet<String>,
|
||||
}
|
||||
|
||||
impl WarningDisplayState {
|
||||
pub(super) fn should_display(&mut self, message: &str) -> bool {
|
||||
fallback_model_metadata_warning_slug(message)
|
||||
.is_none_or(|slug| self.fallback_model_metadata_slugs.insert(slug.to_string()))
|
||||
!self.startup_config_warnings.contains(message)
|
||||
&& fallback_model_metadata_warning_slug(message)
|
||||
.is_none_or(|slug| self.fallback_model_metadata_slugs.insert(slug.to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user