fix(agents): strip store param from payload when supportsStore is false#39219
fix(agents): strip store param from payload when supportsStore is false#39219ademczuk wants to merge 2 commits intoopenclaw:mainfrom
Conversation
|
@Takhoffman Would appreciate your review on this one - small targeted fix for the The core problem: Fix adds a |
Greptile SummaryThis PR fixes a targeted bug where the upstream pi-ai library hardcodes
Confidence Score: 5/5
Last reviewed commit: 608e201 |
@ademczuk) Co-authored-by: ademczuk <[email protected]>
|
Landed on What we changed while landing:
Source commits reviewed: Thanks @ademczuk. |
|
Cheers for landing this. Good catch tightening the type narrowing on the cast. |
|
@Takhoffman - would appreciate your review when you have a moment. This is a small fix (2 files, +23/-1) for #39086 where strict OpenAI-compatible endpoints reject the Rebased onto latest main, all CI green, 58 tests passing. |
…, thanks @ademczuk) Co-authored-by: ademczuk <[email protected]>
…, thanks @ademczuk) Co-authored-by: ademczuk <[email protected]>
…, thanks @ademczuk) Co-authored-by: ademczuk <[email protected]>
…, thanks @ademczuk) Co-authored-by: ademczuk <[email protected]>
…, thanks @ademczuk) Co-authored-by: ademczuk <[email protected]>
…, thanks @ademczuk) Co-authored-by: ademczuk <[email protected]>
…, thanks @ademczuk) Co-authored-by: ademczuk <[email protected]>
…, thanks @ademczuk) Co-authored-by: ademczuk <[email protected]>
…, thanks @ademczuk) Co-authored-by: ademczuk <[email protected]>
…, thanks @ademczuk) Co-authored-by: ademczuk <[email protected]>
…, thanks @ademczuk) (#1764) (cherry picked from commit 3a761fb) Co-authored-by: Peter Steinberger <[email protected]>
Summary
Fixes bug #1 from #39086: when a model declares
compat: { supportsStore: false }, thestore: falsefield that pi-ai upstream hardcodes for Responses API payloads is now stripped before the request reaches the provider.Previously,
createOpenAIResponsesContextManagementWrapper()early-exited without installing anonPayloadhook when neitherforceStorenoruseServerCompactionapplied. This left the upstream-injectedstore: falsein the payload, which strict OpenAI-compatible endpoints (e.g. Gemini via Cloudflare AI Gateway) reject as an unknown field with HTTP 400.Changes
extra-params.ts: addedstripStorecondition that prevents the early exit and deletesstorefrom the payload viaonPayloadwhensupportsStore === falsestoreis absent (not just not forced totrue)supportsStore: falseScope
This PR addresses only bug #1 (store parameter). Bug #2 (custom headers dropped) from #39086 is a separate concern and intentionally excluded to keep the change small.
Test plan
strips store from payload for models that declare supportsStore=falsestrips store from payload for non-OpenAI responses providers with supportsStore=falsepi-embedded-runner-extraparams.test.tspassFixes #39086 (partial: bug #1 only)