fix(cli): identify Kilo in LLM user agent - #11347
Merged
Merged
Conversation
markijbema
marked this pull request as ready for review
June 17, 2026 09:45
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Reviewed by deepseek-v4-pro-20260423 · 263,855 tokens Review guidance: REVIEW.md from base branch |
markijbema
enabled auto-merge
June 17, 2026 11:30
imanolmzd-svg
approved these changes
Jun 17, 2026
t7tran
pushed a commit
to t7tran/kilocode
that referenced
this pull request
Aug 14, 2026
…nt-main fix(cli): identify Kilo in LLM user agent
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.
What
Fix provider request
User-Agentheaders emitted by the CLI LLM streaming path so they identify Kilo instead of OpenCode.The LLM request code now uses the existing Kilo installation
USER_AGENTvalue instead of hardcodingopencode/${InstallationVersion}. This covers both the Kilo-provider branch and the general provider branch before the AI SDK appends its own suffixes.Why
We observed provider/request logging with a header like:
The
ai-sdk/provider-utils/... runtime/bun/...suffix is appended by the AI SDK via itswithUserAgentSuffixhelper. The incorrectopencode/<version>prefix came from our code inpackages/opencode/src/session/llm.ts, where two branches passed:There is already a Kilo-specific installation helper in
packages/opencode/src/installation/index.tsthat returns the canonical Kilo user-agent value. The bug was that the LLM path bypassed that helper.Regression Analysis
This does not appear to be a new
7.3.46regression. Git history shows the hardcoded LLM header was introduced by:That commit dates to Apr 25, 2026, and is contained by many later tags. The later Kilo compatibility refactor:
updated the installation helper to return Kilo branding, but did not update this
session/llm.tscall site. So the bad prefix survived specifically on paths whereDEFAULT_HEADERSdoes not overwrite it, such as Anthropic and Kilo-provider requests.Testing
bun test ./test/session/llm.test.tsfrompackages/opencode/bun run script/check-opencode-annotations.tsfrom repo root