Skip to content

fix(k8s): the ConfigMap template names the reference models #4241

Closed

Description

@dan-petty

Problem

On 2026-11-09 the owner decided that the spend reports value local AI tokens at the hosted prices of qwen3.8:27b (chat; OpenRouter quote 0.035 USD input and 1.50 USD output per million tokens) and qwen/qwen3-embedding-8b (embeddings; 0.01 USD per million tokens).

The live ConfigMap devops-cli-config holds ai.reference_model: qwen3.8:27b and ai.reference_embedding_model: qwen/qwen3-embedding-8b, applied by hand. The template k8s/devops/configmap.example.yaml does not name them. devops k8s deploy-stack renders the template, so the next deploy removes the two lines. The Service then values local tokens at the defaults gpt-4o and text-embedding-3-small again. The Service ledger showed 2,361 USD hosted equivalent at gpt-4o against about 60 USD at qwen3.8:27b.

Evidence (2026-11-09): render_active_devops_configmap against the live ConfigMap differs in three keys only: ai.reference_model, ai.reference_embedding_model (live only; this issue) and ai.tasks.stage (live only; a deliberate pause that the lead removes after #4228 merges).

Expected

  • The template names both reference models with a comment: the owner decision of 2026-11-09, the two prices, and why (genai-prices does not know both names, so the Service keeps the prices in an override).
  • The key-walk test of fix(k8s): check that the example ConfigMap keys are settings #4093 and the template tests still pass.
  • Where the price comes from is a separate point. Today the price is the file pricing_overrides.json in /home/devops/.data/ai/ on the PVC roadmap-service-home, written by hand with devops ai cost set-price in the pod. genai-prices (0.1.13) returns LookupError for both names, so without the file the reports show no savings and log an unpriced warning. A new PVC loses the file. The repository-owned price needs new code (a setting that holds the price, read by PricingRegistry); it is split to a second issue and not built here.

Acceptance criteria

  • grep -c 'reference_model: qwen3.8:27b' k8s/devops/configmap.example.yaml prints 1 (prints 0 today).
  • grep -c 'reference_embedding_model: qwen/qwen3-embedding-8b' k8s/devops/configmap.example.yaml prints 1 (prints 0 today).
  • uv run devops ci test tests/k8s/test_k8s_configmap.py passes with a new test that renders the template and expects both values under ai (fails today).
  • uv run devops ci test tests/k8s/test_k8s_configmap_keys.py passes.

Existing tool considered

The settings ai.reference_model and ai.reference_embedding_model already exist (src/devops_cli/config/settings.py), and so does devops ai cost set-price. No new tool is needed for the template. For the price source: devops ai cost update-pricing --source <file> also writes to the data volume (pricing_snapshot.json), so it does not remove the hand step.

Cost

About 40,000 tokens to build and review; a few minutes of CI under the shared lock. Keeping it costs nothing. The price of not doing it: wrong Service spend reports after the next deploy.

Related

#3665, #3658

Proposed design

Problem statement

The live ConfigMap names the reference models qwen3.8:27b and qwen/qwen3-embedding-8b, applied by hand. The template k8s/devops/configmap.example.yaml does not name them. The next devops k8s deploy-stack removes both keys, and the Service then values local tokens at the defaults gpt-4o and text-embedding-3-small. The spend reports then show wrong savings (2,361 USD against about 60 USD).

Acceptance criteria

Requirement: Template names the chat reference model

The template k8s/devops/configmap.example.yaml MUST set ai.reference_model to qwen3.8:27b, once.

Scenario: Chat reference model in the template

  • WHEN The test renders the template with render_active_devops_configmap and reads the ai section
  • THEN ai.reference_model equals qwen3.8:27b, and the file holds exactly one line with 'reference_model: qwen3.8:27b'

Requirement: Template names the embedding reference model

The template k8s/devops/configmap.example.yaml MUST set ai.reference_embedding_model to qwen/qwen3-embedding-8b, once.

Scenario: Embedding reference model in the template

  • WHEN The test renders the template with render_active_devops_configmap and reads the ai section
  • THEN ai.reference_embedding_model equals qwen/qwen3-embedding-8b, and the file holds exactly one line with 'reference_embedding_model: qwen/qwen3-embedding-8b'

Requirement: Template comment states the decision

The template SHALL carry a comment that names the owner decision of 2026-11-09, the two prices, and the reason that the Service keeps the prices in an override.

Scenario: Comment above the two keys

  • WHEN A reader opens the template at the two reference model keys
  • THEN The comment names the decision date, 0.035 and 1.50 USD per million tokens for chat, 0.01 USD per million tokens for embeddings, and that genai-prices does not know both names

Requirement: Key walk and template tests stay green

The change MUST keep tests/k8s/test_k8s_configmap_keys.py and tests/k8s/test_k8s_configmap.py passing.

Scenario: Both test files run

  • WHEN uv run devops ci test runs the two test files
  • THEN Both files pass, and unknown_setting_keys of the rendered template returns an empty list

Existing Tool Considered

No new tool is needed. The settings ai.reference_model and ai.reference_embedding_model already exist in src/devops_cli/config/settings.py, and so does devops ai cost set-price. devops ai cost update-pricing --source <file> also writes to the data volume, so it does not remove the hand step for the price. This change adds two keys and one test and builds no code. The cost is about 40,000 tokens to build and review, plus a few minutes of CI. Keeping it costs nothing.

Key questions

  • Do the two keys already exist as settings, so that the key-walk test accepts them?: Yes. AIConfig declares reference_model and reference_embedding_model, so unknown_setting_keys reports nothing for them and the template needs no code change. [sources: src/devops_cli/config/settings.py, tests/k8s/test_k8s_configmap_keys.py]
  • Does the render keep the ai section of the template as it is?: Yes. render_active_devops_configmap changes only the service block, so the two keys in the ai section reach the rendered ConfigMap. [sources: src/devops_cli/k8s/configmap.py, tests/k8s/test_k8s_configmap.py]
  • Where do the keys and the comment go in the template, and how does the comment avoid a second grep match?: Put both keys in the ai block, after max_retries and before tasks, with one comment block above them. Write the comment so that no comment line holds the strings 'reference_model: qwen3.8:27b' or 'reference_embedding_model: qwen/qwen3-embedding-8b'. Then each grep -c prints 1. (best practice) [sources: k8s/devops/configmap.example.yaml]
    • Chosen: Keys in the ai block with a comment that does not repeat the key text. It keeps each grep count at 1 and follows the style of the other comments in the template.
    • Rejected: A new top-level section for the reference models. The settings live under ai, so a new section would be an unknown key.
  • How does the new test check the values?: Add one test in tests/k8s/test_k8s_configmap.py. It renders the repository template with render_active_devops_configmap and k8s_dir=REPO_ROOT / 'k8s', validates the inner config with Settings.model_validate, and compares ai.reference_model and ai.reference_embedding_model with the two names. (best practice) [sources: tests/k8s/test_k8s_configmap.py]
    • Chosen: Render the repository template and validate with Settings. It follows the existing tests of the repository template and fails today.
    • Rejected: A text match on the template file. It does not check that the key sits under ai and loads into Settings.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/k8s
    status/new
    value/medium
    effort/low
    on Nov 9, 2026
  2. dan-petty commented on Nov 9, 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/k8s. The (k8s) scope of the title gives the scope.
    • Priority: P2-Medium. The next deploy silently reverts the reference models and produces wrong spend reports, but the Service keeps running.
    • Value: Medium. Corrects the financial basis of spend reports after each deploy without breaking the Service.
    • Effort: Low. Add two YAML keys with a comment and one render test; no new code path.
    • Related: fix(k8s): the ConfigMap template names Sonnet for analysis #4208, which asks for a different change. Both add a hand-set ConfigMap key to configmap.example.yaml so deploy-stack does not remove it, but #4208 names the analysis model while this names the reference models.
  3. added
    priority/p2-medium
    owner/agent
    on Nov 9, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 9, 2026
  5. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at f9e47b7 (see proposed design in issue body).

    Moved to new items: #4244.

  6. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 9, 2026
  7. removed
    status/in-review
    owner/agent
    on Nov 9, 2026
  8. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-09 17:57 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/k8ssource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions