Skip to content

docs: document user-agent template behavior with platform headers - #6487

Open
devin-ai-integration[bot] wants to merge 6 commits into
mainfrom
devin/1785517757-user-agent-platform-headers
Open

docs: document user-agent template behavior with platform headers#6487
devin-ai-integration[bot] wants to merge 6 commits into
mainfrom
devin/1785517757-user-agent-platform-headers

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

SDKs can send a custom User-Agent built from a user-agent template in generators.yml, and they can also send a structured User-Agent carrying OS, architecture, and runtime info when platform headers are enabled. Until recently, Python, TypeScript, and C# dropped the configured template when platform headers were on and fell back to the package name. That's now fixed, so customers who set a custom User-Agent for attribution or analytics get their exact product token in every request regardless of platform headers, and server-side telemetry is consistent across languages.

Implements docs for: fix(python, typescript, csharp): honor user-agent template with platform headers (fern-api/fern#17298)

Changes:

  • Added a user-agent config option to the Python, TypeScript, C#, Go, PHP, and Ruby generator configuration references (previously only documented for Java), covering the placeholders and the resulting header.
  • Documented the combined result on those pages: the resolved template becomes the product token, followed by the platform and runtime segments (plantstore-python-sdk/0.1.0 (linux; x86_64) Python/3.11.0), and a resolved value whose trailing segment isn't a version (@plantstore/sdk) is used as-is with no version appended.
  • Cross-linked the includePlatformHeaders option on each page to the user-agent option.
  • Added a note to the generators.yml reference config section that user-agent is CLI-resolved and behaves identically in every generator's config.

user-agent isn't a per-generator option: the CLI resolves it (CLI_ONLY_CONFIG_KEYS in checkVersionExists.ts) and threads the interpolated value through ir.sdkConfig.platformHeaders.userAgent, so it applies to every generator that reads that field. Rust and Swift are deliberately excluded: ClientConfigGenerator hardcodes "<ApiName> Rust SDK" and the Swift generator emits no User-Agent, so neither consumes the template. The reference says so explicitly.

Refresh against main

Main has since merged allowUserAgentAppInfo docs on all seven generator pages (#6547), plus runtime_version for Python. Re-verified against fern-api/fern main: the CLI-resolved template still lands in platformHeaders.userAgent and each generator's app-info token is appended after whatever User-Agent the SDK would otherwise send, so the claims in this PR still hold. Merged main and added the missing cross-links:

  • Each user-agent section now notes that the app-info product token is appended after the resolved value, linking to that page's allowUserAgentAppInfo / allow-user-agent-app-info / allow_user_agent_app_info anchor.
  • Python's section also notes that runtime_version replaces the resolved value's trailing version segment at runtime (_get_user_agent_coordinate_prefix in client_wrapper_generator.py applies to the template-resolved value, not just the package coordinate).

Validation: pre-commit run --files <changed files> passes (only pre-existing Vale findings) and fern check --warnings reports 0 errors.

Link to Devin session: https://app.devin.ai/sessions/2fdc861910a3458cbab59174b4d87b8c

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot requested a review from devalog as a code owner July 31, 2026 17:09
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

devalog and others added 5 commits August 3, 2026 14:57
….yml reference

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant