From b474341c9d19923babbf1e2a9e0fdd4e400f2867 Mon Sep 17 00:00:00 2001 From: xli-oai Date: Fri, 15 May 2026 03:49:19 -0700 Subject: [PATCH] Make skills trim warning test resilient --- codex-rs/app-server/tests/suite/v2/turn_start.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/codex-rs/app-server/tests/suite/v2/turn_start.rs b/codex-rs/app-server/tests/suite/v2/turn_start.rs index 314be8a6ff..c05e1febb5 100644 --- a/codex-rs/app-server/tests/suite/v2/turn_start.rs +++ b/codex-rs/app-server/tests/suite/v2/turn_start.rs @@ -330,10 +330,16 @@ async fn turn_start_emits_thread_scoped_warning_notification_for_trimmed_skills( let warning: WarningNotification = serde_json::from_value(params).expect("deserialize warning notification"); assert_eq!(warning.thread_id.as_deref(), Some(thread.id.as_str())); - assert_eq!( - warning.message, - "Exceeded skills context budget of 2%. All skill descriptions were removed and 7 additional skills were not included in the model-visible skills list." - ); + let warning_prefix = + "Exceeded skills context budget of 2%. All skill descriptions were removed and "; + let warning_suffix = " additional skills were not included in the model-visible skills list."; + let omitted_skill_count = warning + .message + .strip_prefix(warning_prefix) + .and_then(|message| message.strip_suffix(warning_suffix)) + .expect("warning should include omitted skill count") + .parse::()?; + assert!(omitted_skill_count > 0); timeout( DEFAULT_READ_TIMEOUT,