{"record":{"id":"fbb993a902919f65","repo":"Hmbown/CodeWhale","slug":"codewhale-responses-request-should-succeed","errorCode":null,"errorMessage":"Codewhale responses request should succeed","messagePattern":"Codewhale responses request should succeed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/client.rs","lineNumber":7911,"sourceCode":"            \"codewhale\",\n            &fingerprint,\n            now_unix(),\n        )\n        .expect(\"fixture catalog parses\");\n        crate::provider_catalog_live::record_success(ProviderCatalogDelta {\n            provider: \"codewhale\".to_string(),\n            base_url_fingerprint: fingerprint,\n            fetched_at: now_unix(),\n            offerings,\n        });\n\n        let mut client = codewhale_client(&server, \"openai/gpt-5.6\");\n        assert_eq!(client.wire_format, WireFormat::Responses);\n        client.retry.enabled = false;\n        let response = client\n            .create_message(minimal_zen_request(\"openai/gpt-5.6\"))\n            .await\n            .expect(\"Codewhale responses request should succeed\");\n\n        // Responses usage arrives on the terminal `response.completed` event —\n        // the dialect's equivalent of chat's `stream_options.include_usage`.\n        assert_eq!(response.usage.input_tokens, 3);\n        assert_eq!(response.usage.output_tokens, 1);\n        let requests = server.received_requests().await.expect(\"recorded request\");\n        assert_eq!(requests.len(), 1);\n        assert_codewhale_bearer(&requests[0]);\n        let body: Value = serde_json::from_slice(&requests[0].body).expect(\"responses JSON body\");\n        assert_eq!(\n            body.get(\"model\").and_then(Value::as_str),\n            Some(\"openai/gpt-5.6\")\n        );\n        assert!(body.get(\"input\").is_some(), \"Responses body: {body}\");\n        assert!(body.get(\"messages\").is_none(), \"Responses body: {body}\");\n\n        crate::provider_catalog_live::reset_cache_for_test();\n        crate::provider_lake::clear_live_snapshot();","sourceCodeStart":7893,"sourceCodeEnd":7929,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/client.rs#L7893-L7929","documentation":"This `expect` panics when `client.create_message(...)` returns `Err` for a Responses-wire-format request, aborting with 'Codewhale responses request should succeed' at crates/tui/src/client.rs:7911. The client is expected to stream against the mock server and aggregate usage from the terminal `response.completed` event; any transport, HTTP, or stream-parse failure surfaces here.","triggerScenarios":"Calling `create_message` with `wire_format == WireFormat::Responses` and `retry.enabled = false` when the mock returns a non-2xx status, the SSE stream is malformed, or `response.completed` never arrives so usage cannot be built.","commonSituations":"Mock route registered for `/chat/completions` instead of `/responses`; the fixture SSE events missing the terminal `response.completed` frame; retries disabled so a transient mock hiccup fails immediately.","solutions":["Confirm the mock route matches the Responses endpoint (`{base}/responses`), not the chat default","Log the returned error to see whether it is HTTP status or stream parsing","Ensure the mock SSE body ends with a `response.completed` event carrying usage","Re-enable retry or fix the fixture stream if the failure is transient"],"exampleFix":"// before\nlet response = client.create_message(minimal_zen_request(\"openai/gpt-5.6\")).await\n    .expect(\"Codewhale responses request should succeed\");\n// after\nlet response = client.create_message(minimal_zen_request(\"openai/gpt-5.6\")).await\n    .unwrap_or_else(|e| panic!(\"Codewhale responses request should succeed: {e:?}\"));","handlingStrategy":"try-catch","validationCode":"assert_eq!(client.wire_format, WireFormat::Responses);\nassert!(!client.retry.enabled); // deterministic failure surfacing","typeGuard":null,"tryCatchPattern":"let response = client.create_message(req).await\n    .unwrap_or_else(|e| panic!(\"Codewhale responses request should succeed: {e:?}\"));","preventionTips":["Register the mock on the /responses path, not the chat default","Ensure fixture SSE streams include a terminal response.completed event with usage","Keep retry disabled only when the mock is deterministic"],"tags":["rust","http","streaming"],"backgroundTag":"http-request-failed","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T11:17:16.035Z"}