fix(google): guard vertex payload wrapper and patch gaxios fetch fallback#33428
Open
smartchainark wants to merge 2 commits intoopenclaw:mainfrom
Open
fix(google): guard vertex payload wrapper and patch gaxios fetch fallback#33428smartchainark wants to merge 2 commits intoopenclaw:mainfrom
smartchainark wants to merge 2 commits intoopenclaw:mainfrom
Conversation
Contributor
Greptile SummaryThis PR fixes a crash in the
Confidence Score: 5/5
Last reviewed commit: 2ca178a |
This was referenced Mar 4, 2026
This comment was marked as spam.
This comment was marked as spam.
2ca178a to
d69f2f8
Compare
d69f2f8 to
0557add
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
createGoogleThinkingPayloadWrapperapplied unconditionally to all providers but only guarded forgoogle-generative-ai, causingCannot convert undefined or null to objectcrashes when google-vertex models were used via embedded runner. (2) Thegaxioslibrary dynamically importsnode-fetchon Node 22+/24+/25 where nativeglobalThis.fetchis available, causing auth-stack crashes in the Google Vertex pipeline.google-generative-aiandgoogle-vertex. (2) Added a postinstall script (scripts/patch-gaxios-fetch.mjs) that patches gaxios to preferglobalThis.fetchbefore falling back tonode-fetch. (3) Added regression tests for both fixes.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Cannot convert undefined or null to objectwhen used via the embedded runner.node-fetchdynamic import.Security Impact (required)
Repro + Verification
Environment
Steps
gemini-3.1-pro-preview)Expected
Message processes without errors; thinking payload is sanitized correctly for google-vertex.
Actual (before fix)
Cannot convert undefined or null to objectcrash from either the payload wrapper (spreading undefined options) or the gaxios auth stack (node-fetch import failure).Evidence
Full suite: 6484+ tests passed.
Human Verification (required)
pnpm build && pnpm check && pnpm test)Compatibility / Migration
Failure Recovery (if this breaks)
git revert <commit-hash>src/agents/pi-embedded-runner/extra-params.ts,package.json, removescripts/patch-gaxios-fetch.mjsRisks and Mitigations
node_modules; future gaxios updates may change the patched code patterns.