mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Report diagnostic upload failures (#39287)
## Why Submitting a diagnostic report could appear successful without confirming that Sentry accepted the upload, leaving callers unable to detect transport or HTTP failures. ## What changed - Send report envelopes through the route-aware HTTP client and await the response. - Reject redirects, propagate transport and non-success HTTP responses, and include the full error chain in upload JSON-RPC errors. - Add structured logs for upload attempts, successes, and failures without including report contents. ## Testing Added coverage for successful uploads, rejected responses, blocked redirects, transport failures, and app-server JSON-RPC error reporting. GitOrigin-RevId: 07b5cfccd7a65f35d51a720537d2cd8962ed6cdb
This commit is contained in:
1 parent
e7f9fa9cd9
commit
997a80020f
6 files changed
+279
-26
No files matched your search
@@ -0,0 +1,48 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use anyhow::Result;
|
||||
use app_test_support::TestAppServer;
|
||||
use codex_app_server_protocol::RequestId;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serde_json::json;
|
||||
use tokio::time::timeout;
|
||||
use wiremock::Mock;
|
||||
use wiremock::MockServer;
|
||||
use wiremock::ResponseTemplate;
|
||||
use wiremock::matchers::method;
|
||||
|
||||
#[tokio::test]
|
||||
async fn feedback_upload_reports_transport_failure_as_json_rpc_error() -> Result<()> {
|
||||
let proxy = MockServer::start().await;
|
||||
Mock::given(method("CONNECT"))
|
||||
.respond_with(ResponseTemplate::new(503))
|
||||
.expect(1)
|
||||
.mount(&proxy)
|
||||
.await;
|
||||
let proxy_uri = proxy.uri();
|
||||
let mut app_server = TestAppServer::builder()
|
||||
.with_env_overrides(&[
|
||||
("HTTPS_PROXY", Some(proxy_uri.as_str())),
|
||||
("https_proxy", Some(proxy_uri.as_str())),
|
||||
("NO_PROXY", Some("")),
|
||||
("no_proxy", Some("")),
|
||||
])
|
||||
.build_initialized()
|
||||
.await?;
|
||||
|
||||
let request_id = app_server
|
||||
.send_raw_request(
|
||||
"feedback/upload",
|
||||
Some(json!({ "classification": "bug", "includeLogs": false })),
|
||||
)
|
||||
.await?;
|
||||
let error = timeout(
|
||||
Duration::from_secs(15),
|
||||
app_server.read_stream_until_error_message(RequestId::Integer(request_id)),
|
||||
)
|
||||
.await??;
|
||||
|
||||
assert_eq!(error.error.code, -32603);
|
||||
assert!(error.error.message.contains("failed to upload feedback"));
|
||||
Ok(())
|
||||
}
|
||||
@@ -31,6 +31,7 @@ mod experimental_api;
|
||||
mod experimental_feature_list;
|
||||
mod external_agent_config;
|
||||
mod external_agent_import_sync;
|
||||
mod feedback;
|
||||
mod fs;
|
||||
mod git_attribution;
|
||||
mod guardian_v2;
|
||||
|
||||
Reference in new issue
Block a user