mirror of
https://github.com/openai/codex.git
synced 2026-11-17 22:10:37 +00:00
## Why MCP request failures and tool errors reported only through `codex/telemetry` metadata previously received an `unknown` error code, obscuring the failure category. ## What changed - Classify typed request failures into bounded codes such as `request_timeout`, `transport_closed`, and `protocol_error`, and carry them into MCP call metrics and spans before errors become strings. - Preserve typed timeouts when a prepared tool call exhausts its deadline during trusted access lookup. - Accept allowlisted `error_code` values from `codex/telemetry` as a fallback after structured content and connector authentication metadata. Keep model output unchanged and ignore unrecognized metadata codes. ## Testing Add coverage for typed errors wrapped in context, prepared-call timeout classification, metadata precedence and rejection, unchanged model output, and exported span error attributes. GitOrigin-RevId: d7a440a6c9119b8a07a7f1fad697eb25af506f00
25 lines
720 B
Rust
25 lines
720 B
Rust
//! Verify caller error classification preserves typed causes through context.
|
|
|
|
use super::*;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
#[test]
|
|
fn request_error_codes_preserve_typed_causes_through_context() {
|
|
for (error, expected) in [
|
|
(
|
|
request_timeout_error("tools/call", Duration::from_secs(1)),
|
|
Some("request_timeout"),
|
|
),
|
|
(
|
|
anyhow::Error::from(ClientOperationError::Service(ServiceError::TransportClosed)),
|
|
Some("transport_closed"),
|
|
),
|
|
(anyhow::anyhow!("timed out awaiting tools/call"), None),
|
|
] {
|
|
assert_eq!(
|
|
request_error_code(&error.context("tool call failed")),
|
|
expected
|
|
);
|
|
}
|
|
}
|