mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 00:14:34 +00:00
fix(agents): strip unsupported responses store payloads (#39219, thanks @ademczuk)
Co-authored-by: ademczuk <andrew.demczuk@gmail.com>
This commit is contained in:
@@ -305,7 +305,14 @@ function createOpenAIResponsesContextManagementWrapper(
|
||||
return (model, context, options) => {
|
||||
const forceStore = shouldForceResponsesStore(model);
|
||||
const useServerCompaction = shouldEnableOpenAIResponsesServerCompaction(model, extraParams);
|
||||
if (!forceStore && !useServerCompaction) {
|
||||
// Strip `store` from the payload when the model declares supportsStore=false.
|
||||
// pi-ai upstream hardcodes `store: false` for Responses API; strict
|
||||
// OpenAI-compatible endpoints (e.g. Gemini via Cloudflare) reject it.
|
||||
const stripStore =
|
||||
!forceStore &&
|
||||
OPENAI_RESPONSES_APIS.has(String(model.api ?? "")) &&
|
||||
(model as { compat?: { supportsStore?: boolean } }).compat?.supportsStore === false;
|
||||
if (!forceStore && !useServerCompaction && !stripStore) {
|
||||
return underlying(model, context, options);
|
||||
}
|
||||
|
||||
@@ -321,6 +328,9 @@ function createOpenAIResponsesContextManagementWrapper(
|
||||
if (forceStore) {
|
||||
payloadObj.store = true;
|
||||
}
|
||||
if (stripStore) {
|
||||
delete payloadObj.store;
|
||||
}
|
||||
if (useServerCompaction && payloadObj.context_management === undefined) {
|
||||
payloadObj.context_management = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user