fix(core): strip functionCall.id and functionResponse.id before API call - #27341
fix(core): strip functionCall.id and functionResponse.id before API call#27341whhe wants to merge 1 commit into
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an API validation error occurring during tool-use turns in the Gemini integration. Previously, internal IDs used for IDE rendering were being incorrectly forwarded to the Gemini API, which does not support an 'id' field in tool-related structures. The changes ensure these IDs are stripped at the API boundary while preserving them for internal application logic. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request renames the stripToolCallIdPrefixes function to stripToolCallIds and updates its implementation to completely remove the id field from functionCall and functionResponse objects, as the Gemini API does not support them. The associated unit tests have been updated to reflect this change, including the addition of parameterized tests to ensure the id is stripped regardless of the tool name. I have no feedback to provide.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request renames stripToolCallIdPrefixes to stripToolCallIds and updates its logic to unconditionally remove the id field from functionCall and functionResponse objects, as the Gemini API does not accept them. The associated tests have been updated to reflect this change. Feedback was provided to use the in operator instead of truthiness checks to ensure the id field is removed even if it contains a falsy value like an empty string.
4fc024a to
ff3a29c
Compare
ff3a29c to
8fded43
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request renames the stripToolCallIdPrefixes function to stripToolCallIds and updates its implementation to completely remove the id field from functionCall and functionResponse objects, ensuring compatibility with the Gemini API. Corresponding unit tests have been updated and expanded to reflect these changes. I have no feedback to provide.
|
Friendly ping — @joshualitt @scidomino would appreciate a review if you have a moment. Thanks! |
|
We are not reviewing PRs for issues that are not marked "Help wanted". |
|
Hi @scidomino — I left a comment on #22774 requesting the |
Footnotes
|
|
When Google announced that they will eventually drop support for GCLI in favor of AntiGravity much of the staff was assigned to other work. I personally am moving to an entirely unrelated project in a couple weeks. I would not count on all the issues being reviewed in a timely fashion. |
Thanks for sharing that context — totally understand. Hope the new project goes well! |
|
GoogleCLI is going through a phase transition. It is not being replaced
it’s being upgraded.
Warm regards
Russell Nordland
Issues are prioritized accordingly…
…On Wed, May 27, 2026 at 11:52 AM Tommaso Sciortino ***@***.***> wrote:
*scidomino* left a comment (google-gemini/gemini-cli#27341)
<#27341 (comment)>
When Google announced that they will eventually drop support for GCLI in
favor of AntiGravity much of the staff was assigned to other work. I
personally am moving to an entirely unrelated project in a couple weeks. I
would not count on all the issues being reviewed in a timely fashion.
—
Reply to this email directly, view it on GitHub
<#27341?email_source=notifications&email_token=BPTYXQAVPHZSN4M5J2WDHZD444MN7A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINJVGY3DMOJXGU32M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#issuecomment-4556669757>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BPTYXQGXGVFIEES372FRW3T444MN7AVCNFSM6AAAAACZHX6B5KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DKNJWGY3DSNZVG4>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
|
Hi there! Thank you for your interest in contributing to Gemini CLI. To ensure we maintain high code quality and focus on our prioritized roadmap, we only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'. This PR will be closed in 7 days if it remains without that designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding. |
|
📊 PR Size: size/M
|
🛑 Action Required: Evaluation ApprovalSteering changes have been detected in this PR. To prevent regressions, a maintainer must approve the evaluation run before this PR can be merged. Maintainers:
Once approved, the evaluation results will be posted here automatically. |
b38b07f to
03905c3
Compare
|
This pull request is being closed as it has been open for 14 days without a 'help wanted' designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding. |
Summary
Fixes a 400 "Unknown name 'id'" error that occurs on any turn following a tool call.
function_callandfunction_responseparts do not accept anidfield in theGemini API, but internal IDs added for ACP IDE rendering were being forwarded in the
API payload.
Fixes #22774
Details
makeApiCallAndProcessStreamcallsstripToolCallIdPrefixes(renamed here tostripToolCallIds) at the API boundary before each request. Prior to this changethe function had two gaps:
functionResponse.id— stripped only when the value started with the${name}__prefix pattern; IDs with non-matching formats were forwarded to the API.functionCall.id— never stripped after prefix removal; always forwarded tothe API after feat(acp/core): prefix tool call IDs with tool names to support tool rendering in ACP compliant IDEs. #26676 added tool-name prefixes for ACP IDE call rendering.
The fix strips
idunconditionally from both part types. InternalagentHistoryretains the prefixed IDs so ACP IDE call-to-response linking is unaffected.
The function is renamed
stripToolCallIdsbecause it now removes the field entirelyrather than transforming a prefix. It is not exported from the package index, so the
rename has no external impact.
Prior art: #22957 proposed the correct
functionResponse.idfix but wasauto-closed by the stale bot before any maintainer review. This PR completes that
fix and additionally covers
functionCall.id, which was introduced by #26676(2026-05-08) after #22957 was filed.
Related Issues
Fixes #22774
Refs #22957 (closed — correct
functionResponse.idfix, never reviewed)Refs #26676 (root cause: introduced ID fields without full API-boundary sanitization)
Refs #26691, #26352, #19856, #13082 (related prior
functionResponseAPI-validation fixes)How to Validate
Unit tests
npm run test --workspace @google/gemini-cli-core -- src/core/geminiChat.test.tsExpected: 60 tests pass (includes 3 parameterized
stripToolCallIdscases and1 new no-op case).
Manual regression
npm run build && npm start> What time is it in US Eastern Time?(triggers
GoogleSearch).[API Error: … Unknown name "id" at 'contents[N].parts[0].function_call' …].Pre-Merge Checklist