fix(codex): align current reasoning request semantics

This commit is contained in:
MMEXA
2026-07-11 09:15:08 +08:00
parent dfa121dd5b
commit 46a903aada
7 changed files with 197 additions and 81 deletions
@@ -1,6 +1,7 @@
use std::collections::BTreeMap;
use std::time::Duration;
use aether_ai_formats::CODEX_RESPONSES_LITE_HEADER;
use aether_ai_serving::{run_ai_authenticated_decision_input, AiAuthenticatedDecisionInputPort};
use aether_routing_core::{
rank_vector_for_candidate, CandidateKind, ResolvedRoutingPolicy, RoutingCandidateFacts,
@@ -32,7 +33,6 @@ use crate::{AiExecutionDecision, AppState, GatewayError};
const ROUTING_GROUP_SELECTION_CACHE_TTL: Duration = Duration::from_secs(30);
const CODEX_ACCOUNT_ID_HEADER: &str = "chatgpt-account-id";
const CODEX_FEDRAMP_HEADER: &str = "x-openai-fedramp";
const CODEX_RESPONSES_LITE_HEADER: &str = "x-openai-internal-codex-responses-lite";
#[derive(Debug, Clone)]
pub(crate) struct ResolvedLocalDecisionAuthInput {
@@ -1035,7 +1035,7 @@ mod tests {
"id": "gpt-future-agent",
"slug": "gpt-future-agent",
"use_responses_lite": true,
"supports_reasoning_summaries": true,
"supports_reasoning_summary_parameter": true,
"default_reasoning_level": "low",
"default_reasoning_summary": "none",
"supported_reasoning_levels": [{"effort": "low"}, {"effort": "high"}]
@@ -195,7 +195,7 @@ fn local_codex_compact_wrapper_applies_the_complete_request_projection() {
"stream_options": {"reasoning_summary_delivery": "sequential_cutoff"},
"tool_choice": "auto",
"parallel_tool_calls": true,
"reasoning": {"effort": "max", "context": "all_turns"},
"reasoning": {"effort": "max", "summary": "auto", "context": "all_turns"},
"text": {"verbosity": "medium"},
"tools": [{
"type": "function",
@@ -134,9 +134,8 @@ fn codex_model_card_is_complete(card: &serde_json::Map<String, Value>) -> bool {
.and_then(Value::as_str)
.is_some()
&& card
.get("supports_reasoning_summaries")
.and_then(Value::as_bool)
.is_some()
.get("supports_reasoning_summary_parameter")
.is_none_or(Value::is_boolean)
&& card
.get("support_verbosity")
.and_then(Value::as_bool)
@@ -103,7 +103,6 @@ fn complete_codex_model_card(source_model_name: &str) -> serde_json::Value {
"upgrade": null,
"base_instructions": "Use the current Codex instructions.",
"model_messages": null,
"supports_reasoning_summaries": true,
"support_verbosity": true,
"default_verbosity": "low",
"apply_patch_tool_type": "freeform",