feat(core): differentiate User-Agent for a2a-server and ACP clients#22059
feat(core): differentiate User-Agent for a2a-server and ACP clients#22059
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 significantly enhances the Gemini CLI's ability to differentiate API traffic origins by modifying the Highlights
Changelog
Activity
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 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 counter productive. 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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Size Change: +1.65 kB (+0.01%) Total Size: 26.5 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to differentiate clients in the User-Agent header by adding a clientName prefix and a surface tag. The changes span across documentation, configuration, and core logic to support this for a2a-server and ACP clients. The implementation is mostly solid, but I've found a logic issue in how the clientName is determined for ACP mode which could lead to incorrect client identification in some scenarios. My review includes a suggestion to fix this.
9bde15b to
a8bb422
Compare
Summary
Implements a hybrid approach to differentiate Gemini CLI traffic in the
User-Agentheader, allowing enterprise customers and embedded products (like Gemini Code Assist) to accurately report on API usage from different surfaces. This replaces and expands upon the approach proposed in #21934.Details
This PR introduces a hybrid identification mechanism:
Configobject now supports aclientNamefield. Thea2a-serverexplicitly sets this toa2a-server, and the CLI sets it dynamically when running in ACP mode (e.g.,acp-zed,acp-xcode,acp-intellijidea). This becomes the prefix of theUser-Agentstring (e.g.,GeminiCLI-a2a-server/...).determineSurface()utility from PR feat(core): include surface identifier in User-Agent header #21934 to automatically probe the environment for the hosting surface (e.g.,vscode,terminal) and appends it to the parenthetical metadata (e.g.,... (linux; x64; vscode)).GEMINI_CLI_SURFACEenvironment variable to explicitly tag custom deployment tools.This approach provides a robust, unforgeable contract for embedded systems while retaining broad telemetry improvements for standard users.
Includes:
docs/cli/telemetry.mdanddocs/reference/configuration.md.Related Issues
Replaces/Closes #21934
How to Validate
npm run preflightUser-Agentheaders in generated API calls when running the CLI normally vs. starting thea2a-server.Pre-Merge Checklist