[codex] Surface runtime warnings in codex exec (#27415)

## Why

`codex exec` drops thread-scoped warning notifications. Warnings
discovered while a thread starts, including unreadable or invalid UTF-8
project `AGENTS.md` files, therefore become silent.

## What changed

- Process global and primary-thread warning notifications while
continuing to ignore warnings from unrelated threads.
- Render runtime warnings in human output and expose them through the
existing non-fatal error item in JSONL output.
- Add focused routing, rendering, and malformed project-instruction
coverage.
This commit is contained in:
Adam Perry @ OpenAI
2026-06-11 14:01:16 -04:00
committed by GitHub
parent cc97839068
commit 7fbbc9f033
6 changed files with 137 additions and 0 deletions
+29
View File
@@ -267,6 +267,35 @@ fn lagged_event_warning_message_is_explicit() {
);
}
#[test]
fn runtime_warnings_are_filtered_to_the_primary_thread() {
let primary_thread_id = "thread-1";
let turn_id = "turn-1";
let outcomes = [
codex_app_server_protocol::WarningNotification {
thread_id: None,
message: "global warning".to_string(),
},
codex_app_server_protocol::WarningNotification {
thread_id: Some(primary_thread_id.to_string()),
message: "primary warning".to_string(),
},
codex_app_server_protocol::WarningNotification {
thread_id: Some("thread-2".to_string()),
message: "other warning".to_string(),
},
]
.map(|warning| {
should_process_notification(
&ServerNotification::Warning(warning),
primary_thread_id,
turn_id,
)
});
assert_eq!(outcomes, [true, true, false]);
}
#[tokio::test]
async fn resume_lookup_model_providers_filters_only_last_lookup() {
let codex_home = tempdir().expect("create temp codex home");