Add MCP tool call error metrics#28976
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d6030bc76
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| result | ||
| .structured_content | ||
| .as_ref() | ||
| .and_then(JsonValue::as_object) | ||
| .and_then(|structured_content| structured_content.get("error_code")) | ||
| .and_then(JsonValue::as_str) | ||
| .filter(|error_code| !error_code.is_empty()) |
There was a problem hiding this comment.
Read hosted auth error codes from metadata
For hosted Codex Apps auth failures, this only looks at structuredContent.error_code, but the existing auth-failure shape stores the plugin-service code in _meta._codex_apps.connector_auth_failure.error_code (for example codex-rs/core/src/mcp_tool_call_tests.rs:1386-L1395, produced by codex-mcp/src/auth_elicitation.rs). Those common hosted tool-result errors will therefore be emitted as error_code=unknown, so the new codex.mcp.call.error dimension loses the specific auth failure code it is intended to surface.
Useful? React with 👍 / 👎.
Codex Thread 019edc37-5345-7272-92c9-bf5494cf3819
Summary
CallToolResult.isErrorresponses as failed calls instead of successful transport-level callscodex.mcp.call.errorwith boundederror_typeand trusted plugin-serviceerror_codedimensionsScope
mcp_request; separating connection, timeout, protocol, and JSON-RPC failures requires preserving typed errors through the existing flattened error boundaryTesting
just test -p codex-core 'mcp_tool_call::tests::'(75 passed)just fix -p codex-corejust fmtjust test -p codex-core(2,676 passed; 80 unrelated environment failures from missing test binaries, sandbox signals, and read-only paths)