Skip to content

Conversation

@chlins
Copy link
Member

@chlins chlins commented Nov 5, 2025

This pull request introduces a new custom User-Agent header to all remote registry requests made by the backend client. This helps identify requests originating from modctl and can be useful for debugging, analytics, or registry-side filtering. The change also brings in a new dependency on the version package to retrieve the current version string.

Enhancements to remote registry client:

  • Added import of the version package to retrieve the current version for the User-Agent header in pkg/backend/remote/client.go.
  • Set a custom User-Agent header (modctl/<version>) on all outgoing requests by creating an http.Header and attaching it to the auth.Client in the New function.

@chlins chlins added the enhancement New feature or request label Nov 5, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @chlins, 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 introduces a significant enhancement to the modctl backend client by embedding a custom User-Agent header in all HTTP requests directed at remote registries. This modification serves to uniquely identify modctl's requests, offering benefits for debugging, analytics, and potential server-side filtering. The change also incorporates a new internal dependency to dynamically fetch the application's version for accurate header population.

Highlights

  • Custom User-Agent Header: A custom User-Agent header, formatted as "modctl/", is now included in all outgoing HTTP requests made by the backend client to remote registries. This enhancement aids in identifying requests originating from modctl.
  • New Dependency for Versioning: A new dependency on the github.com/modelpack/modctl/pkg/version package has been introduced. This package is used to retrieve the current version string of modctl for inclusion in the User-Agent header.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a custom User-Agent header for all remote registry requests, which is a valuable addition for identifying client traffic. My review has identified a critical issue in the implementation where an http.Header is used without initialization, which would cause a runtime panic. I've included a specific code suggestion to resolve this. Besides this point, the changes are well-aligned with the goal of the pull request.

Copy link
Member

@gaius-qi gaius-qi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gaius-qi gaius-qi merged commit cfa3cef into main Nov 5, 2025
8 checks passed
@gaius-qi gaius-qi deleted the feat/user-agent branch November 5, 2025 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants