feat(agent): identify e2e on every model request
Summary
- Every model call now identifies e2e, whichever provider serves it. Before, only subscription logins (ChatGPT, Copilot, SuperGrok) sent our user agent. Vercel AI Gateway, OpenRouter, and OpenAI-compatible endpoints saw a generic AI SDK client.
USER_AGENTmoves fromsrc/oauth/providers.tstosrc/internal/client-identity.ts, next toMODEL_REQUEST_HEADERS.- Both model call paths send the headers per call: judgments (
src/agent/model/sdk.ts) and every act-loop turn (src/agent/tool-loop.ts).
export const MODEL_REQUEST_HEADERS = {
'user-agent': USER_AGENT, // e2e/<version> (<platform>; <arch>)
'http-referer': 'https://tester.army/e2e',
'x-title': 'e2e',
};
- The AI SDK appends its own user agent after ours (
withUserAgentSuffix), so vendors still see the SDK version. http-refererandx-titleare the app attribution headers the Vercel AI Gateway and OpenRouter read. Other vendors ignore them. OpenCode, Codex, and Gemini CLI all send one stablename/version (platform; arch)user agent the same way.- Groundwork for OpenCode Zen and Go, which ask clients to name themselves in the user agent.
Tradeoff: call-level headers win over provider-level ones, so an HTTP-Referer or X-Title a user sets on their provider instance is replaced by ours. Documented in docs/models.mdx and the changeset. If we want an opt-out, it would be a follow-up headers option on the agent entry.
Verified
Ran it locally: yes
Surface: web benchmark agent suite against the built packages, live through the Vercel AI Gateway (--no-cache, every step calls the model).
$ node node_modules/e2e/dist/cli/bin.js run --config e2e.agent.config.ts tests-agent/login-form.e2e.ts --no-cache
✓ act signs in with the benchmark account > agent.act "log in with the given credentials" 5.83s · 3 model calls
Tests 1 passed (1)
$ node node_modules/e2e/dist/cli/bin.js run --config e2e.agent.config.ts tests-agent/planted-bugs.e2e.ts --no-cache
✓ cart totals: a judgment catches the stale order summary
✓ checkout review: a judgment catches the broken copy
✓ wishlist: a judgment catches the lost saved items
Tests 3 passed (3) · 8 model calls
Headers the gateway received on a real judgment call, captured with a logging fetch on createGateway:
url: https://ai-gateway.vercel.sh/v4/ai/language-model
ua: e2e/0.16.0 (darwin; arm64) ai/7.0.107 ai-sdk/provider-utils/5.0.45 runtime/node.js/24
ref: https://tester.army/e2e
title: e2e
tests/unit/model-request-headers.test.ts checks the same headers on the wire against a local server, for a judgment call and an agent.act loop. Both tests fail with the two headers: lines reverted.
Not verified live: the subscription (OAuth) paths. No logins are stored on this machine. There the change is only the import location; tests/unit/oauth/xai.test.ts still asserts the e2e/... user agent.