fix(codex): avoid empty prompt_cache_key

This commit is contained in:
Shady Khalifa
2026-01-27 19:06:42 +02:00
parent 53920b0399
commit 04b2290927

View File

@@ -622,13 +622,17 @@ func (e *CodexExecutor) cacheHelper(ctx context.Context, from sdktranslator.Form
}
}
rawJSON, _ = sjson.SetBytes(rawJSON, "prompt_cache_key", cache.ID)
if cache.ID != "" {
rawJSON, _ = sjson.SetBytes(rawJSON, "prompt_cache_key", cache.ID)
}
httpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewReader(rawJSON))
if err != nil {
return nil, err
}
httpReq.Header.Set("Conversation_id", cache.ID)
httpReq.Header.Set("Session_id", cache.ID)
if cache.ID != "" {
httpReq.Header.Set("Conversation_id", cache.ID)
httpReq.Header.Set("Session_id", cache.ID)
}
return httpReq, nil
}