Repository navigation
Description
Refreshed plan (2026-10-17, unblocking review)
This section supersedes any text below that conflicts with it.
Decisions
- Decision D9 (owner, 2026-10-17): "feat(review): group analysis is profiled as its own stage, and analysis.json counts dispatched, replayed and failed jobs apart #482 and fix(review): a group-analysis reply that fails its checks is neither cached nor served #1013 leave feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137's frozen row and proceed in the explanation (group analysis) stage: fix(review): a group-analysis reply that fails its checks is neither cached nor served #1013 gets a validator with no resample so model calls <= groups + 1; feat(review): group analysis is profiled as its own stage, and analysis.json counts dispatched, replayed and failed jobs apart #482 counts dispatched, replayed and failed jobs; both land after fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation #876." This replaces the 2026-10-03 freeze. It also replaces the 2026-10-08 condition that this item closes when the review job queue (P3-1 in feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137) lands. The item closes with its own PR, and feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137's frozen row drops it.
- The validator accepts a reply only when
_parse_model_group_outputreturns a model andverify_group_analysispasses it. Reason: the G10 checks read only the job input, the review's admitted finding ids and the reviewed files (analysis.py:640,:772,:513-519). Those inputs repeat in every review of the same commit, so a cached reply the checks reject would be served and rejected again on every such review for the 7-day TTL. - The call passes
max_retries=0. Reason: otherwise the client resends a rejected reply up toDEFAULT_AI_MAX_RETRIES(4) more times, and an empty reply already does that today, which breaks the one-call-per-group bound. - Two items stay here, as the 2026-10-08 comment kept them:
tool_calljoinsCONST_UNCACHED_FINISH_REASONS, and cache entries recordserved_byandmodel. The second was deferred until fix(security): URL credential masking uses urllib and httpx2, so passwords containing '@' and non-http schemes are masked and IPv6 hosts stay intact #1109 masked the header. fix(security): URL credential masking uses urllib and httpx2, so passwords containing '@' and non-http schemes are masked and IPv6 hosts stay intact #1109 (closed, v0.2.31) now strips userinfo beforeserved_byreachesLLMResponse, which clears that deferral.
Scope
- Delivers: the group-analysis call passes a validator with no resample. A reply the validator rejects, because it does not parse or fails a G10 check, is not cached and is not served from the cache, and its record gives the real rejection reason, not
model-call-error.tool_callreplies are not cached. Cache entries record which backend and model answered. - Dropped: the persona and verifier validators, the
ReviewResultschema-echo rule, the review.md unparsed list and both person-run checks. The verifier went with refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150 (closed, v0.2.33), and refactor(review): the persona review stage, the legacy segment engine and review-time RAG are deleted, and devops review builds a model client only for the explanation stages #1151 (v0.2.38) deletes the persona stage. A schema echo cannot pass in group analysis, becauseGroupAnalysisOutputforbids extra keys. - Dropped by D9: the one fresh sample.
- Handled elsewhere: on 2026-10-08 these moved to fix(security): the response cache writes only inside its own directory and is never read from the tree under review #1014: deleting an entry rejected on lookup, empty content with reasoning, the eviction race,
devops ai cache status/clear, and the schema echo outside review (chat_structuredand intake'sModelProposal). Sampling in the cache key belongs to fix(ai): sampling settings reach the model or are refused, review sessions record them, and the reply cache key includes them #1070. analysis.json'smodel_callscounts replays and failed jobs as calls, and that count belongs to feat(review): group analysis is profiled as its own stage, and analysis.json counts dispatched, replayed and failed jobs apart #482.
Delivery
- One PR (M), after fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation #876. Files:
src/devops_cli/review/analysis.py,src/devops_cli/config/constants.py,src/devops_cli/ai/client/unified.py,src/devops_cli/ai/response_cache.py,tests/test_review_group_analysis.py,tests/test_ai_client_finish_reasons.py,changelog.d/1013.md. Fixes fix(review): a group-analysis reply that fails its checks is neither cached nor served #1013.
Acceptance criteria
-
_execute_single_group_jobcallschatwithmax_retries=0and a validator. The validator accepts a reply only when it parses to aGroupAnalysisOutputand passesverify_group_analysis. This follows the pattern inai/client/structured.py:223-239, and each reply is parsed and checked only once. Unlikestructured.py:239, the job does not re-wrap the rejected reply in a newLLMResponse, because that drops itsfinish_reason(models.py:143,:160). It reads the finish reason from the reply thatReplyRejectedErrorcarries (models.py:68-76). - A reply the validator rejects is never cached. A cached reply the validator rejects is not served, and the call goes to the model. Test: an
LLMClientuses a tmp cache seeded at a group's key with an unparseable reply, and its stubbed dispatch returns a valid reply. The group makes one model call and isverified, and the entry then holds the new reply. - No resample: each group makes at most one model call per run, whether its reply fails to parse, fails a G10 check, is empty or is cut. Group analysis therefore keeps feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137's "model calls ≤ finding groups + 1", where the +1 is feat(review): related findings are linked by shared CWE, rule family, symbol-graph component or package, and one review-level plan orders the work across groups #1148's plan job.
- A reply refused on
ReplyRejectedErroris recorded with the reason the job gives it today:schema-validation-failedwhen it does not parse, and the G10 reasons when a check fails. With fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation #876 in place, a reply whose finish reason islengthis recorded asreply-truncated. None of these is recorded asmodel-call-error, which stays for client and transport errors. An empty reply with no reasoning never reaches the validator. The client raises a plainAIClientErrorfor it (unified.py:629), so it staysmodel-call-error. - Tests use a stubbed dispatch and a tmp cache, with no network:
- an unparseable
stopreply makes 1 call, is recorded asschema-validation-failedand writes no cache file, and a second run calls the model again; - a parseable reply with an unknown finding id makes 1 call, is recorded as
unknown-finding-idand writes no cache file; - a valid reply is cached, and a second run makes no model call and records
verified; - a cut, unparseable reply makes 1 call and is recorded as
reply-truncated; - an empty reply with no reasoning makes 1 call, where today it can make up to 5, and is recorded as
model-call-error.
- an unparseable
- Each test runs in under 1 s.
-
tool_calljoinsCONST_UNCACHED_FINISH_REASONS. A stub reply with finish reasontool_callis returned and leaves no cache file. - Each new cache entry records the
served_byandmodelits reply carried, next to the requested alias thatmodelholds today. A hit returns them on itsLLMResponse, andbackend_infois still the cache marker. - The stored
served_byis the valueextract_served_byreturns, with no userinfo. Test: a served-by header whose URL carries credentials leaves none in the cache file. -
changelog.d/1013.mdrecords the fix under### Fixed, andCHANGELOG.mdis not edited. -
uv run devops cipasses. - (person-run) Run two branch reviews of the same commit with group analysis on: after refactor(review): the persona review stage, the legacy segment engine and review-time RAG are deleted, and devops review builds a model client only for the explanation stages #1151 PR 1, or before it with a persona on. In the second review's profile.json, the
reportstage counts no more cached calls than the first review's analysis.json hasverifiedgroups.
Current references (at 3dd7fa6)
src/devops_cli/review/analysis.py::700-706: thechatcall, with no validator and nomax_retries.:709:schema-validation-failed.:667-686: the parser.:630-664: the G10 checks.:640and:772: the finding-id check reads every admitted finding id in the review.:513-519: the code-quote check reads whole files.:813and:827: any exception becomesmodel-call-error.:810:model_calls = len(jobs).:73-74and:157:GroupAnalysisOutputis anextra="forbid"model.
src/devops_cli/ai/client/unified.py::614-615: the only gate on writing the cache is the finish reason.:555-575: the cache read applies the caller's validator.:618-628: a rejection raisesReplyRejectedErrorcarrying theLLMResponse.:629: an empty reply or an error payload gets a plainAIClientError.:753-759: attempts aremax_retries+ 1.:507-537:_cache_chat_entrydropsserved_byand the model that answered.
src/devops_cli/ai/client/structured.py:223-239: the validator,max_retries=0andReplyRejectedErrorpattern.src/devops_cli/ai/client/models.py:68-76:ReplyRejectedError.replyholds the reply.:143and:160: anLLMResponsebuilt from a string hasfinish_reasonNone.src/devops_cli/config/constants.py:2193-2195:CONST_UNCACHED_FINISH_REASONS.:2167,:2169and:2177map provider reasons totool_call.src/devops_cli/config/defaults.py:82:DEFAULT_AI_MAX_RETRIESis 4.:119-120: the cache is on with a 7-day TTL.src/devops_cli/ai/client/openai.py:86-111: the request sends notoolsfield.src/devops_cli/ai/client/network.py:54-67:extract_served_bystrips userinfo.src/devops_cli/ai/response_cache.py:26-45:CachedLLMResponsehas noserved_byfield.:235-279:set.src/devops_cli/ai/review/pipeline.py:4191-4198and:4854: group analysis runs only with personas until refactor(review): the persona review stage, the legacy segment engine and review-time RAG are deleted, and devops review builds a model client only for the explanation stages #1151 PR 1.src/devops_cli/ai/review/profile.py:248-249andsrc/devops_cli/ai/review/runner.py:1070: cached calls are counted per stage, and group analysis runs inreport.
Dependencies and order
- fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation #876 (open, v0.2.37) lands first, because it edits the same function. GitHub still labels it P2, but the owner's blocker rule makes it P1 because it blocks this P1 item.
- refactor(review): the persona review stage, the legacy segment engine and review-time RAG are deleted, and devops review builds a model client only for the explanation stages #1151 (open, v0.2.38 by Decision D13 (owner, 2026-10-17), P1) does not block the code. Its PR 1 lets the person-run check run without a persona.
- feat(review): related findings are linked by shared CWE, rule family, symbol-graph component or package, and one review-level plan orders the work across groups #1148 (open, v0.2.38, P1): its plan job is the +1 call. Whichever of feat(review): related findings are linked by shared CWE, rule family, symbol-graph component or package, and one review-level plan orders the work across groups #1148 and this item lands second gives that job a validator built the same way, from its own parse plus the G10 checks, and
max_retries=0. - feat(review): group analysis is profiled as its own stage, and analysis.json counts dispatched, replayed and failed jobs apart #482 (open, backlog, P2, D9) counts dispatched, replayed and failed jobs, and it reads the reasons this item records. Both land after fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation #876.
- fix(ai): sampling settings reach the model or are refused, review sessions record them, and the reply cache key includes them #1070 (open, backlog, P2): the sampling values that analysis passes (
temperature,top_p,seed) are swallowed bychat_messages'**kwargs(unified.py:698). This item leaves the key unchanged. - fix(security): the response cache writes only inside its own directory and is never read from the tree under review #1014 (open, backlog, P2) holds the client defects this item moved to it on 2026-10-08. The two items have no ordering constraint.
- refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150 (closed, v0.2.33) and fix(security): URL credential masking uses urllib and httpx2, so passwords containing '@' and non-http schemes are masked and IPv6 hosts stay intact #1109 (closed, v0.2.31) are done.
- Release: this item has no milestone. The unblocking plan does not stage it in v0.2.38, so the roadmap tooling places it.
Problem
The response cache stores any complete reply and serves it again for 7 days. Before it caches a reply, the client checks only that it is not empty and not a JSON error payload (_validate_response_text, src/devops_cli/ai/client/unified.py:323-341, called at :653), plus any validator the caller passes. Neither review stage passes one. The persona agent calls chat_messages(system, messages, enable_thinking=...) (src/devops_cli/ai/agents/agent.py:887), and the verifier calls client.chat(...) (src/devops_cli/ai/review/verification.py:2128-2130). Only the legacy persona loop passes one (src/devops_cli/ai/review/runner.py:880). Since #966, cut, filtered and failed replies are not cached (unified.py:626, src/devops_cli/config/constants.py:2017-2019). A complete reply the review cannot use still is.
Measured on .data/cache/llm (5,000 entries, read at about 20:52 UTC on 2026-10-02 and re-checked at 21:13 with the e4ea2e0 parsing code):
- 20 persona entries the pipeline cannot use: 14 that do not parse (11 of them empty) and 7 that echo the
ReviewResultJSON schema. One echo is also among the 14. - 121 verifier entries with no verdict object: 108 that do not parse (76 of them empty) and 13 that parse to a list with no object in it.
At 21:55 UTC both counts were unchanged, 20 and 121: eviction had removed one old unparsed persona entry, and s6 (below) had added an empty one.
Four branch reviews of release/v0.2.25 ran on 2026-10-02 before #951: s1 to s4 (20261002-142541, -163203, -180320 and -200610). s1 had no cache hits; s2, s3 and s4 replayed such replies. In s4 (cf8ae47), 301 persona pages came from the cache, and 4 of them got a schema echo written in s1 to s3:
changelog.d/588.md(llm_56f798ba…, served in s2, s3 and s4);docs/agent/tasks/task-947-delete-dynamic-workflow-and-code-mode.md(llm_a879cbd7…, s3 and s4);tests/test_harness.py(llm_da826747…, s3 and s4);docs/agent/tasks/task-961-argo-namespace-and-cli-state-handling.md(llm_f712b111…, s4).
All four came from ollama-16gib (gpt-oss:20b). Three ended with finish reason stop. The s1 reply (llm_56f798ba…, ledger row 8744) predates recorded finish reasons; its 5,155 completion tokens are under the 8,192 cap. s4 also wrote a fifth echo, llm_1267029394… (ledger row 9368, ollama-16gib, stop), and read it as an empty review. tests/test_harness.py had no usable persona reply in s2, s3 or s4. s5, at 38517a8 with #951's prompts, got one. The measured harm is small. In 3 of the 4, the model's own reasoning ended with no findings. The fourth dropped one finding, and it was false: typing.sys exists on the project's Python 3.14. The mechanism has no guard.
A schema echo reads as a clean file. ReviewResult gives every field a default and ignores unknown keys (src/devops_cli/ai/review_schema.py:1180-1189). A reply that is the JSON schema ($defs, properties) therefore validates as a review with no findings. fix_llm_response returns that model (agent.py:901-905). The agent skips its schema retry, which runs only when there is no model (agent.py:966-977), and returns it (agent.py:1013). The pipeline prefers it to parse_review_response (src/devops_cli/ai/review/pipeline.py:237-242). The outcome is empty, and nothing flags it. Of the persona entries on disk (3,814 at 21:55 UTC), in 2 parse_review_response recovers a finding this path drops: llm_a879cbd7…, and llm_9a2017e3… (docs/commands/k8s.md, s3). Both findings were false.
- In s1 to s4, gpt-oss:20b (ollama-16gib and ollama-24gib,
k8s/llm/gateway/configmap.yaml:99-108) answered 50 persona calls, 45 of them not cut. It sent 6 schema echoes, all on ollama-16gib (6 of that tier's 38 replies that were not cut). qwen3-coder:30b (ollama-48gib and ollama-64gib,:89-98) sent 0 in 361. - A top-level
$defsorpropertieskey marks every echo that repairs to a JSON object. At 21:40 UTC, the e4ea2e0 repair code turned 3,820 of the 3,834 persona entries into an object. 6 of those carry such a key, and all 6 are echoes. Each of the other 3,814 has afindingskey. The seventh echo (llm_da826747…) does not repair to an object and is alreadyunparsed.
Verifier replies are replayed less today. The prompt carries each finding's criteria_execution_results, whose duration_seconds changes every run (verification.py:314-323). s4 served 13 verifier replies from the cache, and all 13 carried verdicts. One reply with no verdict was served before: llm_9f965cca…, a markdown "Findings Report" that parses to ["OPTIONS"], written 09-30 at 06:01 and served at 12:34. Such a reply leaves the file's findings UNVERIFIED with no note (verification.py:2133-2140). #846 takes criteria_execution_results out of the verifier input. Verifier prompts for unchanged files will then repeat more often (inferred; the 13 s4 hits already did), and an unusable reply among them will be served every run.
The cache checks a reply one way when it writes it and another way when it reads it:
- On write, the check sees the
LLMResponsewith its reasoning, so empty content with non-empty reasoning passes (unified.py:329-331). - On read, it sees
cached_entry.content, a plain string with no reasoning, and rejects it (unified.py:595-597). The call goes to the model again. - By then
LLMResponseCache.get()has counted a hit, setlast_accessedand rewritten the file (src/devops_cli/ai/response_cache.py:213-217,:227-232). Eviction removes the oldest mtime first (response_cache.py:98-110), so the lookup keeps the dead entry alive.
The cache held 87 such entries at 21:13, and none was ever served. Each has hit_count 0, so none was even looked up: the keep-alive above follows from the code but has not happened yet. 61 are replies cut before #966 whose reasoning used the whole budget. s4 added one: llm_8709b7de…, a verifier reply with finish reason tool_call, 24,002 prompt and 192 completion tokens (ledger row 9461, ollama-16gib). tool_call is not in CONST_UNCACHED_FINISH_REASONS, and no review call offers native tools: the gateway payload has no tools field, only the model, the messages, and sampling and reply-limit parameters (src/devops_cli/ai/client/openai.py:81-105). s6, at the tip, added another: llm_b4e25013…, the persona reply for docs/commands/ai.md (ledger row 9878, ollama-16gib, stop, 1,134 completion tokens, all of them reasoning). s6 recorded that file as unparsed, and the next review of the same commit will call the model for it again.
Nothing removes or bypasses a bad entry:
- Persona pages run with
max_turns_per_agent=1(pipeline.py:937-945). The agent's turn starts at 1 (agent.py:857), so the reflection retry, which needsturn < max_turns(src/devops_cli/ai/agents/runner.py:471-482), never runs. - The page retry runs only on exceptions (
pipeline.py:1360-1409). It would send the same key, which covers only provider, model, system, messages andenable_thinking(unified.py:720-726,response_cache.py:166-197). - The verifier makes one call (
verification.py:2126-2140). - Nothing deletes a single entry except expiry on lookup (
response_cache.py:208-212,:223-226). The TTL counts fromcreated_at(response_cache.py:48-52), and each hit rewrites the file (:216,:231), so an entry served every session is the last one evicted. The only ways out aredevops ai cache clear(src/devops_cli/commands/ai_cache.py:89-92), which removes every entry, and--no-cache.
A blind file reads as clean. tests/test_harness.py is flagged only on the console, as "(unparsed: Principal DevSecOps Engineer)" (pipeline.py:404-413), in profile.json, and in its per-file record (files/tests_test_harness_py.json, unparsed_personas). In s4's review.md it appears only in the network table (lines 3096 and 3130). findings.json has no finding for it, only its two network references. The three echo files are flagged nowhere.
Three smaller defects turned up with these:
- The entry does not record which model answered.
_cache_chat_entry(unified.py:539-569) drops the reply'sserved_byandmodel, and every entry'sbackend_infonames only the gateway. The four replayed echoes above were tied to gpt-oss:20b only through the spend ledger. In s4, 32 of the 301 persona hits were gpt-oss:20b replies. - A failure while evicting files fails the call.
_evict_excess_disk_filesstats each file without a guard (response_cache.py:102). If another process removes a file between the glob and the stat, for example a second review ordevops ai cache clear, the exception leavesset()and reaches the dispatch retry loop (unified.py:646-668). The reply is discarded and the model is called again. Offline, with eviction always raisingFileNotFoundError, onechat()made 6 model calls and then raised "Cannot connect to AI provider API". A single race cost one extra call. devops ai cache statusandclearlook at a different cache. They build it with default arguments (commands/ai_cache.py:30,:91;response_cache.py:146-152,:433-449):data.cache_dir, 1,000 entries, enabled. The review clients useai.cache(unified.py:211-238,src/devops_cli/config/settings.py:373-380). WithDEVOPS_CLI_DATA_DIRset, reviews used/workspaces/devops-cli/.data/cache/llmwhilestatusandclearused<DATA_DIR>/cache/llm. Without it,statusreportsmax_entries1000 against the 5,000 reviews enforce.clearis the only way to remove a bad entry.
Some prompts may be cut on the server before the model sees them (inferred). 78 entries, all from 09-30, report exactly 8,002 prompt tokens. 67 of the 76 verifier ones give no verdict object, against 35 of the 78 verifier replies to larger prompts on the same tier that day. The ledger also records 8,002 prompt tokens on 3 file reviews on 09-27 and 09-28, on ollama-64gib and two vLLM servers. Such a reply is cached under the full prompt's key. But calls at 8,002 and at up to 15,892 tokens interleave in the same hours on the same tier, so the cause is not established (see Key questions).
Since #951 (38517a8) changed the persona prompts and verify_finding_system.md, no review at the branch tip (now 79e1e93) can reach the bad entries written before it. They expire by 10-09. Session 20261002-205520 (s5, 38517a8) wrote 379 persona and 20 verifier entries, and none is empty, unparsed or an echo. The mechanism is unchanged at the tip: s6 (20261002-214641, 79e1e93) cached llm_b4e25013… above.
Line references are at e4ea2e0. At 79e1e93 the cited code is unchanged, but #987 moved pipeline.py lines (:237 is now :246, :404 is :413, :937 is :946, :1360 is :1522). ReviewResult is at review_schema.py:1194 and still defaults every field, and CONST_UNCACHED_FINISH_REASONS is at constants.py:2021.
Acceptance criteria
- The persona agent and the verifier pass the client a
validator(the argumentchatandchat_messagesalready take) built from the parse their stage uses. The persona check rejects a reply that does not parse under the pipeline's rule (pipeline.py:237-242) or is a schema echo. The verifier check rejects a reply whose_parse_verifier_payloadresult (verification.py:2055-2063) holds no JSON object, as["OPTIONS"]does. The client neither caches nor serves a reply that fails its check. - A schema echo is never read as an empty review. A reply that repairs to a JSON object with a top-level
$defs,$schemaorpropertieskey keeps the findingsparse_review_responserecovers from it, and its outcome is otherwiseunparsed. It is never cached. - A rejected reply gets one fresh sample: a new model call, never a cache read. If that one is rejected too, the stage uses it as today, uncached, and raises nothing. The persona outcome is
unparsed(orfindingswhen findings are recovered), and the verifier leaves the findings UNVERIFIED (fix(review): grep-only criteria neither verify nor invalidate a finding, and prompt examples stop teaching them #846 adds the note). A reply whose finish reason is inCONST_UNCACHED_FINISH_REASONSgets no fresh sample: it is already uncached, and fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation #876 and feat(ai): gpt-oss reasoning effort for group analysis is measured and set on its gateway deployments #479 own cut replies. - With a stub model whose replies are always schema echoes, a page makes exactly 2 model calls, records
unparsedand writes no cache entry. With a stub whose first reply is an echo and whose second is a valid review, the page records the second reply's findings and caches only that reply. With a stub whose reply is cut (length) and does not parse, the page makes 1 model call. - A cached entry the client rejects on lookup is deleted, and the call goes to the model. With a tmp cache seeded with an echo at a page's key and a stub that returns a valid review, the page makes one model call, and the entry then holds the new reply.
- A reply with empty content is never cached, whatever its reasoning, and
tool_calljoinsCONST_UNCACHED_FINISH_REASONS. A stub reply with content""and reasoning, and a stub reply with finish reasontool_call, are each returned and leave no cache file. - Each new entry records the
served_byandmodelits reply carried, beside the requested alias the entry'smodelfield holds today. A hit returns them on itsLLMResponse, withbackend_infostillcache. - A failure while writing or evicting cache files neither fails nor repeats the call. With eviction raising
FileNotFoundError, onechat()makes one model call and returns its reply. -
devops ai cache statusandclearuse the directory, TTL, size cap and enabled flag the review clients use. With an absoluteai.cache.dirandDEVOPS_CLI_DATA_DIRpointing at two tmp directories,clearempties theai.cache.dirone, andstatusreports the configuredmax_entries. - review.md lists each file whose persona reply ended
unparsed, so a file no persona reviewed does not read as clean. - The tests use stub clients, a tmp cache directory, and fixtures built from
ReviewResult.model_json_schema()in the shapes ofllm_56f798ba…($defsandproperties),llm_a879cbd7…(a finding nested in the schema) andllm_da826747…(does not repair to an object). They make no network call and add well under 1 s touv run devops ci. -
changelog.d/1013.mdrecords the fix under### Fixed.CHANGELOG.mdis not edited. -
uv run devops cipasses. - (person-run) Over a copy of
.data/cache/llm, the persona check rejects each entry named here that is still present and accepts every other persona entry that has afindingskey. - (person-run) Two branch reviews of the same commit on the homelab gateway: the second prints no "(unparsed: …) handled by cache" line.
Key questions
- Where does the check run: in the client, or in the pipeline after parsing? (proposed) In the client, through the
validatorargumentchat_messagesalready takes. The client is the one place that both writes the cache (unified.py:626,:653) and reads it (:595-597), and the legacy review loop already passesparse_review_responsethis way (runner.py:880). - How many fresh samples does a rejected reply get? (proposed) One. With a validator, the client sends up to
max_retries+ 1 calls (6 with the current config,unified.py:744-750), and the page retry (pipeline.py:1360-1409, 6 attempts) would multiply that to 36 calls for one page. Those retries are for transport errors. gpt-oss:20b echoed 6 of its 45 persona replies that were not cut, so a second sample usually parses. Cut replies get no fresh sample: in s4, 31 of 101 verifier calls were cut (ledger, ollama-16gib and -24gib), and a resample would resend the same prompt against the same cap. - What marks a schema echo, and why not require a
findingskey? (proposed) A top-level$defs,$schemaorpropertieskey after repair. It matched all 6 echoes that repair to an object and no other persona reply. Requiringfindingswould miss 2 of the 6, which carryfindings: []next to$defs(llm_1267029394…,llm_6a2ffa71…). - Should an empty reply with reasoning be cached and served, since the entry keeps the reasoning? (proposed) No. Every review caller reads
content. None of the 87 such entries was ever served, and 61 of them are cut replies whose reasoning used the whole budget. - Should the served model join the cache key? (proposed) No. The client does not know it before the call, and the request names the alias. Storing it lets fix(ai): response-cache hits are counted as cached requests #816 and 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 attribute a hit, and it makes a per-model echo rate visible from the cache alone.
- Should the client refuse to cache a reply whose reported prompt tokens fall well below its own count of the prompt? (proposed) Not in this issue. The cause of the 8,002-token pattern is not established. The checks here already keep 67 of the 76 such verifier replies out of the cache (30 empty, 24 that do not parse, 13 with no verdict object). It needs the gateway's per-deployment context limits first, and a follow-up issue if they explain it.
- Should the existing bad entries be purged? (proposed) No. Pre-1.0 needs no migration. No review at the tip can reach them, they expire by 10-09, and the lookup check deletes any it meets.
- Should the schema leave the persona system prompt, so that models stop echoing it? (proposed) Not here. feat(review): review prompts state a threat model and an evidence bar, and send nothing the pipeline does not use #951 already trimmed it at the tip, and an echo needs the check whatever the prompt says.
Depends on: none.
Order: lands no later than #846's change to the verifier input (_build_validation_prompt), so unusable verifier replies are out of the cache before verifier prompts start to repeat. #816 edits the same hit return (unified.py:739-742); whichever lands second rebases, and a lookup this issue rejects stays out of #816's hit count. #987 has merged (b1fddd0), so the review.md line builds on its report renderers. #1014 moves the default cache directory under the data directory; the status and clear criterion uses an absolute ai.cache.dir, so it holds whichever lands first.
Related: #816 (hits counted as cached requests). #846 (verifier notes and verifier input). #876 (cut persona replies). #966 (cut replies not cached). #951 (prompts at the tip). #871 (producer attribution). #482 (per-run cache reporting). #962 (per-model gateway groups; a route change leaves cached replies in place). #950 (why a replayed false positive is not suppressed). #1014 (the cache trusts its files and writes where they point).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 3, 2026
Evidence from the model-choice evaluation (2026-10-03): cached replies replay across sampling changes. Source:
.data/model-choice-20261003.md, section 3, and its verification pass. Lines are at e3ff98c.The key leaves sampling out.
generate_keyhashes the provider, model, system prompt, messages andoptions(ai/response_cache.py:166-197). The client passes only{"enable_thinking": ...}as options (ai/client/unified.py:707-726). Temperature, top_p, reasoning effort and the reply cap are not in the key.It happened on 2026-10-03.
analysisandverificationto qwen3-coder's card sampling, 0.7 / 0.8 (config.yaml edited at 04:58Z; the earlier values were reported as 1.0 / 0.5 and cannot be checked).--no-cachewould be served replies made with the old sampling, for up to the 7-day TTL. The evaluation had to tell the owner to run the first review with--no-cache.review_setupruns only for benchmark, corpus-score and sample-validation runs (commands/review.py:1430,:1783,:2021). So a replayed reply cannot be recognised afterwards, and the effect of the change on S9/S10/R2-style runs cannot be measured from the sessions.Where the fix goes. This item's key question covers only the served model, so the sampling key is filed in #1070. There the cache options carry
temperature,top_p,reasoning_effortand the reply cap, and every review session records its sampling. Both items edit the key construction inunified.py, so whichever lands second rebases. If you would rather have it here, #1070's cache criterion moves to this item.dan-petty commentedon Oct 3, 2026
Frozen by the evidence-first review redesign (#1137, owner direction of 2026-10-03): patches to the model generator and verifier stop, and tool-layer fixes continue. The review's reply cache is replaced in phase P3 by content-addressed review jobs (P3-1 in #1137, filed when that phase starts); its sampling-key part already moved to #1070 (owner comment, 2026-10-03). Before this item closes, the defects that are not review-specific move to #1014 or a new item, because chat and analysis keep the client cache: the schema echo, empty content, the eviction race, and status/clear reading a different directory.
It stays open, labelled
status/blocked. Its v0.2.29 placement is left to the roadmap tooling. The review cache defect stays live until #1151; the tools-only review avoids it meanwhile.dan-petty commentedon Oct 8, 2026
Moved to the backlog: a Blocked item can't join a starting release (v0.2.29). (devops roadmap reprioritize)
dan-petty commentedon Oct 8, 2026
Moved 2026-10-08. The owner's freeze comment of 2026-10-03 named four defects here that are not review-specific: "the schema echo, empty content, the eviction race, and status/clear reading a different directory". #1137's frozen table says they move to #1014 first. They are now in #1014's "Update 2026-10-08" section, with evidence at 910b823 and offline acceptance criteria:
The schema echo. No caller outside review shows the model a schema, so what remains outside review is two client-side defects:
chat_structuredcaches a first-attempt reply that fails its schema.ModelProposalaccepts any JSON object, its own schema included, as an empty proposal. Intake then skips that candidate on every rerun.The fix is pydantic's
extra="forbid"and required fields on that schema, not a key check in the client.Empty content. A reply with empty content and non-empty reasoning is cached. Every lookup then refuses it. When the new reply is not cached, the lookup also keeps the dead entry alive.
The eviction race. A cache file removed during eviction turns a good reply into a false "Cannot connect" error.
devops ai cache statusandclear. Oncedata.dir,DEVOPS_CLI_DATA_DIRor anai.cachevalue is set, they read a different directory and different settings from the clients. fix(security): the response cache writes only inside its own directory and is never read from the tree under review #1014 already rewrites that directory resolution.These criteria from this item now live in #1014:
devops ai cache statusandclearuse the directory, TTL, size cap and enabled flag the review clients use".These stay here:
ReviewResultecho rule, the per-page resample, the review.md unparsed list and both person-run checks. They go with refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150, refactor(review): the persona review stage, the legacy segment engine and review-time RAG are deleted, and devops review builds a model client only for the explanation stages #1151 and P3-1.served_by/modelin cache entries. It is not in the owner's list, and it would write the rawx-litellm-model-api-baseheader to disk before fix(security): URL credential masking uses urllib and httpx2, so passwords containing '@' and non-http schemes are masked and IPv6 hosts stay intact #1109 masks it.tool_calltoCONST_UNCACHED_FINISH_REASONS.The last two apply to the shared client cache too. P3-1 replaces only the review's cache, so when this item closes they close unfixed, unless they are filed again.
#1013 stays frozen, with the label
status/blockedand board Status Blocked. Roadmap reprioritize moved it from v0.2.29 to the backlog on 2026-10-08. It closes when the review job queue (P3-1 in #1137) lands. The review-side cache defect stays live until #1151; meanwhile the tools-only review (--no-persona-review --no-verification) avoids it.dan-petty commentedon Oct 11, 2026
Moved to the backlog: a Blocked item can't join a starting release (v0.2.35). (devops roadmap reprioritize)
[-]fix(review): the response cache stores and serves only replies the review can use, and a schema echo no longer reads as a clean file[/-][+]fix(review): a group-analysis reply that fails its checks is neither cached nor served[/+]fix(review): a group-analysis reply that fails its checks is neither …
dan-petty commentedon Oct 21, 2026
What changed
#1812, merged into
release/v0.2.39as e864538.10 file(s) changed.
How it was verified
Check runs at e7ac168:
Acceptance Criteria of
docs/agent/tasks/task-1013-group-analysis-validator.md:No Acceptance Criteria section.
feat(release): v0.2.39 (#1947)