mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Bound model catalog decode errors and classify request timeouts (#45928)
## Why Model catalog decode errors can include the full response body and payload values from deserialization errors. Catalog request deadlines also report a generic timeout instead of a request timeout. ## What changed - Report only the JSON error category, line, column, and response byte count when model catalog decoding fails. - Return `CodexErr::RequestTimeout` when the model catalog refresh deadline expires. ## Testing Add regression tests for invalid response shapes, large payload values, malformed and truncated JSON, and a delayed catalog response that must return `RequestTimeout`. GitOrigin-RevId: 6fe5111a3e3b113d79942b3c213f8e94d773eb5a
This commit is contained in:
@@ -59,8 +59,11 @@ impl<T: HttpTransport> ModelsClient<T> {
|
||||
let ModelsResponse { models } =
|
||||
serde_json::from_slice::<ModelsResponse>(&body).map_err(|e| {
|
||||
ApiError::Stream(format!(
|
||||
"failed to decode models response: {e}; body: {}",
|
||||
String::from_utf8_lossy(&body)
|
||||
"failed to decode models response: {:?} at line {} column {} (body: {} bytes)",
|
||||
e.classify(),
|
||||
e.line(),
|
||||
e.column(),
|
||||
body.len()
|
||||
))
|
||||
})?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user