Skip to content

fix(ai): an unknown local gateway group counts as hosted #4886

Closed

Description

@dan-petty

Problem Description

A gateway call that a local group answers counts as hosted when the reply names a model that is not in CONST_AI_GATEWAY_VIRTUAL_MODELS and not an ollama: model. After #4523, is_local makes a gateway call with no backend local only for these names. Two real paths give another name:

  • A local fallback. k8s/llm/gateway/config.yaml sends devops-coder and devops-reasoning to devops-chat when their backend is not available. After a fallback, LiteLLM v1.103.10 keeps the model that answered in the reply: _override_openai_response_model (litellm/proxy/common_request_processing.py) returns early when x-litellm-attempted-fallbacks is above 0. For an Ollama deployment, that model is ollama_chat/qwen3.8:27b in a reply that is not streamed (litellm/llms/ollama/chat/transformation.py) and the bare Ollama model in a streamed chunk.
  • A local group outside the constant. The gateway config has the local groups devops-review, devops-background, devops-triage, qwen3.8:27b and qwen3-embedding:0.6b. CONST_AI_GATEWAY_VIRTUAL_MODELS names only devops-chat, devops-coder, devops-reasoning and devops-embedding. A build_agent run on qwen3.8:27b (the default ai.model) under provider gateway gets a reply that names qwen3.8:27b, and the hook sends it as served_model.

In both paths the record gets local="false" on devops_cli_ai_tokens_total, the pricing source unknown at 0 USD, and the warning for an unpriced hosted model. The AI spend dashboard leaves the tokens out of the local savings.

Reproduction Steps

  1. In a checkout of main with fix(ai): an agent run on a local group counts as hosted #4523, run:
    uv run python -c 'from devops_cli.ai.spend.pricing import is_local; print([is_local(server="llm.example.com:4000", provider="gateway", served_model=m) for m in ("ollama_chat/qwen3.8:27b", "qwen3.8:27b", "devops-review")])'
  2. The output is [False, False, False]. With served_model="devops-chat", the output is True.

Expected vs Actual Behavior

  • Expected: a gateway call that a local group of the gateway config answers is local, with the pricing source local, 0 USD and no warning. A hosted group and an unknown deployment model stay hosted (fix(ai): a hosted gateway call is recorded as a local call at $0 #3656).
  • Actual: the call is hosted at 0 USD with the pricing source unknown and a warning.

Environment Diagnostics

main with #4523. LiteLLM image ghcr.io/berriai/litellm:v1.103.10. The set of local groups lives in k8s/llm/gateway/config.yaml, and the client knows only CONST_AI_GATEWAY_VIRTUAL_MODELS. A fix can name every local group in one constant and add a test that compares it with the gateway config, as tests/ai/spend/test_hosted_group_prices.py does for the hosted groups.

Logs, Traces, or Terminal Output

PromQL, 30 days: sum by (asked, answered) (increase(devops_cli_ai_model_answers_total{asked!~"deepseek.*|claude.*"}[30d])) returned no data on 2026-11-11 (#4523). So no live series shows the defect now.

Pre-Submission Checklist

Source: #4523

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/bug
    scope/ai
    status/new
    value/medium
    effort/low
    on Nov 12, 2026
  3. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/ai. The (ai) scope of the title gives the scope.
    • Priority: P2-Medium. The spend dashboard reports wrong local savings, but no call fails and no data is lost.
    • Value: Medium. Users see incorrect local savings and unpriced-hosted warnings for local groups, which erodes trust in the dashboard.
    • Effort: Low. The fix names the missing local groups in one constant and adds a comparison test, as the body describes.
    • Related: fix(ai): a hosted gateway call is recorded as a local call at $0 #3656, which asks for a different change. Both fix is_local() gateway group classification, but #3656 corrected hosted calls recorded as local while this corrects local calls recorded as hosted.
  4. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor

    New evidence (2026-11-13, read-only investigation of the LiteLLM gateway):

    • devops-cli logged at 2026-11-09T13:17Z: genai-prices and the price overrides hold no price for model qwen3.8:27b under provider litellm. Its requests are recorded at $0 with the pricing source unknown. (1 line in 7 days).
    • The gateway serves devops-review, devops-background, devops-triage, qwen3.8:27b and qwen3-embedding:0.6b, but CONST_AI_GATEWAY_VIRTUAL_MODELS (src/devops_cli/config/constants.py:2823-2828) does not hold them. It holds devops-embedding, which the gateway does not serve.
    • A second effect: the roadmap ladder validator (src/devops_cli/config/settings.py:1196-1208) also reads the constant, so it refuses real local groups. _is_local_tier (src/devops_cli/ai/spend/pricing.py:203-206) reads it too.
    • Request: let the fix of this issue add a test that compares the constant with the model_name entries in k8s/llm/gateway/config.yaml. fix(ai): replace devops-embedding, which the gateway does not serve #5304 needs the same test for the gateway routes, so one test can cover both.
  5. added
    status/in-review
    and removed
    status/new
    on Nov 14, 2026
  6. added 2 commits that reference this issue on Nov 14, 2026
  7. removed
    status/in-review
    on Nov 14, 2026
  8. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-14 15:02 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/aisource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions