Repository navigation
Description
Split from #3485.
Problem
litellm_proxy_total_requests_metric_total{end_user="None"} counts gateway requests that name no caller. gateway_caller_headers in src/devops_cli/ai/client/network.py sends the header x-litellm-end-user-id, so only a client that omits the header shows None. Nobody has found that client: these series have user="default_user_id", no key alias and no team, and the gateway logs hold no request lines.
- In the 24 h to 2026-11-05T17:15Z, the series shows about 15
qwen3-embedding:0.6band 5qwen3.8:27brequests. - In the window of fix(k8s): the coder tier serves no second chat model #3485 (2026-11-03T15:05Z to 2026-11-04T15:05Z), 295 of 321
qwen3.8:27brequests had no end-user value. The same label sent all 30gpt-oss:20brequests, and all 30 failed. This is a lead, not a proof.
Expected
Each request to the gateway names its caller, or the gateway refuses it.
Acceptance criteria
- The client that sends no header names itself or gets a refusal, and
litellm_proxy_total_requests_metric_total{end_user="None"}shows 0 over 24 h.
Existing tool considered
The end-user header (#1668). LiteLLM cannot name a caller that omits this header, as the refine proposal of #3485 states.
Related
Proposed design
Problem statement
Some requests reach the gateway with no caller name, so litellm_proxy_total_requests_metric_total counts them as end_user="None". Every client in this repository sends x-litellm-end-user-id, but its value comes from otel_service_name() with no fallback. A process that sets no OTel service name therefore sends an empty value. The change gives the header a non-empty value on every gateway request from this repository.
Acceptance criteria
Requirement: Non-empty end-user value
gateway_caller_headers SHALL return a non-empty x-litellm-end-user-id value for every gateway request.
Scenario: No OTel service name
- WHEN
otel_service_name()returns an empty string - THEN
gateway_caller_headers()returnsx-litellm-end-user-idwith the valuedevops-cli.
Requirement: Every gateway path names its caller
The OpenAI client, the embeddings client and the pydantic-ai gateway client SHALL each send x-litellm-end-user-id with a non-empty value on every gateway request.
Scenario: Recorded request headers
- WHEN each client sends a chat or embedding request to a mock transport
- THEN each recorded request holds
x-litellm-end-user-idwith a non-empty value.
Existing Tool Considered
No alternatives check has run. LiteLLM (BerriAI/litellm, https://github.com/BerriAI/litellm) is the open, maintained tool that covers the need: its x-litellm-end-user-id header sets the end_user label on litellm_proxy_total_requests_metric_total. It lacks a way to name a caller that sends no header or an empty value, so the client must always send a non-empty value.
Key questions
- Which client sends a gateway request with no end-user header?: No client in this repository omits the header.
gateway_caller_headerssetsx-litellm-end-user-idfromotel_service_name()with no fallback, so an empty service name gives an empty header value, and the gateway records it asNone. [sources: src/devops_cli/ai/client/network.py:64, src/devops_cli/ai/client/network.py:80, src/devops_cli/ai/client/openai.py:36, src/devops_cli/ai/rag/embeddings.py, openspec/changes/archive/2026-10-29-1668-gateway-traffic-dashboard/tasks.md:7] - What value names the caller when the process sets no OTel service name?:
gateway_caller_headersreturns the fixed valuedevops-cliforx-litellm-end-user-idwhenotel_service_name()is empty. (best practice) [sources: src/devops_cli/ai/client/network.py:64, src/devops_cli/ai/client/network.py:70]- Chosen: Fixed fallback in
gateway_caller_headers. It names the caller in every process, and one function keeps the rule. - Rejected: Refuse the call with
AIClientError. It stops every CLI call on a workstation that sets no OTel service name. - Rejected: Refuse the request at the LiteLLM gateway. The gateway configuration is outside this repository, so a separate item holds it.
- Chosen: Fixed fallback in
- How does an offline test prove that each gateway client path sends the end-user header?: Each client sends a request to a mock transport, and the test reads the recorded request headers. (best practice) [sources: tests/ai/client/test_gateway_caller_headers.py, tests/ai/client/test_ai_client_network.py]
- Chosen: Mock transport that records request headers. It runs offline and checks the header that the client actually sends.
- Rejected: A live call to the gateway. It needs network access and a running gateway, so it is no offline test.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
devops-cli-service commentedon Nov 5, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(ai)scope of the title gives the scope.Missing end-user headers produce empty metric labels, degrading observability but not breaking functionality.Correct caller attribution in metrics is needed for accurate spend and usage reporting.A single check for the header with a default name or a refusal response is a small change.Both concern naming gateway callers, but the candidate changes gateway request handling while #1668 changes dashboard display of caller names.dan-petty commentedon Nov 5, 2026
Answer from project standards, under the owner's instruction of 2026-11-05.
Question: What does this item ask for? Its body stopped at
{end_user=.Answer: It asks for criterion 4 of #3485: "The client that sends no header names itself or gets a refusal, and
litellm_proxy_total_requests_metric_total{end_user="None"}shows 0 over 24 h."Source of the answer: the acceptance criteria of #3485, its refine proposal, which says that LiteLLM cannot name a caller that omits the end-user header and defers the unnamed caller, and the record
refine.deferredon #3485, which names this item.What I changed
I restored the criterion text and added the problem, the expected result, the existing tool and the related issues from #3485. The first line and the record block have not changed. I did not change the labels.
What I checked at 2026-11-05T17:15Z
end_user="None"shows about 15qwen3-embedding:0.6band 5qwen3.8:27brequests, withuser="default_user_id", no key alias and no team. So the criterion does not hold.gateway_caller_headersinsrc/devops_cli/ai/client/network.pystill sendsx-litellm-end-user-id.For a person
devops roadmap explain 3578says that a refine round does not take this item, because GitHub gives its author the associationCONTRIBUTOR. So onlydevops roadmap refine --item 3578 --confirmrefines it. I did not run that command. I changed no code.devops-cli-service commentedon Nov 6, 2026
Refine cannot set this item to Ready at bd65ef6. A bot opened the item, so a review of the issue and of the proposal must approve it first. The review found the defects below. A person edits the body to answer them. The next refine round looks at the item again only after a body edit.
false_premiseat key_questions[0]: The plan claims that an empty OTel service name causes theNonelabel. No cited file text supports this, becausefilesis empty. The issue says the series come from a client that omits the header. Evidence: "so an empty service name gives an empty header value, and the gateway records it asNone."fix(ai): name the gateway caller when the service name is empty (#3578)
devops-cli-service commentedon Nov 14, 2026
Released in v0.138.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.138.0
devops-cli-service commentedon Nov 14, 2026
Live since 2026-11-14 15:02 UTC