mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-10-28 18:48:13 +08:00
fix(codex): reconcile replayed web_search_call history with tool declarations
- Inject a web_search tool declaration for standard Codex requests when input replays web_search_call items without a web_search tool so upstream response protection remains available during compaction. - Strip replayed web_search_call items from Responses Lite requests where top-level hosted tool declarations are omitted. Closes: #6770
This commit is contained in:
@@ -71,6 +71,7 @@ func (e *CodexExecutor) Execute(ctx context.Context, auth *cliproxyauth.Auth, re
|
||||
body, _ = sjson.DeleteBytes(body, "stream_options")
|
||||
useSIWC := codexUseSIWC(auth)
|
||||
hasExplicitInstructions := gjson.GetBytes(req.Payload, "instructions").Exists() && strings.TrimSpace(gjson.GetBytes(req.Payload, "instructions").String()) != ""
|
||||
body = ensureWebSearchToolForHistory(body, opts.Headers)
|
||||
if !useSIWC {
|
||||
body = normalizeCodexInstructions(body, helps.IsNativeCodexRequest(req.Payload, opts))
|
||||
if e.cfg == nil || e.cfg.DisableImageGeneration == config.DisableImageGenerationOff {
|
||||
@@ -266,6 +267,7 @@ func (e *CodexExecutor) executeCompact(ctx context.Context, auth *cliproxyauth.A
|
||||
hasExplicitInstructions := gjson.GetBytes(req.Payload, "instructions").Exists() && strings.TrimSpace(gjson.GetBytes(req.Payload, "instructions").String()) != ""
|
||||
body = applyCodexSIWCCompactBodyRules(body, hasExplicitInstructions, cliproxyexecutor.Options{KeepTopLevelEffort: thinking.HasThinkingSuffix(req.Model)})
|
||||
}
|
||||
body = ensureWebSearchToolForHistory(body, opts.Headers)
|
||||
body = sanitizeOpenAIResponsesReasoningEncryptedContentWithCompatModelAndBaseURL(ctx, "codex executor", body, isCompat, resolveResponsesSignatureTargetModel(baseModel, req, opts), baseURL)
|
||||
body = normalizeCodexParallelToolCalls(body, opts.Headers)
|
||||
body = helps.NormalizeCodexToolSchemas(body)
|
||||
|
||||
Reference in New Issue
Block a user