diff --git a/internal/translator/codex/openai/responses/codex_openai-responses_request.go b/internal/translator/codex/openai/responses/codex_openai-responses_request.go index 3762f152..1161c515 100644 --- a/internal/translator/codex/openai/responses/codex_openai-responses_request.go +++ b/internal/translator/codex/openai/responses/codex_openai-responses_request.go @@ -2,7 +2,6 @@ package responses import ( "fmt" - "strings" "github.com/tidwall/gjson" "github.com/tidwall/sjson" @@ -47,32 +46,12 @@ func ConvertOpenAIResponsesRequestToCodex(modelName string, inputRawJSON []byte, // // Compatibility strategy: // 1) Remove context_management before forwarding to Codex upstream. -// 2) Remove truncation as Codex upstream currently rejects it as unsupported. func applyResponsesCompactionCompatibility(rawJSON []byte) []byte { - contextManagement := gjson.GetBytes(rawJSON, "context_management") - if !contextManagement.Exists() { + if !gjson.GetBytes(rawJSON, "context_management").Exists() { return rawJSON } - hasCompactionRule := false - switch { - case contextManagement.IsArray(): - for _, item := range contextManagement.Array() { - if strings.EqualFold(item.Get("type").String(), "compaction") { - hasCompactionRule = true - break - } - } - case contextManagement.IsObject(): - hasCompactionRule = strings.EqualFold(contextManagement.Get("type").String(), "compaction") - } - - if hasCompactionRule { - // no-op marker: compaction hint detected and consumed for compatibility. - } - rawJSON, _ = sjson.DeleteBytes(rawJSON, "context_management") - rawJSON, _ = sjson.DeleteBytes(rawJSON, "truncation") return rawJSON }