From f6cf784cd1231c3f92c497b70b2f97ff2ccac932 Mon Sep 17 00:00:00 2001 From: Luis Pater Date: Fri, 24 Oct 2025 11:47:15 +0800 Subject: [PATCH] refactor(translator): remove unused log dependency and comment out debug logging docs: add GPT-5 Codex guidelines for CLI usage - Added detailed guidelines for GPT-5 Codex in Codex CLI. - Expanded instructions on sandboxing, approvals, editing constraints, and style requirements. - Included presentation and response formatting best practices. fix(codex_instructions): update comparison logic to use prefix matching - Changed system instructions comparison to use `strings.HasPrefix` for improved flexibility. --- internal/misc/codex_instructions.go | 2 +- ...dex_prompt.md-002-c9505488a120299b339814d73f57817ee79e114f} | 0 ...dex_prompt.md-003-f6a152848a09943089dcb9cb90de086e58008f2a} | 0 ...dex_prompt.md-005-35c76ad47d0f6f134923026c9c80d1f2e9bbd83f} | 0 ...dex_prompt.md-006-0ad1b0782b16bb5e91065da622b7c605d7d512e6} | 0 ... => prompt.md-001-31d0d7a305305ad557035a2edcab60b6be5018d8} | 0 ... => prompt.md-002-6ce0a5875bbde55a00df054e7f0bceba681cf44d} | 0 ... => prompt.md-003-a6139aa0035d19d794a3669d6196f9f32a8c8352} | 0 ... => prompt.md-004-063083af157dcf57703462c07789c54695861dff} | 0 ... => prompt.md-005-d31e149cb1b4439f47393115d7a85b3c8ab8c90d} | 0 ... => prompt.md-006-81b148bda271615b37f7e04b3135e9d552df8111} | 0 ... => prompt.md-008-30ee24521b79cdebc8bae084385550d86db7142a} | 0 ... => prompt.md-009-e4c275d615e6ba9dd0805fb2f4c73099201011a0} | 0 ... => prompt.md-010-3d8bca7814824cab757a78d18cbdc93a40f1126f} | 0 ... => prompt.md-011-4ae45a6c8df62287d720385430d0458a0b2dc354} | 0 ... => prompt.md-012-bef7ed0ccc563e61fac5bef811c6079d9d65ce60} | 0 ... => prompt.md-013-b1c291e2bbca0706ec9b2888f358646e65a8f315} | 0 .../codex/openai/responses/codex_openai-responses_request.go | 3 +-- 18 files changed, 2 insertions(+), 3 deletions(-) rename internal/misc/codex_instructions/{gpt_5_codex_prompt.md-006-c9505488a120299b339814d73f57817ee79e114f => gpt_5_codex_prompt.md-002-c9505488a120299b339814d73f57817ee79e114f} (100%) rename internal/misc/codex_instructions/{gpt_5_codex_prompt.md-005-f6a152848a09943089dcb9cb90de086e58008f2a => gpt_5_codex_prompt.md-003-f6a152848a09943089dcb9cb90de086e58008f2a} (100%) rename internal/misc/codex_instructions/{gpt_5_codex_prompt.md-003-35c76ad47d0f6f134923026c9c80d1f2e9bbd83f => gpt_5_codex_prompt.md-005-35c76ad47d0f6f134923026c9c80d1f2e9bbd83f} (100%) rename internal/misc/codex_instructions/{gpt_5_codex_prompt.md-002-0ad1b0782b16bb5e91065da622b7c605d7d512e6 => gpt_5_codex_prompt.md-006-0ad1b0782b16bb5e91065da622b7c605d7d512e6} (100%) rename internal/misc/codex_instructions/{prompt.md-013-31d0d7a305305ad557035a2edcab60b6be5018d8 => prompt.md-001-31d0d7a305305ad557035a2edcab60b6be5018d8} (100%) rename internal/misc/codex_instructions/{prompt.md-012-6ce0a5875bbde55a00df054e7f0bceba681cf44d => prompt.md-002-6ce0a5875bbde55a00df054e7f0bceba681cf44d} (100%) rename internal/misc/codex_instructions/{prompt.md-011-a6139aa0035d19d794a3669d6196f9f32a8c8352 => prompt.md-003-a6139aa0035d19d794a3669d6196f9f32a8c8352} (100%) rename internal/misc/codex_instructions/{prompt.md-010-063083af157dcf57703462c07789c54695861dff => prompt.md-004-063083af157dcf57703462c07789c54695861dff} (100%) rename internal/misc/codex_instructions/{prompt.md-009-d31e149cb1b4439f47393115d7a85b3c8ab8c90d => prompt.md-005-d31e149cb1b4439f47393115d7a85b3c8ab8c90d} (100%) rename internal/misc/codex_instructions/{prompt.md-008-81b148bda271615b37f7e04b3135e9d552df8111 => prompt.md-006-81b148bda271615b37f7e04b3135e9d552df8111} (100%) rename internal/misc/codex_instructions/{prompt.md-006-30ee24521b79cdebc8bae084385550d86db7142a => prompt.md-008-30ee24521b79cdebc8bae084385550d86db7142a} (100%) rename internal/misc/codex_instructions/{prompt.md-005-e4c275d615e6ba9dd0805fb2f4c73099201011a0 => prompt.md-009-e4c275d615e6ba9dd0805fb2f4c73099201011a0} (100%) rename internal/misc/codex_instructions/{prompt.md-004-3d8bca7814824cab757a78d18cbdc93a40f1126f => prompt.md-010-3d8bca7814824cab757a78d18cbdc93a40f1126f} (100%) rename internal/misc/codex_instructions/{prompt.md-003-4ae45a6c8df62287d720385430d0458a0b2dc354 => prompt.md-011-4ae45a6c8df62287d720385430d0458a0b2dc354} (100%) rename internal/misc/codex_instructions/{prompt.md-002-bef7ed0ccc563e61fac5bef811c6079d9d65ce60 => prompt.md-012-bef7ed0ccc563e61fac5bef811c6079d9d65ce60} (100%) rename internal/misc/codex_instructions/{prompt.md-001-b1c291e2bbca0706ec9b2888f358646e65a8f315 => prompt.md-013-b1c291e2bbca0706ec9b2888f358646e65a8f315} (100%) diff --git a/internal/misc/codex_instructions.go b/internal/misc/codex_instructions.go index 9224cd97..6775d5d5 100644 --- a/internal/misc/codex_instructions.go +++ b/internal/misc/codex_instructions.go @@ -20,7 +20,7 @@ func CodexInstructionsForModel(modelName, systemInstructions string) (bool, stri // lastReviewPrompt := "" for _, entry := range entries { content, _ := codexInstructionsDir.ReadFile("codex_instructions/" + entry.Name()) - if systemInstructions == string(content) { + if strings.HasPrefix(systemInstructions, string(content)) { return true, "" } if strings.HasPrefix(entry.Name(), "gpt_5_codex_prompt.md") { diff --git a/internal/misc/codex_instructions/gpt_5_codex_prompt.md-006-c9505488a120299b339814d73f57817ee79e114f b/internal/misc/codex_instructions/gpt_5_codex_prompt.md-002-c9505488a120299b339814d73f57817ee79e114f similarity index 100% rename from internal/misc/codex_instructions/gpt_5_codex_prompt.md-006-c9505488a120299b339814d73f57817ee79e114f rename to internal/misc/codex_instructions/gpt_5_codex_prompt.md-002-c9505488a120299b339814d73f57817ee79e114f diff --git a/internal/misc/codex_instructions/gpt_5_codex_prompt.md-005-f6a152848a09943089dcb9cb90de086e58008f2a b/internal/misc/codex_instructions/gpt_5_codex_prompt.md-003-f6a152848a09943089dcb9cb90de086e58008f2a similarity index 100% rename from internal/misc/codex_instructions/gpt_5_codex_prompt.md-005-f6a152848a09943089dcb9cb90de086e58008f2a rename to internal/misc/codex_instructions/gpt_5_codex_prompt.md-003-f6a152848a09943089dcb9cb90de086e58008f2a diff --git a/internal/misc/codex_instructions/gpt_5_codex_prompt.md-003-35c76ad47d0f6f134923026c9c80d1f2e9bbd83f b/internal/misc/codex_instructions/gpt_5_codex_prompt.md-005-35c76ad47d0f6f134923026c9c80d1f2e9bbd83f similarity index 100% rename from internal/misc/codex_instructions/gpt_5_codex_prompt.md-003-35c76ad47d0f6f134923026c9c80d1f2e9bbd83f rename to internal/misc/codex_instructions/gpt_5_codex_prompt.md-005-35c76ad47d0f6f134923026c9c80d1f2e9bbd83f diff --git a/internal/misc/codex_instructions/gpt_5_codex_prompt.md-002-0ad1b0782b16bb5e91065da622b7c605d7d512e6 b/internal/misc/codex_instructions/gpt_5_codex_prompt.md-006-0ad1b0782b16bb5e91065da622b7c605d7d512e6 similarity index 100% rename from internal/misc/codex_instructions/gpt_5_codex_prompt.md-002-0ad1b0782b16bb5e91065da622b7c605d7d512e6 rename to internal/misc/codex_instructions/gpt_5_codex_prompt.md-006-0ad1b0782b16bb5e91065da622b7c605d7d512e6 diff --git a/internal/misc/codex_instructions/prompt.md-013-31d0d7a305305ad557035a2edcab60b6be5018d8 b/internal/misc/codex_instructions/prompt.md-001-31d0d7a305305ad557035a2edcab60b6be5018d8 similarity index 100% rename from internal/misc/codex_instructions/prompt.md-013-31d0d7a305305ad557035a2edcab60b6be5018d8 rename to internal/misc/codex_instructions/prompt.md-001-31d0d7a305305ad557035a2edcab60b6be5018d8 diff --git a/internal/misc/codex_instructions/prompt.md-012-6ce0a5875bbde55a00df054e7f0bceba681cf44d b/internal/misc/codex_instructions/prompt.md-002-6ce0a5875bbde55a00df054e7f0bceba681cf44d similarity index 100% rename from internal/misc/codex_instructions/prompt.md-012-6ce0a5875bbde55a00df054e7f0bceba681cf44d rename to internal/misc/codex_instructions/prompt.md-002-6ce0a5875bbde55a00df054e7f0bceba681cf44d diff --git a/internal/misc/codex_instructions/prompt.md-011-a6139aa0035d19d794a3669d6196f9f32a8c8352 b/internal/misc/codex_instructions/prompt.md-003-a6139aa0035d19d794a3669d6196f9f32a8c8352 similarity index 100% rename from internal/misc/codex_instructions/prompt.md-011-a6139aa0035d19d794a3669d6196f9f32a8c8352 rename to internal/misc/codex_instructions/prompt.md-003-a6139aa0035d19d794a3669d6196f9f32a8c8352 diff --git a/internal/misc/codex_instructions/prompt.md-010-063083af157dcf57703462c07789c54695861dff b/internal/misc/codex_instructions/prompt.md-004-063083af157dcf57703462c07789c54695861dff similarity index 100% rename from internal/misc/codex_instructions/prompt.md-010-063083af157dcf57703462c07789c54695861dff rename to internal/misc/codex_instructions/prompt.md-004-063083af157dcf57703462c07789c54695861dff diff --git a/internal/misc/codex_instructions/prompt.md-009-d31e149cb1b4439f47393115d7a85b3c8ab8c90d b/internal/misc/codex_instructions/prompt.md-005-d31e149cb1b4439f47393115d7a85b3c8ab8c90d similarity index 100% rename from internal/misc/codex_instructions/prompt.md-009-d31e149cb1b4439f47393115d7a85b3c8ab8c90d rename to internal/misc/codex_instructions/prompt.md-005-d31e149cb1b4439f47393115d7a85b3c8ab8c90d diff --git a/internal/misc/codex_instructions/prompt.md-008-81b148bda271615b37f7e04b3135e9d552df8111 b/internal/misc/codex_instructions/prompt.md-006-81b148bda271615b37f7e04b3135e9d552df8111 similarity index 100% rename from internal/misc/codex_instructions/prompt.md-008-81b148bda271615b37f7e04b3135e9d552df8111 rename to internal/misc/codex_instructions/prompt.md-006-81b148bda271615b37f7e04b3135e9d552df8111 diff --git a/internal/misc/codex_instructions/prompt.md-006-30ee24521b79cdebc8bae084385550d86db7142a b/internal/misc/codex_instructions/prompt.md-008-30ee24521b79cdebc8bae084385550d86db7142a similarity index 100% rename from internal/misc/codex_instructions/prompt.md-006-30ee24521b79cdebc8bae084385550d86db7142a rename to internal/misc/codex_instructions/prompt.md-008-30ee24521b79cdebc8bae084385550d86db7142a diff --git a/internal/misc/codex_instructions/prompt.md-005-e4c275d615e6ba9dd0805fb2f4c73099201011a0 b/internal/misc/codex_instructions/prompt.md-009-e4c275d615e6ba9dd0805fb2f4c73099201011a0 similarity index 100% rename from internal/misc/codex_instructions/prompt.md-005-e4c275d615e6ba9dd0805fb2f4c73099201011a0 rename to internal/misc/codex_instructions/prompt.md-009-e4c275d615e6ba9dd0805fb2f4c73099201011a0 diff --git a/internal/misc/codex_instructions/prompt.md-004-3d8bca7814824cab757a78d18cbdc93a40f1126f b/internal/misc/codex_instructions/prompt.md-010-3d8bca7814824cab757a78d18cbdc93a40f1126f similarity index 100% rename from internal/misc/codex_instructions/prompt.md-004-3d8bca7814824cab757a78d18cbdc93a40f1126f rename to internal/misc/codex_instructions/prompt.md-010-3d8bca7814824cab757a78d18cbdc93a40f1126f diff --git a/internal/misc/codex_instructions/prompt.md-003-4ae45a6c8df62287d720385430d0458a0b2dc354 b/internal/misc/codex_instructions/prompt.md-011-4ae45a6c8df62287d720385430d0458a0b2dc354 similarity index 100% rename from internal/misc/codex_instructions/prompt.md-003-4ae45a6c8df62287d720385430d0458a0b2dc354 rename to internal/misc/codex_instructions/prompt.md-011-4ae45a6c8df62287d720385430d0458a0b2dc354 diff --git a/internal/misc/codex_instructions/prompt.md-002-bef7ed0ccc563e61fac5bef811c6079d9d65ce60 b/internal/misc/codex_instructions/prompt.md-012-bef7ed0ccc563e61fac5bef811c6079d9d65ce60 similarity index 100% rename from internal/misc/codex_instructions/prompt.md-002-bef7ed0ccc563e61fac5bef811c6079d9d65ce60 rename to internal/misc/codex_instructions/prompt.md-012-bef7ed0ccc563e61fac5bef811c6079d9d65ce60 diff --git a/internal/misc/codex_instructions/prompt.md-001-b1c291e2bbca0706ec9b2888f358646e65a8f315 b/internal/misc/codex_instructions/prompt.md-013-b1c291e2bbca0706ec9b2888f358646e65a8f315 similarity index 100% rename from internal/misc/codex_instructions/prompt.md-001-b1c291e2bbca0706ec9b2888f358646e65a8f315 rename to internal/misc/codex_instructions/prompt.md-013-b1c291e2bbca0706ec9b2888f358646e65a8f315 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 e3bd37be..d666bd0b 100644 --- a/internal/translator/codex/openai/responses/codex_openai-responses_request.go +++ b/internal/translator/codex/openai/responses/codex_openai-responses_request.go @@ -6,7 +6,6 @@ import ( "strings" "github.com/router-for-me/CLIProxyAPI/v6/internal/misc" - log "github.com/sirupsen/logrus" "github.com/tidwall/gjson" "github.com/tidwall/sjson" ) @@ -74,7 +73,7 @@ func ConvertOpenAIResponsesRequestToCodex(modelName string, inputRawJSON []byte, if hasOfficialInstructions { return rawJSON } - log.Debugf("instructions not matched, %s\n", originalInstructions) + // log.Debugf("instructions not matched, %s\n", originalInstructions) if len(inputResults) > 0 { newInput := "[]"