Repository navigation
Description
Problem
Several model settings either never reach the model or reach it without a trace, and a review cannot tell which. Lines are at release/v0.2.25 (e3ff98c).
1. num_ctx changes page size on the gateway path but never reaches the server.
num_ctxis a field ofAIConfigandAITaskOverride(src/devops_cli/config/settings.py:403,:436).- The native Ollama client sends it (
ai/client/ollama.py:308-312). The gateway and OpenAI-compatible payload carries onlymax_tokens,temperatureandtop_p(ai/client/openai.py:66-79). get_context_windowprefersnum_ctxovercontext_window(ai/client/unified.py:308-316), and the review sizes pages from it (ai/review/pipeline.py:2665).- So setting
ai.tasks.analysis.num_ctxsilently changes the page size, and the server still sizes its KV cache fromOLLAMA_CONTEXT_LENGTH×OLLAMA_NUM_PARALLEL. On 2026-10-03 that sizing (-c 512000 -np 4on the 48 GiB tiers) kept gemma4:31b from loading on condor and hog (cudaMalloc ... out of memory,failed to create MTP context) [measured: Ollama logs, 05:30–05:46]. fix(k8s): every ollama tier keeps one model loaded and serves one request at a time, so its kv cache holds one context #1061 has since cut the multiplier to 1.
2. Six sampling and serving keys are dropped without a word. top_k, min_p, presence_penalty, repeat_penalty, think and keep_alive are not fields of AIConfig or AITaskOverride. Pydantic ignores unknown keys by default, so ai.tasks.analysis.top_k: 20 validates and does nothing [measured offline by the model-choice evaluation]. These values can only come from a gateway deployment's litellm_params or from the Ollama tag's params.
3. Streamed devops ai chat sends no sampling at all. _apply_standard_params returns before it sets temperature or top_p when the call streams (openai.py:72-73). devops ai chat streams whenever tools are off (commands/ai.py:1090, :941). The configured chat sampling reaches only non-streamed calls.
4. Sampling cannot be left to the model. AIConfig.temperature and top_p are plain floats (settings.py:433-434; defaults 0.1 and 0.95, config/defaults.py:70-71), and a task override applies only values that are set (settings.py:494-511). Every non-reasoning request therefore overrides the Ollama tag's values with something. The tags already carry the model cards' values: qwen3-coder:30b's params are temperature 0.7, top_p 0.8, top_k 20 and repeat_penalty 1.05 [sourced: registry.ollama.ai params blob for qwen3-coder:30b; https://huggingface.co/Qwen/Qwen3-Coder-30B-A3B-Instruct].
5. Review sessions do not record sampling. review_setup records each task's temperature and top_p (ai/run_store.py:140-161), but only benchmark, corpus-score and sample-validation runs call it (commands/review.py:1430, :1783, :2021). Branch and path reviews write no sampling to profile.json. The qwen3-coder baseline (S9 20261003-021501, S10 20261003-034353, and the R2 recall runs) ran before the owner changed analysis and verification to 0.7 / 0.8 (config.yaml edited at 04:58Z). No record says which values those runs used, so the effect of the change cannot be measured from the sessions.
6. The reply cache key leaves out sampling. LLMResponseCache.generate_key hashes the provider, model, system prompt, messages and options (ai/response_cache.py:166-197). The client passes only {"enable_thinking": ...} as options (unified.py:707-726). A review after a sampling change, run without --no-cache, replays replies made with the old values for every unchanged page, for the cache's 7-day TTL. The model-choice evaluation had to tell the owner to run the first review after the change with --no-cache.
Not in this item:
- How
enable_thinking=Falsemaps tothink: trueon the gateway path is fix(ai): reasoning request parameters follow the model's declared capability, not its name #888's (comment there). - Which reply the cache may store is fix(review): a group-analysis reply that fails its checks is neither cached nor served #1013's (comment there).
- Model residency and
keep_aliveare feat(ai): ollama model residency per-pod model budget, keep-alive, ms/token #598's and fix(k8s): ollama-48gib-slow keeps its embedding model and qwen3-coder loaded and leaves every interactive pool, so a review no longer evicts the embedder #1064's.
Source: .data/model-choice-20261003.md, section 3 ("What the pipeline can't pass today"), and its verification pass, which corrected num_ctx (a declared field, not dropped). The lines were re-read at e3ff98c.
Acceptance criteria
-
num_ctxis refused where it cannot be sent. A client for thegatewayprovider or an OpenAI-compatible provider raises a configuration error naming the task when its resolved config setsnum_ctx. The error says that the server's context comes from the tier'sOLLAMA_CONTEXT_LENGTH, and thatcontext_windowsizes pages. The native Ollama client still sends it. A test covers both providers. - Unknown keys under
aiandai.tasks.<task>fail validation. The error names the key. For the six keys above, it also says where they belong: a gateway deployment'slitellm_paramsor the Ollama tag. A test loadsai.tasks.analysis.top_k: 20and gets the error. It fails on the current code, which accepts it. - Streamed calls send the same sampling as unstreamed ones.
_build_compat_payload(..., stream=True)includestemperatureandtop_p. A test pins it and fails on the current code. - Sampling can be left to the model.
AIConfigandAITaskOverridegainuse_model_sampling: bool | None, inherited like the other overrides. When it is true, no request for that task carriestemperatureortop_p, on either the gateway or the native Ollama path. Tests cover a task that sets it and a task that inherits it. - Every review session records its sampling. Branch, path and PR reviews write
review_setup()'smodelsandsamplingintoprofile.json, plusreasoning_effort, the reply cap anduse_model_samplingfor each task (analysis, verification and compose). A value the client does not send is written asnull. A test runs a path review with a fake client and reads them back. - The reply cache key includes what the client sends. The cache options carry the request's
temperature,top_p,reasoning_effortand reply cap, besideenable_thinking. A test makes two calls with the same messages and temperatures 0.7 and 1.0, and gets two keys and two model calls. It fails on the current code. -
docs/CONFIGURATION.mdand the knowledge base say which settings reach the model on which provider, and that per-model sampling (top_k,repeat_penalty,presence_penalty,min_p,think) lives in the gateway deployment or the Ollama tag. - The tests run offline, call no gateway, Ollama or model, and each runs in under 1 s.
-
uv run devops cipasses. - (person-run) Run one pinned review after the change. Its
profile.jsonshows 0.7 / 0.8 for analysis and verification. A second review of the same commit with temperature 1.0 makes model calls for every page instead of replaying the first review's replies.
Key questions
- Why not add
top_k,min_p,presence_penaltyandrepeat_penaltyas config fields? (proposed) They belong to a model, and a task can route to a group that mixes models:devops-reviewserves qwen3-coder and gpt-oss. A gateway deployment'slitellm_paramsis per model and per host, and the Ollama tags already carry the cards' values. Refusing the keys stops the silent drop without adding a second place to set them. - Why refuse
num_ctxon the gateway path instead of sending it? (proposed) A request whosenum_ctxdiffers from the loaded runner's makes Ollama reload the model [inference from Ollama's scheduler; to confirm in the PR from its source]. With one model and one slot per tier (fix(k8s): every ollama tier keeps one model loaded and serves one request at a time, so its kv cache holds one context #1061), every task that sent its own value would reload the tier's model in front of the queue. Server context is set per tier ink8s/llm/profiles/ollama-profiles.yaml. - Will refusing unknown keys break existing configs? (proposed) It may, which is the point before 1.0. The owner's
config.yamlhas one unknown key underai,lightllm_url, which nothing reads; it would have to go. Strictness for the rest ofSettingsis refactor(config): a settings field is the one declaration, and the option, env and config-show registries become views of it #1000's (one declaration per setting). - Why
use_model_samplingrather than allowingtemperature: null? (proposed) In a task override, null already means "inherit fromai", so it cannot also mean "send nothing". A separate flag keeps both meanings. - Should the cache key include the served model? (proposed) No. fix(review): a group-analysis reply that fails its checks is neither cached nor served #1013 already answers that, and the client does not know the served model before the call.
- Should the session record what the gateway applied (tag params,
think)? (proposed) No. The client records what it sent. What the gateway or the tag adds is visible only on the server side. - Why P2? (proposed) The gaps cost measurement more than quality today. qwen3-coder's tag already carries its card's
top_kandrepeat_penalty, the owner sets temperature and top_p per task, and fix(k8s): every ollama tier keeps one model loaded and serves one request at a time, so its kv cache holds one context #1061 fixed the server's context sizing. The cache replay and the missing sampling record make model comparisons untrustworthy until they are fixed.
Depends on: none.
Order:
- fix(review): a group-analysis reply that fails its checks is neither cached nor served #1013 (v0.2.29) and fix(ai): response-cache hits are counted as cached requests #816 (v0.2.29) edit the cache lookup and key construction in
ai/client/unified.py; whichever lands second rebases. - fix(ai): streamed
devops ai chatturns send the user's message #874 (v0.2.27) edits the streamed chat turn incommands/ai.py; this item edits only the payload inopenai.py. - fix(ai): reasoning request parameters follow the model's declared capability, not its name #888 edits
_build_compat_payload's reasoning branch; this item edits the standard branch. - refactor(config): a settings field is the one declaration, and the option, env and config-show registries become views of it #1000 moves setting declarations.
Related:
- fix(ai): reasoning request parameters follow the model's declared capability, not its name #888: thinking and reasoning parameters.
- fix(review): a group-analysis reply that fails its checks is neither cached nor served #1013: which replies the cache stores.
- feat(review): every reported finding is admitted with its producer's anchor and a location that exists in the reviewed commit, the review writes findings.sarif, and review.md shows findings and suppressions #871: findings record their producer ("record no temperature the client did not send").
- feat(ai): ollama model residency per-pod model budget, keep-alive, ms/token #598: residency and
keep_alive. - fix(k8s): every ollama tier keeps one model loaded and serves one request at a time, so its kv cache holds one context #1061: one slot per tier.
- feat(review): per-model review quality baseline for the devops-review pool #475: pinned model comparisons.
Update 2026-10-08: refinement
The six gaps stand.
- Folded from the 2026-10-08 comment: streamed and unstreamed native Ollama requests carry the same
optionsand trace headers (ai/client/ollama.py:457-480sends neither); aMockTransporttest fails today.
If refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001 lands first, the payload criteria apply to the seam'sModelSettings, andnum_ctxis refused where it cannot be sent. fix(review): a group-analysis reply that fails its checks is neither cached nor served #1013 is frozen.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn Review
Activity
dan-petty commentedon Oct 3, 2026
Review redesign (#1137, 2026-10-03): this item is a child kept whole. It serves #1147 (sampling recorded for each explanation job) and phase P3's job keys (P3-7). #479's per-deployment
reasoning_effortandmax_tokensmove here or to #888 before #479 closes.dan-petty commentedon Oct 8, 2026
Addition from the 2026-10-08 client-library audit (checked at release/v0.2.29, 05e9388).
The native Ollama streamed request,
_ollama_stream_request(ai/client/ollama.py:451-461), sends nooptions(num_ctx,num_predict,temperature,top_p) and no trace-context headers. The unstreamed request sends all of them (:287-304). So a streamed Ollama call drops the configured sampling, the context size and the reply cap set bylimit_completion_tokens.This item's streaming criterion covers only
_build_compat_payload(stream=True).Proposed criterion: streamed and unstreamed native Ollama requests carry the same
optionsand the same trace headers. A test records both requests through an httpx2MockTransportand fails on the current code.Key question for the owner: should streamed calls send
num_ctxwhen the server setsOLLAMA_CONTEXT_LENGTH?Found by the 2026-10-08 client-library audit.
chore(main): release 0.4.1 (#2185)