fix: send the product User-Agent on provider registry and catalog fetches#1597
Merged
Conversation
…ches Registry (api.json) and models.dev catalog fetches only carried the runtime default User-Agent while every other outbound request sends kimi-code-cli/<version>. Thread an optional userAgent through fetchCustomRegistry / fetchCatalog and the shared refresh host, pass the product UA from the CLI, TUI, and both daemons, and seed a default product UA in kap-server that hosts can override via opts.seeds.
🦋 Changeset detectedLatest commit: c970702 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
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.
Related Issue
No linked issue — the problem is described below.
Problem
Fetches of provider registries (
api.json) and the models.dev catalog went out without the product User-Agent — they only carried the runtime default (User-Agent: node), while every other outbound request (LLM calls, managed usage, WebSearch/FetchURL tools) already sendskimi-code-cli/<version>. Registries therefore cannot tell which client and version is calling them, and a genericnodeUA is more likely to be treated as bot traffic by WAFs.What changed
fetchCustomRegistryandfetchCatalogaccept an optionaluserAgent; the shared provider-refresh orchestrator threads it throughRefreshProviderHost.kimi provider add,kimi provider catalog list/add) and the TUI (provider-add flows and the startup background refresh) pass the standardkimi-code-cli/<version>UA.IHostRequestHeadersscope seed, User-Agent only, so device-identity headers never leave the host (matchingModelResolverService).opts.seeds.When no host identity is available the behavior is unchanged (the fetch falls back to the runtime default UA). OAuth endpoints intentionally keep their existing no-CLI-UA behavior.
Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update (no user-visible behavior change; request headers only).