{"record":{"id":"73764ca04ffdfab2","repo":"BigPizzaV3/CodexPlusPlus","slug":"chat-completions-responses-compact","errorCode":null,"errorMessage":"Chat Completions 协议暂不支持 Responses compact 请求","messagePattern":"Chat Completions 协议暂不支持 Responses compact 请求","errorType":"http","errorClass":null,"httpStatus":502,"severity":"error","filePath":"crates/codex-plus-core/src/protocol_proxy.rs","lineNumber":920,"sourceCode":"        .to_string();\n\n    Ok(UpstreamProxyResponse {\n        status_code,\n        is_stream: is_stream || content_type.contains(\"text/event-stream\"),\n        content_type,\n        wire_api: UpstreamWireApi::ChatCompletions,\n        response: upstream,\n    })\n}\n\nasync fn upstream_request_parts(\n    relay: &crate::settings::RelayProfile,\n    request_json: Value,\n    request_path: &str,\n) -> anyhow::Result<(String, Value, UpstreamWireApi)> {\n    let compact = is_responses_compact_proxy_path(request_path);\n    if compact && relay.protocol == RelayProtocol::ChatCompletions {\n        anyhow::bail!(\"Chat Completions 协议暂不支持 Responses compact 请求\");\n    }\n    let mut body = match relay.protocol {\n        RelayProtocol::Responses => request_json,\n        RelayProtocol::ChatCompletions => responses_to_chat_completions(request_json)?,\n    };\n\n    // Image handling (per-model): send-as-is / strip / VLM analysis\n    let model = body\n        .get(\"model\")\n        .and_then(Value::as_str)\n        .unwrap_or(\"\")\n        .to_string();\n    if !model.is_empty() {\n        use crate::vision::ImageHandling;\n        match crate::vision::image_handling_mode(&model, &relay.model_vlm) {\n            ImageHandling::SendAsIs => { /* 不做任何处理 */ }\n            ImageHandling::Strip => {\n                for key in &[\"messages\", \"input\"] {","sourceCodeStart":902,"sourceCodeEnd":938,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/1f431ae49b57b3055e0e6845ba6156c6b4232b4d/crates/codex-plus-core/src/protocol_proxy.rs#L902-L938","documentation":"Thrown by upstream_request_parts in crates/codex-plus-core/src/protocol_proxy.rs when the incoming request path is a Responses compact endpoint (/responses/compact, /v1/responses/compact, /v1/v1/responses/compact, or /codex/v1/responses/compact per is_responses_compact_proxy_path) but the selected relay speaks the Chat Completions protocol. Compact (context-compaction) requests are forwarded verbatim in the Responses wire format; the responses_to_chat_completions converter does not implement a compact translation, so the combination is rejected explicitly.","triggerScenarios":"codex client triggers an automatic /v1/responses/compact call while the active relay profile protocol is ChatCompletions; a Chat Completions aggregate member is selected for a compact request during failover.","commonSituations":"Long codex sessions hitting the auto-compact threshold on a chat-completions-only relay; switching providers mid-conversation from Responses to Chat Completions and the next compaction fires; chat-completions vendors that never implemented the compact endpoint.","solutions":["Switch the active provider (or the route target serving this model) to a relay using the Responses protocol","Raise the auto-compact threshold / context window so compaction is deferred while on a Chat Completions relay","Start a new conversation so no compaction is requested until you are back on a Responses-capable provider"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if crate::protocol_proxy::is_responses_compact_proxy_path(path)\n    && relay.protocol == RelayProtocol::ChatCompletions\n{\n    anyhow::bail!(\"compact requires a Responses-protocol provider\");\n}","typeGuard":"fn relay_supports_compact(relay: &RelayProfile) -> bool {\n    relay.protocol == RelayProtocol::Responses\n}","tryCatchPattern":null,"preventionTips":["Keep a Responses-protocol provider available for long conversations that will compact","Prefer Responses-protocol relays as model-route targets for models used in long sessions","Watch for codex client updates that change compact endpoint frequency"],"tags":["responses-api","compact","protocol-mismatch","chat-completions","context-compaction"],"backgroundTag":"protocol-mismatch","analyzedSha":"1f431ae49b57b3055e0e6845ba6156c6b4232b4d","analyzedAt":"2026-08-16T20:54:18.598Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}