Repository navigation
Description
Refreshed plan (2026-10-17, unblocking review)
This section supersedes any text below that conflicts with it.
Decisions
- Title:
fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation, as the refined plan below suggests. The item now fixes group analysis, and the persona stage named in the old title is frozen and goes with 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. - No order with 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: the refined plan's line "this lands after its PR 1" is dropped because the fix is in a different function. This item changes
_execute_single_group_jobinsrc/devops_cli/review/analysis.py, 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 PR 1 changes_run_group_analysis_stageinsrc/devops_cli/ai/review/pipeline.py. Onlytests/test_review_group_analysis.pyis shared, so whichever PR lands second rebases its tests. - Group analysis already runs in a default review, because the devsecops persona runs and the
group_analysisflag defaults on. Neither the unit tests nor the person-run check wait for 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. - Decision D13 (owner, 2026-10-17): "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 goes in v0.2.38, with feat(review): feedback export counts each review subject once and keeps every human verdict #877 and feat(review): verified findings about merged code enter the roadmap through intake #883 following refactor(review): review session store that owns layout, fingerprints and verdicts #771 (done)." Keeping the order line would have held this v0.2.37 item behind a v0.2.38 one.
- 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 item lands first, and fix(review): a group-analysis reply that fails its checks is neither cached nor served #1013 handles a cut reply by this item's
reply-truncatedrule. - Decision D17 (owner, 2026-10-17): "feat(ai): gpt-oss reasoning effort for group analysis is measured and set on its gateway deployments #479 stays, re-scoped to gpt-oss reasoning effort for group analysis with a close-if-unused condition, after fix(ai): reasoning request parameters follow the model's declared capability, not its name #888 and refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001; any reply cap after fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation #876."
- Priority: P1 under the owner's blocker rule (a blocker of a P1 is P1), because D9 has fix(review): a group-analysis reply that fails its checks is neither cached nor served #1013 (P1) land after this item.
- Milestone: unchanged (v0.2.37). With the 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 order gone, no open item holds it back.
- Scope, delivery (one S PR that closes fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation #876) and every acceptance criterion stay as in the refined plan below.
Current references (verified at 3dd7fa6; the refined plan's references below still hold)
- Fix site:
_execute_single_group_job,src/devops_cli/review/analysis.py:689-750. Thechatcall is at:700-706and the parse at:707. - 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's site:
_run_group_analysis_stage,src/devops_cli/ai/review/pipeline.py:4191-4218. Its persona guard is at:4198, and it is called at:4854. - Default for the group-analysis stage flag:
src/devops_cli/ai/review/flags.py:19.
Dependencies and order
- 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, P1): no order with this item. Its body still names fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation #876 as landing after PR 1 and still lists it under Supersedes. feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137 (open, no milestone) still lists fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation #876 in its frozen table's 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 row. Those mentions are stale and should drop fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation #876.
- fix(review): a group-analysis reply that fails its checks is neither cached nor served #1013 (open, no milestone, P1, status/blocked) and feat(review): group analysis is profiled as its own stage, and analysis.json counts dispatched, replayed and failed jobs apart #482 (open, no milestone, P2, status/blocked): both land after this item (D9).
- feat(ai): gpt-oss reasoning effort for group analysis is measured and set on its gateway deployments #479 (open, no milestone, P3, status/blocked): any reply cap it sets lands after this item (D17).
- feat(ai): finish reasons and stream completeness for model replies #599 (closed, v0.2.25) and feat(review): each finding group gets a model-written explanation and plan grounded in the rule's documentation at the installed tool version, kept apart from findings, with every quote, citation, version and code block checked #1147 (closed, v0.2.36): done. They supply finish reasons and the group-analysis stage.
- 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): its cross-group plan job is a model call too and should apply the same check. 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 body does not say so yet, so its own refresh should add it.
Ready: implementation plan (refined 2026-10-17 at 3dd7fa6)
This section supersedes any text below that conflicts with it.
Decisions
- Scope: re-scoped from persona replies to group-analysis replies, with the suggested title
fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation. 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 deletes the persona stage this item was written for,verification.pywent with refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150, andsplit_review_pagesgoes with 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, but the defect remains in the model stage that stays, group analysis (feat(review): each finding group gets a model-written explanation and plan grounded in the rule's documentation at the installed tool version, kept apart from findings, with every quote, citation, version and code block checked #1147). - Does a remaining model stage need this? Yes. Group analysis reads no finish reason.
_execute_single_group_jobparses the reply as soon aschatreturns (review/analysis.py:700-707). The parser falls back to json-repair (review/analysis.py:667-686,core/serialization.py:51-56), so a reply cut inside its JSON can parse into a validGroupAnalysisOutputwith a shortened explanation or missing plan steps, pass the G10 checks, and be rendered in review.md as a checked explanation. - What counts as cut: only the provider's reason,
finish_reason == CONST_FINISH_REASON_LENGTHon the returnedLLMResponse(ai/client/models.py:126,config/constants.py:2189). No length or shape heuristic is used. - What happens to a cut reply: it is not parsed. Its group record is
rejectedwith the reasonreply-truncated, the report'srejectionscounts it, and review.md shows the group's rejection line, not its text. A group explanation is all-or-nothing, so there is no partial result to keep. - Retry: none. The same prompt would hit the same cap, and sizing reply budgets stays with feat(ai): gpt-oss reasoning effort for group analysis is measured and set on its gateway deployments #479 and fix(ai): sampling settings reach the model or are refused, review sessions record them, and the reply cache key includes them #1070. Group analysis passes no validator, so the client returns a reply with any text or thinking on its first attempt (
ai/client/unified.py:310-327,:646-658), and a cut reply reaches group analysis once. - Re-splitting: dropped. A group job has no page to halve; the group is the unit.
- The profile: no change. profile.json already counts
lengthreplies per stage and per backend (ai/review/profile.py:255-267), and group analysis runs in thereportstage (ai/review/runner.py:1070). - Cached cut replies: none to handle. The response cache never stores a
lengthreply (ai/client/unified.py:613-615,config/constants.py:2193-2195). - Measurement gate: met. The body records non-zero
lengthrates on 2026-10-02 (5 of 197 persona calls), so thestatus/blockedlabel is stale and should be removed.
Delivery
-
PR 1 (S): check the finish reason before parsing in
_execute_single_group_job, and reject a cut reply withreply-truncated. Tests first:- with a fake client whose reply is an
LLMResponseholding valid but cut JSON andfinish_reason="length", the group record isrejectedwith["reply-truncated"]and has nooutput,report.rejections["reply-truncated"] == 1, and the fake client was called exactly once for that group; - the same JSON with
finish_reason="stop"isverified(control); render_model_analysis_markdownshows the rejection line for the cut group and none of its text.
Files:
src/devops_cli/review/analysis.py,tests/test_review_group_analysis.py. Closes fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation #876. - with a fake client whose reply is an
Acceptance criteria
- A group-analysis reply whose provider reports
lengthis never parsed or shown. Its record isrejectedwithreply-truncated, and analysis.json'srejectionscounts it. - A cut reply is not retried, so the fake client receives one call per group.
- A reply with any other finish reason is handled exactly as today.
- (person-run) The first branch review after the change records on the issue how many groups were rejected as
reply-truncated, with the report stage'sfinish_reasonsfrom profile.json. - Tests run offline with a fake client: no network, no model; each test under 1 s.
-
changelog.d/876.mdrecords the change;CHANGELOG.mdanddocs/ROADMAP.mdare not edited. -
uv run devops cipasses.
Current references
- Group job:
src/devops_cli/review/analysis.py:689-750; thechatcall:700-707; the parser:667-686; G10 checks:630-665; rendering:872-903. - json-repair fallback:
src/devops_cli/core/serialization.py:51-56. - Finish reason on the reply:
src/devops_cli/ai/client/models.py:126,:159-160;CONST_FINISH_REASON_LENGTH:src/devops_cli/config/constants.py:2189. - Uncached cut replies:
src/devops_cli/ai/client/unified.py:613-615;src/devops_cli/config/constants.py:2193-2195. - Profile counts:
src/devops_cli/ai/review/profile.py:255-267. - Persona reply cap, deleted by 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:
src/devops_cli/config/defaults.py:406, used atsrc/devops_cli/ai/review/pipeline.py:1206.
Dependencies and order
- feat(ai): finish reasons and stream completeness for model replies #599: closed; it records finish reasons.
- 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.37): this lands after its PR 1, which makes group analysis run without personas and touches
_run_group_analysis_stage. 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 no longer supersedes this item, and its and feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137's frozen lists drop it. - 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 (v0.2.38): its cross-group plan job is a model call too and applies the same check.
- feat(ai): gpt-oss reasoning effort for group analysis is measured and set on its gateway deployments #479 and fix(ai): sampling settings reach the model or are refused, review sessions record them, and the reply cache key includes them #1070: own reply budgets and sampling. This item changes neither.
Context & Rationale
Once #599 ships, each reply carries its finish reason, and profile.json counts length replies per stage and per backend. The review code does not act on them yet.
- A persona reply is capped at 8,192 tokens (src/devops_cli/config/defaults.py:386, used at src/devops_cli/ai/review/runner.py:866 and src/devops_cli/ai/review/pipeline.py:928). Verification replies have their own cap (src/devops_cli/ai/review/verification.py:2063).
- A reply cut inside its last finding still parses, with that finding cut short. At ef21785, a 5-finding reply cut two characters into the last description parsed to 5 findings; the last had the description
"de".ReviewResulthas no field that marks this. - runner.py:872 turns the reply into a plain string, which drops its metadata.
- Two retries resend the same prompt: a failed segment (runner.py:858-900), and a reply that fails validation (src/devops_cli/ai/client/unified.py:599-612). vibes
observations/devops-cli/15-llm-structured-output-repair-and-schema-reconciliation.md:32records retries hitting the same token ceiling.
Whether any of this matters depends on how often replies are cut, and nobody has measured that yet.
Scope & Deliverables
- Deliverable:
- First, measure. If no stage has a
lengthreply in 3 benchmark runs, record the figures on the issue and close it as Not planned. - Otherwise:
- The runner reads
finish_reasonfrom the reply beforestr(res_obj)(runner.py:872). - The pipeline sets a new
ReviewResult.truncatedflag. A model cannot set it: parsing clears it, as_strip_model_set_verification_statedoes for verification state (src/devops_cli/ai/review_schema.py:1358). - On
length, the last finding is dropped and the rest are kept. - The persona reply's outcome in
profile.jsonistruncated. - A
lengthreply is not retried with the same prompt. Its page is split in two withsplit_review_pages(page, max_chars=len(page) // 2)(src/devops_cli/ai/review/chunker.py:462), and each half is reviewed once.
- The runner reads
- First, measure. If no stage has a
- Acceptance criteria:
- Measurement, run by a person on the homelab gateway. Run
uv run devops ai review benchmark src/devops_cli/ai --runs 3 --all. Then runjq '[.stages[] | {name, finish_reasons, truncated}]'on each profile.json it prints. Post the figures on the issue. - Unit tests, with a fake client that returns
length:truncatedis True;- the last finding is dropped;
- an earlier finding that has an empty field is kept;
- the profile outcome is
truncated; - the fake client receives two half-page prompts and never the original prompt again.
uv run devops cipasses, and the new tests take under 1 s.
- Measurement, run by a person on the homelab gateway. Run
- Key questions:
- What rate justifies the work? Any non-zero rate across 3 runs (proposed). Even one cut reply leaves one damaged finding.
- Drop only the last finding? Yes (proposed). Only the last record can be cut. json-repair's log cannot tell whether it was, so the rule goes by position.
- How many times can a page be re-split? Once (proposed). A half page that is cut again is kept and marked
truncated, so the extra cost has a limit. - Why not raise the cap instead? Sizing reply budgets stays with feat(ai): gpt-oss reasoning effort for group analysis is measured and set on its gateway deployments #479.
- Constraint:
- Truncation comes only from the provider's reason.
- No finding is dropped because a field is empty.
- Tests touch no network, cluster or real model.
Strategic Alignment
- Milestone: backlog (proposed).
- Depends on: feat(ai): finish reasons and stream completeness for model replies #599.
- Related: feat(ai): gpt-oss reasoning effort for group analysis is measured and set on its gateway deployments #479, feat(review): per-model review quality baseline for the devops-review pool #475.
Split off #599 during the v0.2.25/v0.2.26 readiness review (2026-10-01): This was deliverable (5) of #599's original text, which made it conditional on #599 measuring a non-zero truncation rate. That measurement can only happen after #599 ships, and a person has to run it on the homelab. So it cannot be in the same PR.
Scope added 2026-10-02: the measurement is done, on three branch reviews of release/v0.2.25 rather than the benchmark command. profile.json stages[].finish_reasons for persona review shows length on 2 of 76 dispatched calls in session 20261002-163203, 2 of 81 in 20261002-180320 and 1 of 40 in 20261002-200610. Replayed replies are not counted. The rate is not zero, so under the first key question the work goes ahead. Every cut came from ollama-16gib, which serves gpt-oss:20b (k8s/llm/gateway/configmap.yaml:99-103). The figures show two more things. First, a cut reply can read as a clean file. The release review evaluation ties the two cuts in 20261002-163203 to changelog.d/599.md and src/devops_cli/security/base.py. changelog.d/599.md came back empty, and the next run, which sampled it fresh, raised 4 findings on it. Second, the cut pages were small. The cut calls' prompts were 8,908 to 15,960 tokens, against a minimum of 7,971 across the three sessions. gpt-oss's complete persona replies averaged about 3,100 completion tokens (34 replies), against about 730 for qwen3-coder (158), in the spend ledger. Reasoning fills the cap, not the page, so a half page may be cut again. The once-only re-split bounds that cost, and the budget stays with #479. The cap is now DEFAULT_REVIEW_PERSONA_REPLY_MAX_TOKENS (config/defaults.py:398).
- A unit test covers a
lengthreply that parses to no findings: its outcome istruncated, notempty, and its page is re-split like any other cut reply. - (person-run) The first branch review after the change records on the issue how many re-split halves were cut again.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
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. This item sits in the persona review stage (cut persona replies and re-chunking), which #1151 deletes together with the legacy engine (#995 lands first as its child).
It stays open, labelled
status/blocked, and closes as not planned with "Superseded by #1151" when that item lands. Do not start work on it.dan-petty commentedon Oct 17, 2026
Moved to v0.2.37: v0.2.37 started with fewer than its 16 items and was topped up to 16 from Ready items, critical fixes and P0 features first. (devops roadmap reprioritize)
[-]feat(review): cut persona replies are marked, lose their cut finding and are re-chunked[/-][+]fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation[/+]fix(review): a group-analysis reply cut at its token cap is rejected,…
fix(review): a group-analysis reply cut at its token cap is rejected,…
dan-petty commentedon Oct 18, 2026
What changed
#1665, merged into
release/v0.2.37as 66ff3d6.6 file(s) changed.
How it was verified
Check runs at bcf5804:
Acceptance Criteria of
docs/agent/tasks/task-876-group-analysis-cut-reply-rejected.md:lengthis never parsed or shown. Its record isrejectedwithreply-truncated, andanalysis.json'srejectionscounts it.stop) is handled and verified as normal.reply-truncated, with the report stage'sfinish_reasonsfromprofile.json.LLMResponse: no network, no model; each test runs under 1 s.changelog.d/876.mdrecords the change;CHANGELOG.mdanddocs/ROADMAP.mdare not edited.uv run devops cipasses.feat(release): v0.2.37 (#1720)