From 30b472cc96b4ce7b83065f06e903cfc06539c821 Mon Sep 17 00:00:00 2001 From: cong Date: Wed, 5 Aug 2026 13:14:30 +0800 Subject: [PATCH 1/2] fix: detect codex model capacity errors as blocked --- src/detect/manifest/tests.rs | 32 ++++++++++++++++++++++++++++++ src/detect/manifests/codex.toml | 12 +++++++++-- website/agent-detection/codex.toml | 12 +++++++++-- 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/src/detect/manifest/tests.rs b/src/detect/manifest/tests.rs index 11c92f49d3..daddd23b4a 100644 --- a/src/detect/manifest/tests.rs +++ b/src/detect/manifest/tests.rs @@ -733,6 +733,38 @@ fn codex_osc_title_plain_is_idle() { assert!(result.visible_idle); } +#[test] +fn codex_model_capacity_error_is_blocked() { + let screen = "⚠ Selected model is at capacity. Please try a different model.\n\n\ + › Summarize recent commits\n\n\ + gpt-5.6-sol high · /work · Ready\n"; + let result = osc_explain(Agent::Codex, screen, "project", ""); + + assert_eq!(result.state, AgentState::Blocked); + assert_eq!( + result.matched_rule.as_ref().map(|r| r.id.as_str()), + Some("model_capacity_blocked") + ); + assert!(result.visible_blocker); +} + +#[test] +fn codex_stale_model_capacity_error_remains_idle() { + let screen = "⚠ Selected model is at capacity. Please try a different model.\n\n\ + • Explored\n\ + └ Read Cargo.toml\n\n\ + › Summarize recent commits\n\n\ + gpt-5.6-sol high · /work · Ready\n"; + let result = osc_explain(Agent::Codex, screen, "project", ""); + + assert_eq!(result.state, AgentState::Idle); + assert_eq!( + result.matched_rule.as_ref().map(|r| r.id.as_str()), + Some("osc_title_idle") + ); + assert!(result.visible_idle); +} + #[test] fn codex_background_terminal_screen_does_not_override_osc_idle() { // Background terminal tasks can be long-lived helpers such as dev servers. diff --git a/src/detect/manifests/codex.toml b/src/detect/manifests/codex.toml index a4a4ca9fa2..45481d4ed6 100644 --- a/src/detect/manifests/codex.toml +++ b/src/detect/manifests/codex.toml @@ -1,7 +1,7 @@ id = "codex" -version = "2026.07.18.1" +version = "2026.08.05.1" min_engine_version = 2 -updated_at = "2026-07-18T00:00:00Z" +updated_at = "2026-08-05T00:00:00Z" [[rules]] id = "osc_title_blocked" @@ -11,6 +11,14 @@ region = "osc_title" visible_blocker = true contains = ["Action Required"] +[[rules]] +id = "model_capacity_blocked" +state = "blocked" +priority = 1090 +region = "bottom_non_empty_lines(3)" +visible_blocker = true +contains = ["Selected model is at capacity. Please try a different model."] + [[rules]] id = "osc_title_working" state = "working" diff --git a/website/agent-detection/codex.toml b/website/agent-detection/codex.toml index a4a4ca9fa2..45481d4ed6 100644 --- a/website/agent-detection/codex.toml +++ b/website/agent-detection/codex.toml @@ -1,7 +1,7 @@ id = "codex" -version = "2026.07.18.1" +version = "2026.08.05.1" min_engine_version = 2 -updated_at = "2026-07-18T00:00:00Z" +updated_at = "2026-08-05T00:00:00Z" [[rules]] id = "osc_title_blocked" @@ -11,6 +11,14 @@ region = "osc_title" visible_blocker = true contains = ["Action Required"] +[[rules]] +id = "model_capacity_blocked" +state = "blocked" +priority = 1090 +region = "bottom_non_empty_lines(3)" +visible_blocker = true +contains = ["Selected model is at capacity. Please try a different model."] + [[rules]] id = "osc_title_working" state = "working" From 53b1c389a8ea1b3e21179ecffc5d0b000e5e3c36 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Wed, 5 Aug 2026 17:33:15 +0300 Subject: [PATCH 2/2] fix: harden codex capacity detection --- src/detect/manifest/tests.rs | 22 ++++++++++++++++++++-- src/detect/manifests/codex.toml | 6 +++--- website/agent-detection/codex.toml | 6 +++--- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/detect/manifest/tests.rs b/src/detect/manifest/tests.rs index daddd23b4a..56b809354d 100644 --- a/src/detect/manifest/tests.rs +++ b/src/detect/manifest/tests.rs @@ -734,8 +734,9 @@ fn codex_osc_title_plain_is_idle() { } #[test] -fn codex_model_capacity_error_is_blocked() { - let screen = "⚠ Selected model is at capacity. Please try a different model.\n\n\ +fn codex_wrapped_model_capacity_error_is_blocked() { + let screen = "⚠ Selected model is at capacity. Please\n\ + \x20\x20try a different model.\n\n\ › Summarize recent commits\n\n\ gpt-5.6-sol high · /work · Ready\n"; let result = osc_explain(Agent::Codex, screen, "project", ""); @@ -748,6 +749,23 @@ fn codex_model_capacity_error_is_blocked() { assert!(result.visible_blocker); } +#[test] +fn codex_active_spinner_beats_stale_model_capacity_error() { + let screen = "⚠ Selected model is at capacity. Please\n\ + \x20\x20try a different model.\n\n\ + › Summarize recent commits\n\n\ + gpt-5.6-sol high · /work · Working\n"; + let result = osc_explain(Agent::Codex, screen, "⠋ project", ""); + + assert_eq!(result.state, AgentState::Working); + assert_eq!( + result.matched_rule.as_ref().map(|r| r.id.as_str()), + Some("osc_title_working") + ); + assert!(result.visible_working); + assert!(!result.visible_blocker); +} + #[test] fn codex_stale_model_capacity_error_remains_idle() { let screen = "⚠ Selected model is at capacity. Please try a different model.\n\n\ diff --git a/src/detect/manifests/codex.toml b/src/detect/manifests/codex.toml index 45481d4ed6..d3b727eaef 100644 --- a/src/detect/manifests/codex.toml +++ b/src/detect/manifests/codex.toml @@ -14,10 +14,10 @@ contains = ["Action Required"] [[rules]] id = "model_capacity_blocked" state = "blocked" -priority = 1090 -region = "bottom_non_empty_lines(3)" +priority = 490 +region = "bottom_non_empty_lines(4)" visible_blocker = true -contains = ["Selected model is at capacity. Please try a different model."] +regex = ['(?m)^⚠ Selected\s+model\s+is\s+at\s+capacity\.\s+Please\s+try\s+a\s+different\s+model\.$'] [[rules]] id = "osc_title_working" diff --git a/website/agent-detection/codex.toml b/website/agent-detection/codex.toml index 45481d4ed6..d3b727eaef 100644 --- a/website/agent-detection/codex.toml +++ b/website/agent-detection/codex.toml @@ -14,10 +14,10 @@ contains = ["Action Required"] [[rules]] id = "model_capacity_blocked" state = "blocked" -priority = 1090 -region = "bottom_non_empty_lines(3)" +priority = 490 +region = "bottom_non_empty_lines(4)" visible_blocker = true -contains = ["Selected model is at capacity. Please try a different model."] +regex = ['(?m)^⚠ Selected\s+model\s+is\s+at\s+capacity\.\s+Please\s+try\s+a\s+different\s+model\.$'] [[rules]] id = "osc_title_working"