Skip to content

feat(provider): identify outbound LLM requests with a Reasonix User-Agent#5228

Open
xiongdi wants to merge 2 commits into
esengine:main-v2from
xiongdi:feat/provider-reasonix-user-agent
Open

feat(provider): identify outbound LLM requests with a Reasonix User-Agent#5228
xiongdi wants to merge 2 commits into
esengine:main-v2from
xiongdi:feat/provider-reasonix-user-agent

Conversation

@xiongdi

@xiongdi xiongdi commented Jun 24, 2026

Copy link
Copy Markdown

Summary

Closes #5226.

Outbound LLM requests carried no User-Agent, so Go's default Go-http-client/1.1 was sent and an upstream gateway/proxy had no way to tell a request came from Reasonix.

The openai and anthropic providers now set a fixed User-Agent: Reasonix on every request (alongside the existing Content-Type / Authorization / Accept / x-api-key / anthropic-version headers). No version, no config, no new package — just a stable, well-known field that gateways can match on.

This is the zero-config subset of #3824 (fully user-configurable headers). It intentionally does not touch MCP HTTP headers (already handled by #5073) or webfetch's deliberate browser-like UA.

Cache-impact: none - only a transport-level User-Agent HTTP header is added; buildRequest/message serialization and the JSON body sent to the model are unchanged, so the prompt-cache key (DeepSeek/OpenAI/Anthropic prefix caching keys on the message body, not request headers) is unaffected.
Cache-guard: buildRequest and the wire message structs are untouched; existing prefix-cache guards (internal/provider/openai/realcache_test.go, cachehit_e2e_test.go) still pass, and the new TestStreamSendsReasonixUserAgent in both providers only asserts the outbound header.

Test plan

  • go build ./...
  • go vet ./internal/provider/... ./internal/cli/...
  • go test ./internal/provider/openai/... ./internal/provider/anthropic/...
  • New TestStreamSendsReasonixUserAgent in both providers asserting the outbound User-Agent is Reasonix.
  • Manual: point a provider at a logging reverse proxy and confirm User-Agent: Reasonix appears.

…gent (esengine#5226)

Outbound provider requests carried no User-Agent, so Go's default
"Go-http-client/1.1" went out and an upstream gateway/proxy could not
attribute traffic to Reasonix.

Add a small buildinfo package that owns the build version (set once in
cli.Run from the -ldflags-injected value, falling back to "dev") and
exposes UserAgent() == "Reasonix/<version>". The openai and anthropic
providers now set this User-Agent on every request.

This is the zero-config subset of esengine#3824 (fully user-configurable
headers): no config or UI, just a stable, well-known field gateways can
match on.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development tui Terminal UI / CLI (internal/cli, internal/control) provider Model providers & selection (internal/provider) labels Jun 24, 2026
…umbing

Simplify the change in response to review: instead of a buildinfo package
threading the build version into "Reasonix/<version>", the openai and
anthropic providers just send a constant `User-Agent: Reasonix`.

Removes internal/buildinfo and the cli.Run wiring; keeps the identifying
header (and its provider tests).

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

provider Model providers & selection (internal/provider) tui Terminal UI / CLI (internal/cli, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Identify outbound LLM requests as coming from Reasonix (User-Agent)

1 participant