Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions crates/model-runtime-codex-cli/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ pub(crate) fn classify_error(message: &str) -> ProviderErrorKind {
"context length exceeded",
"context window exceeded",
"context_length_exceeded",
"ran out of room in the model's context window",
"input exceeds the maximum length",
],
) =>
{
Expand Down Expand Up @@ -210,6 +212,20 @@ mod tests {
);
}

#[test]
fn codex_native_context_limit_messages_are_request_too_large() {
assert_eq!(
classify_error(
"Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying."
),
ProviderErrorKind::RequestTooLarge
);
assert_eq!(
classify_error("Input exceeds the maximum length of this model"),
ProviderErrorKind::RequestTooLarge
);
}

#[test]
fn credential_rejection_precedes_refusal_shaped_text() {
assert_eq!(
Expand Down
Loading