Skip to content

feat(review): per-model review quality baseline for the devops-review pool #475

Closed

Description

@dan-petty

Context & Rationale

devops-review serves every review call from two models. That covers persona review and verification alike (k8s/llm/gateway/configmap.yaml:89-108).

Model Tier (weight) KV cache (k8s/llm/profiles/ollama-profiles.yaml)
qwen3-coder:30b ollama-48gib (9), ollama-64gib (6) q8_0 on both (:366-367, :469-470)
gpt-oss:20b ollama-16gib (8), ollama-24gib (1) q4_0 on 16gib (:61-62), q8_0 on 24gib (:162-163)

gpt-oss:20b holds 9 of the 24 weight units.

  • Weights track throughput only. The gateway routes by weight (simple-shuffle, configmap.yaml:170-172). devops ai gateway tune sets each weight from the deployment's best request rate (src/devops_cli/ai/gateway_tune.py:167-190).
  • Quality matters more than speed. A faster model that reports more false positives, or misses defects, costs more than it saves, because verification checks every finding.
    • feat(ai): llm gateway weights validated against real reviews #476 found that faster weights reported more findings, including top-severity false positives that passed verification.
    • It could not tell which model produced them, so it left the question to this item (docs/agent/tasks/task-476-llm-gateway-weights-validated-against-real-reviews.md).
  • Nothing measures quality per model.
    • No finding records its model. Finding/SavedFinding, ReviewSessionPayload, FeedbackRecord and CommonHallucinationEntry have 69 fields between them, and none names a model or backend (model_fields at ef21785).
    • The spend ledger stores the requested group, not the model that answered (src/devops_cli/ai/client/unified.py:443).
    • served_by comes from the gateway's x-litellm-model-api-base header (src/devops_cli/config/constants.py:1710, read at src/devops_cli/ai/client/openai.py:174,204). It names a tier, not a model. profile.json counts calls per tier per stage (src/devops_cli/ai/review/profile.py:202-204).
  • Pinning one model per run is the clean measurement. Three things prevent it today.
    • gpt-oss:20b has no group of its own. The ollama/* pass-through route left the configmap in feat(k8s): modernize monitoring stack, llm profiles, traefik routing, and remove squid proxy #734 (fdd4d0f).
    • devops-coder reaches qwen3-coder:30b alone (configmap.yaml:44-47), but it falls back to devops-chat (:184). devops-chat's qwen3.8:27b also runs on ollama-48gib (:31-32), so served_by cannot show the switch.
    • Verification cannot be pinned from the shell.
      • Environment overrides apply only through OPTION_TO_ENV_VAR (src/devops_cli/config/settings.py:715-733). load_settings builds settings with model_validate (:844), which reads no environment.
      • The map has DEVOPS_CLI_AI_TASK_ANALYSIS_MODEL (src/devops_cli/config/env.py:45, :128-131) but no entry for ai.tasks.verification (:98-175).
      • Reviews layer a set verification override on the analysis task (src/devops_cli/ai/review/runner.py:1539-1556). The workstation's project config sets ai.tasks.verification.model: devops-review. So an arm that sets only the analysis model still verifies on the whole pool.
      • A probe at ef21785 also showed that the nested form DEVOPS_CLI_AI__TASKS__ANALYSIS__MODEL is ignored: analysis stayed devops-review.
  • Scanner hits count as model recall.
    • devops review path has --no-static-scan (src/devops_cli/commands/review.py:210-213). devops review benchmark (:1333-1401) does not pass it through.
    • Scanner findings carry no producer (_wrap_static_findings, src/devops_cli/ai/review/pipeline.py:432-441), and the run's model verifies them (:2586-2590). So a scanner hit on an injected defect scores as found in every arm.
  • Arms would share on-disk state.
    • Pre-analysis metadata is cached by file content in data.analysis_dir (src/devops_cli/ai/analyze/cache.py:48-54). Reviews load it without force_refresh (runner.py:2023-2029, pipeline.py:1527). benchmark's no_cache turns off only the response cache (commands/review.py:1377). So the second arm would review with metadata the first arm's model wrote.
    • corpus score picks sessions by target from the whole reviews dir (commands/review.py:1494-1509). review stats, export-feedback and the feat(review): track false-positive rate across runs #434 baseline add up every session directory (feat(review): subject-keyed review history with a leave-one-out baseline #607). One shared dir mixes the arms and pollutes review history.
  • The pool is all Ollama now. feat(k8s): modernize monitoring stack, llm profiles, traefik routing, and remove squid proxy #734 (fdd4d0f) removed the vLLM deployments that served Qwen2.5-Coder 32B and 14B.
  • The cluster can run this today.
    • On 2026-10-01, kubectl get pods -n llm showed the gateway and all four tiers running. ollama-48gib had 40 restarts, the last one 15 h earlier.
    • The live llm-gateway-config matched configmap.yaml:89-108.

Scope & Deliverables

Deliverable:

  1. Per-model gateway groups.
    • Add qwen3-coder:30b and gpt-oss:20b to k8s/llm/gateway/configmap.yaml. Each copies that model's devops-review entries exactly: the same model, api_base and weight, no model_info, and no fallback. With enable_pre_call_checks on (:180), any extra max_input_tokens would route differently from the pool.
    • This follows the existing per-model groups gemma4:31b and qwen3.8:27b (:110-151).
    • Add one line about them to the gateway section of k8s/README.md.
  2. Verification task environment overrides. Add DEVOPS_CLI_AI_TASK_VERIFICATION_PROVIDER, _MODEL, _REASONING_EFFORT and _OLLAMA_URLS for ai.tasks.verification.*. They mirror the analysis task's: the option names (src/devops_cli/config/options.py:40-43), the map (env.py:128-131) and the EnvVarSpec entries (env.py:383-399).
  3. devops review benchmark --no-static-scan, passed through to every run and recorded in the run's setup.
  4. The measurement. A person runs the commands below. For each model, run feat(ai): model-in-the-loop prompt benchmarking #413's repeated-run report over one fixed synthetic corpus. Personas, k and the corpus are the same in both arms. Each arm has its own reviews and analysis directories.
  5. Results and decision.
    • A results table per model in the task file.
    • The decision on a quality factor, made by the rule under Key questions.
  6. Docs.
    • Rewrite docs/agent/tasks/task-475-per-backend-review-quality-baseline.md. It is stale: it names v0.2.24 and three models.
    • Mark the roadmap entry (docs/ROADMAP.md:309-312) as delivered.
    • Replace its "Review Findings Carry Their Producer" extension (:313-317) with links to the split-off issues.
    • Run devops docs generate --sync-readme, which regenerates docs/CLI_REFERENCE.md and docs/ENV_VARS.md.

Acceptance criteria:

  • Offline, inside uv run devops ci:
    • A file-only test in tests/test_k8s_llm_gateway.py asserts three things:
      • each per-model group's entries, as (model, api_base, weight) in order, equal that model's devops-review entries;
      • neither group's entries carry model_info or any litellm_params key beyond those three;
      • neither group appears in fallbacks or context_window_fallbacks.
    • test_gateway_configmap_virtual_models (:86-116) lists both new groups.
    • A test in tests/test_config_env_overrides.py writes a tmp config whose ai.tasks.verification.model is devops-review, as the test at :10 does. It sets DEVOPS_CLI_AI_TASK_ANALYSIS_MODEL and DEVOPS_CLI_AI_TASK_VERIFICATION_MODEL to gpt-oss:20b and asserts, with no network:
      • load_settings().ai.tasks.verification.model is gpt-oss:20b;
      • the verification client that _make_review_clients builds has model gpt-oss:20b and the analysis task's provider (as in tests/test_review_verification_task.py:52-65);
      • with gateway_pool stubbed, review_setup()["models"] names gateway/gpt-oss:20b for both analysis and verification.
    • A CLI test modeled on test_a_review_benchmark_is_kept_with_its_setup_and_corpus (tests/test_run_store.py:247) asserts that review benchmark --no-static-scan -n 2 passes no_static_scan=True to both path calls and records it in the run's setup. Without the flag, both calls get False.
    • All assertions are structural tuple assertions. The new tests add under 1 s in total, checked with pytest --durations. uv run devops ci passes.
  • Live (a person runs these and pastes the output into the PR):
    • After the configmap is applied, uv run devops ai gateway routes lists both groups with their four deployments.
    • Every run record of an arm names that arm's group for both analysis and verification (uv run devops ai runs show <id>).
    • In every session's profile.json, every stage's backends names only that arm's tiers. This shows no call fell back to another model, and that verification did not reach the pool.
    • The first session of each arm shows LLM calls in its pre_analysis stage, so the arm wrote its own metadata.
    • The task file's results table cites a run ID for every figure. For each model it gives:
      • found and reported counts per injection, with pass^k, pass@k and found-in-none (feat(ai): model-in-the-loop prompt benchmarking #413);
      • candidates by verdict;
      • reported findings that match no injection, by severity, labelled "unlabelled" and not called false positives;
      • unparsed persona replies;
      • median seconds per candidate, and tokens.
    • The PR states the decision and the rule that produced it. If a factor is warranted, it links the follow-up issue.

Person-run commands, from the branch before merge, with DEVOPS_CLI_DATA_DIR unset (it takes precedence over the reviews dir, src/devops_cli/ai/review/review_environment.py:97-110). #413 sets <sources>, <seed> and <k>; today's defaults are seed 1 and k 3. Directory names carry no colons, because the workspace may sit on a Windows share.

kubectl apply -f k8s/llm/gateway/configmap.yaml
kubectl -n llm rollout restart deployment/llm-gateway && kubectl -n llm rollout status deployment/llm-gateway
uv run devops ai gateway routes
kubectl get pods -n llm                                   # note restart counts
uv run devops review corpus generate <sources> --seed <seed> --out .data/475/corpus
for arm in qwen3-coder=qwen3-coder:30b gpt-oss=gpt-oss:20b; do
  name=${arm%%=*} model=${arm#*=}
  # Own sessions and pre-analysis cache per arm, kept out of review stats and the #434 baseline.
  export DEVOPS_CLI_DATA_REVIEWS_DIR="$PWD/.data/475/$name/reviews" DEVOPS_CLI_DATA_ANALYSIS_DIR="$PWD/.data/475/$name/analysis"
  export DEVOPS_CLI_AI_TASK_ANALYSIS_MODEL=$model DEVOPS_CLI_AI_TASK_VERIFICATION_MODEL=$model
  uv run devops review benchmark .data/475/corpus/files --all --no-static-scan -n <k>
  uv run devops review corpus score .data/475/corpus      --runs <k>   # #413's repeated-session score of this arm's k sessions
done
kubectl get pods -n llm                                   # restart counts unchanged

Key questions:

  • Measure per model or per tier? Per model (proposed).

    • The weights question is between two models.
    • Each arm spreads its calls over its tiers with the pool's weights, so gpt-oss:20b is measured mostly on ollama-16gib, as the pool serves it. profile.json records the tier of every call.
    • If gpt-oss:20b comes out worse, a follow-up compares ollama-16gib (q4_0 KV cache) with ollama-24gib (q8_0) before any weight change.
  • How is each arm pinned? Through the per-model gateway groups (proposed). This is the same path reviews take. Two alternatives were rejected:

    • devops-coder falls back to a different model on the same tier.
    • Direct Ollama calls take a different client path from production.

    The groups stay in place afterwards, so feat(review): review page size against quality and speed #480 and later candidate models can reuse them.

  • How does an arm select its group for both tasks? With DEVOPS_CLI_AI_TASK_ANALYSIS_MODEL and the new DEVOPS_CLI_AI_TASK_VERIFICATION_MODEL (proposed). A per-arm file through DEVOPS_CLI_CONFIG was rejected: it replaces the whole project config layer, gateway settings included.

  • Why pin, rather than attribute findings in pool runs? Findings carry no model today. Pinning needs no schema change, and it measures each model end to end, generating and verifying (proposed). Attributing each finding is a split-off.

  • Where does false-positive ground truth come from? Not from the arm's own verifier (see Constraint). No human verdicts exist yet (feat(ai): model-in-the-loop prompt benchmarking #413 counted 0 of 2,237 findings), and feat(ai): model-in-the-loop prompt benchmarking #413 splits agreement with human verdicts off to the backlog, so this item decides on recall against the injected defects alone (proposed). Reported findings that match no injection are counted by severity but not called false positives, because the corpus source can hold real defects.

  • Corpus, personas, k and temperature? Use feat(ai): model-in-the-loop prompt benchmarking #413's corpus and k, so a model difference sits on the same scale as a prompt difference (proposed).

  • Do the arms share pre-analysis metadata? No (proposed). Each arm has its own analysis directory. Its first run writes metadata with its own model, and its later runs reuse it, as production does.

  • Decision rule? Fixed before the runs (proposed). A quality factor is warranted when one model's reported recall (pass@k) is below the other's by more than the run-to-run spread feat(ai): model-in-the-loop prompt benchmarking #413 reports for either arm.

    Otherwise weights stay throughput-only, and the task file says so. Unlabelled findings do not enter the rule. The task file reports them by severity beside the outcome, since feat(ai): llm gateway weights validated against real reviews #476's concern was extra top-severity findings.

  • Does this PR change the devops-review weights? No (proposed). A pool change alters every review.

  • Do the arm sessions pollute review history? They would in the default reviews dir (feat(review): subject-keyed review history with a leave-one-out baseline #607). Each arm sets DEVOPS_CLI_DATA_REVIEWS_DIR to its own directory (proposed; src/devops_cli/config/settings.py:741-744). That also keeps each arm's corpus score to its own sessions.

  • What about other models (gemma4:31b, qwen3.8:27b, deepseek-r1:70b)? Out of scope (proposed). Their groups already exist, so the same commands can measure them later.

  • Does the gate run any of this? No. Live-model runs stay on demand, as feat(ai): model-in-the-loop prompt benchmarking #413 requires, and every test is offline.

Constraint:

  • Ground truth must not come from the verifier being measured (feat(ai): model-in-the-loop prompt benchmarking #413).
  • The synthetic corpus measures regression, not capability, and the results table must say so (SYNTHETIC_CAVEAT, src/devops_cli/ai/review/defects.py:41).
  • No new dependencies.
  • Tests never touch the network or the cluster. They add at most 1 s to the gate.

Strategic Alignment

Activity

  1. added this to the v0.2.23 milestone on Sep 24, 2026
  2. added
    type/feature
    scope/review
    priority/p1-high
    on Sep 24, 2026
  3. modified the milestones: v0.2.23, v0.2.24 on Sep 28, 2026
  4. added a commit that references this issue on Sep 28, 2026
  5. modified the milestones: v0.2.24, v0.2.23 on Sep 30, 2026
  6. modified the milestones: v0.2.23, v0.2.25 on Oct 1, 2026
  7. dan-petty commented on Oct 1, 2026

    @dan-petty
    OwnerAuthor

    Retargeted from the shipped v0.2.23 to v0.2.25. It is still valid (checked 2026-10-01), and a P1 left open in a shipped release keeps precedence over P1 work committed later.

  8. changed the title [-]feat(review): per-backend review quality baseline[/-] [+]feat(review): per-model review quality baseline for the devops-review pool[/+] on Oct 1, 2026
  9. dan-petty commented on Oct 2, 2026

    @dan-petty
    OwnerAuthor

    Closed by #962, merged into release/v0.2.25.

    GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by devops gh issues close-merged.

  10. added a commit that references this issue on Oct 3, 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/p1-highscope/reviewtype/feature

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions