Skip to content

fix(ai): analyze --enhanced and ai agents use the ai.tasks.metadata model #1068

Closed

Description

@dan-petty

Problem

ai.tasks.metadata is declared, documented and settable from the environment, but no code reads it. Lines are at release/v0.2.25 (e3ff98c).

  • Declared. AITasksConfig.metadata (src/devops_cli/config/settings.py:415). The option keys are at config/options.py:36-39, and four environment variables at config/env.py:40-43, registered at :129-132 and :377-392. docs/ENV_VARS.md:30-32 lists them as "AI model override for metadata task".
  • Never read. The only for_task calls name analysis, verification, compose, chat and embedding: ai/review/runner.py:1589-1612, ai/run_store.py:149-150, commands/ai.py:1028, :1206, ai/rag/embeddings.py:278 and commands/ai_gateway.py:430. get_llm_client(task) (settings.py:1086-1093) has one caller, with no task (ai/harness/workflow.py:498).
  • The commands it fits use the global settings instead.
    • devops analyze path|branch|pr --enhanced asks a model for each file's metadata (ai/analyze/outlines.py:119, :311). It saves that metadata under data.analysis_dir, documented as the "Storage directory for pre-analysis metadata JSON files" (docs/ENV_VARS.md:44). It builds its client from settings.ai (commands/analyze.py:311, :400, :495).
    • devops ai agents generates AGENTS.md, CLAUDE.md and copilot-instructions.md from the repository, also with settings.ai (commands/ai.py:877).
  • The review's own pre-analysis makes no model call (ai/review/pipeline.py:931-938 passes ai_client=None), so it is not a consumer.
  • People set it anyway. The owner's config.yaml sets ai.tasks.metadata (provider gateway, model devops-chat, context_window: 61440), and none of it is read. It matches the global model today, so only the context window differs.

As a result, the slow-tier plan cannot route these two batch commands to the background tier from config.yaml without moving everything else that reads the global ai.model. A setting that silently does nothing is also a pre-1.0 leftover.

Source: .data/slow-tier-plan-20261003.md, section 4 (analyze --enhanced and ai agents), re-read at e3ff98c.

Acceptance criteria

  • devops analyze path, branch and pr with --enhanced build their client from settings.ai.for_task("metadata") (commands/analyze.py:311, :400, :495).
  • devops ai agents builds its client from settings.ai.for_task("metadata") (commands/ai.py:877).
  • With ai.tasks.metadata unset, both use the global ai settings as today. A test pins that.
  • A test sets DEVOPS_CLI_AI_TASK_METADATA_MODEL=devops-background and runs devops analyze path <tmp> --enhanced and devops ai agents with LLMClient patched to record its config. Both record devops-background. The test fails on the current code.
  • The descriptions at config/env.py:377-392 (and so docs/ENV_VARS.md:30-32) name the commands: "for analyze --enhanced and ai agents".
  • The tests run offline, call no model, and each runs in under 1 s.
  • uv run devops ci passes.

Key questions

  • Wire the setting, or delete it? (proposed) Wire it. The code already has the setting, its four environment variables, its options and its docs. The name fits what analyze --enhanced writes: per-file metadata into the analysis directory. Wiring it is three call sites in analyze.py and one in ai.py. Deleting it would leave the global ai.model as the only way to move these batch commands, and that also moves ai pipeline, the pydantic-ai bridge and every other settings.ai reader.
  • Is ai agents a metadata task? (proposed) Yes, for routing. Like analyze --enhanced, it is a batch job that describes the repository, and the slow-tier plan routes both to the background tier. Leaving it on the global settings would need a second task slot for one command.
  • Does DEVOPS_CLI_AI_TASK_METADATA_REASONING_EFFORT need a docs row? (proposed) Not here. It is registered at env.py:42 and :131, but not in the docs table. The generated docs are fix(docs): generated docs mask non-secret defaults and hide off flags, and docs name things that do not exist #956's.
  • Is this P1? (proposed) No, P2. Nothing breaks today, and DEVOPS_CLI_AI_MODEL=devops-background already routes one run.

Depends on: none.
Order: #840 (v0.2.27) changes devops ai agents so it never overwrites AGENTS.md, in commands/ai.py. #1000 makes the settings field the one declaration of its env name and description. Whichever lands second rebases.
Related:

Activity

  1. added
    type/bug
    scope/ai
    scope/config
    priority/p2-medium
    on Oct 3, 2026
  2. dan-petty commented on Oct 8, 2026

    @dan-petty
    OwnerAuthor

    Linked: #1001, whose one client factory replaces these four constructions (commands/analyze.py:312, :401, :489, commands/ai.py:864); whichever lands second keeps the metadata task. Found by the 2026-10-08 backlog review.

  3. added a commit that references this issue on Oct 24, 2026
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

    priority/p2-mediumscope/aiscope/configtype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions