Repository navigation
Description
Refreshed plan (2026-10-17, unblocking review)
This section supersedes any text below that conflicts with it. Line numbers are at main 3dd7fa6; on release/v0.2.37 (4ee3e01) config/constants.py lines after :2542 are 7 lower.
Decisions
- 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).
- Decision D16 (owner, 2026-10-17): v0.2.38 may go over the cap of 16 for now; unblocking work goes first.
- Decision D7 (owner, 2026-10-17): feat(review): review page size against quality and speed #480 and fix(review): the devsecops persona does not treat a function parameter as untrusted until it quotes where an untrusted value enters it #1052 close now (done). This item therefore supersedes no open issue, and the "a person closes them when PR 4 merges" step below is dropped.
- Decision D8 (owner, 2026-10-17): the eight refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150-superseded items close as not planned (done: feat(cli): generator-side rule pruning measured against verifier overlap #414, refactor(review): one rulebook for known false positives #770, fix(review): the tenacity and async-pool known false positives never fire #779, fix(review): verdicts bind across conflicting titles and absence wording shields nonexistent constructs #790, feat(review): order-swap probe for verification verdicts #870, fix(review): a finding that cites a removed symbol keeps its mark, the verifier sees the removed lines, and a refutation of it stands #1018, fix(review): a correct refutation stands when the guard's evidence is a path token, a citation inside the finding's own lines, or generic scanner wording #1021, fix(review): a model verdict that rests on a criterion with no command is not a confirmation #1053). Their investigations found refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150 leftovers that no open item owns, so they are folded in here.
- Decision D19 (owner, 2026-10-17): test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312 and refactor(github): the github session owns transport, ledger, error classes and link pagination #983 joined v0.2.37; 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 moved to the backlog; feat(k8s): alert when pod logs stop reaching loki #890 moved to v0.2.38 with feat(k8s): the alloy collectors, grafana and pyroscope are scraped through chart integrations, and a dropped sample or log entry alerts #1131 (done).
- The leftovers ship as a new PR 5 (S), not inside PR 2. None of them needs the persona stage gone, and PR 2 is already L. It is numbered 5 so that "PR 2" and "PR 3" keep the meaning refactor(review): review session store that owns layout, fingerprints and verdicts #771, refactor(review): report rendering leaves the orchestrator #1008 and refactor(review): the review's single-owner tables move out of config/ into ai/review/ and review/ #1025 rely on. It lands before PR 4, so PR 4 stays the PR that closes this item.
- The hardening surface:
common_hallucinations.jsonis replaced by.devops/review.tomlandsrc/devops_cli/review/rules/. ADR 0005:50 fixes a false positive in tool configuration or as a suppression, and turns a missed defect into a rule-pack rule. Tool configuration is spread over many files, so the suppression file and the rule pack are the declared surfaces, and the audit keeps its feat(github): defect prs carry their hardening readiness blocker and post-merge audit #697 intent. - The verifier note kinds go together with the field they count:
CONST_VERIFICATION_NOTE_KINDSand the ten constants it lists,Finding.verification_note,apply_verdict'sverification_noteparameter and the "Verification note" details row. Since refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150, no caller passes a note (adjudication.py:185-191,pipeline.py:896). Sessions saved before refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150 lose the note on load, which pre-1.0 accepts. relocated_fromgoes, because nothing has written it since refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150. Its test goes with whichever of PR 2 and PR 5 lands first, since the test imports_merge_two_findings, which PR 2 deletes.- The challenger stays a chat persona. Its
role.mdandprompt.mdare rewritten so it argues against a claim, design or plan put to it in chat and names the evidence that would settle it.devops ai chatreadsrole.mdthroughchat_prompt(ai/personas/__init__.py:69,commands/ai.py:1072), anddevops ai pipelinereadsrole.mdandprompt.mdthroughsystem_prompt(ai/personas/__init__.py:68,commands/ai.py:1288). No stage shows the challenger findings any more. docs/SELF_IMPROVEMENT.md: section 2's calibration records stay as history. PR 4 puts a note at their head, like the one at:438-441, saying that refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150 deleted the catalog they name and that a lesson is now a.devops/review.tomlsuppression or a rule-pack rule.
Scope
- Unchanged: PRs 1-4 of the plan below, apart from the additions to PR 3 and PR 4 listed under Delivery.
- Added: refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150's leftovers. These are the catalog as a declared hardening surface, the verifier note kinds with the
verification_notefield,relocated_fromand its test, and the challenger prompts, which still describe a findings verifier. - Supersedes: no open issue. feat(review): review page size against quality and speed #480 and fix(review): the devsecops persona does not treat a function parameter as untrusted until it quotes where an untrusted value enters it #1052 are closed (D7), and fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation #876 is now its own group-analysis fix.
Delivery
- PRs 1, 2, 3 and 5 say "Part of 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" in place of "Refs 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 4 says "Closes 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 3 also moves the two diff-parser tests out of
tests/test_construct_aware_location.py(:30-65, which import the chunker at:5) into the tests forsrc/devops_cli/review/diff.py, and deletes the file. - PR 4 also adds the
docs/SELF_IMPROVEMENT.mdnote above and rewrites the challenger line in the KB architecture article (architecture.md:94). - PR 4 also removes the checks in
tests/test_personas.pythat read the.devops/review.mdit deletes:_OWN_REVIEW_CONVENTION_RULES(:92-103) with its row intest_the_review_prompt_still_carries_every_rule(:119,:122), andtest_host_specific_rules_live_in_this_repositorys_conventions(:127-143). The check thatai/tasks/review.mdcarries no removed rule (:104-111,:123) stays. - PR 5 (S): refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150's leftovers. It is independent of PRs 1-3 and lands before PR 4.
- Tests first, each failing today unless marked as a guard:
match_hardening_surfacereturns None forsrc/devops_cli/ai/review/common_hallucinations.json,.devops/review.tomlfor.devops/review.toml, andsrc/devops_cli/review/rules/for a rule file under it.CONST_HARDENING_SURFACESequals the five surfaces in the criterion below.- Guard (passes today, keeps the two in step): the surfaces listed in the workflow's intake body equal
CONST_HARDENING_SURFACES. devops pr hardening-reportcounts a defect PR whose only surface file is.devops/review.tomlas hardened, and one whose only surface file iscommon_hallucinations.jsonas lacking additions (tests/test_pr_hardening_report.py:164-191)."verification_note"and"relocated_from"are not inFinding.model_fields.compute_verdict_distributionsreturns noverification_notekey.- The forged-note test (
tests/test_review_verification.py:197-223) is rewritten, not dropped:parse_review_responseof a reply carryingverification_noteandrelocated_fromgives a finding whosemodel_dump()has neither key. SavedFinding.model_validateof a saved finding that carriesverification_noteandrelocated_fromsucceeds and keeps neither.rg -n -i "finding|verif|invalidat|false.positive|hallucinat" src/devops_cli/ai/personas/challenger/returns nothing.
- Files:
src/devops_cli/config/constants.py,src/devops_cli/github/defect_classifier.py,.github/workflows/defect-pr-hardening-audit.yml.src/devops_cli/ai/review_schema.py,src/devops_cli/ai/review/verdicts.py,src/devops_cli/ai/review/adjudication.py.src/devops_cli/ai/personas/challenger/role.md,src/devops_cli/ai/personas/challenger/prompt.md.- Tests:
tests/test_defect_classifier.py,tests/test_pr_hardening_report.py,tests/test_review_verification.py,tests/test_verdict_writers.py,tests/test_verdict_polarity.py,tests/test_ui_reactive.py,tests/test_construct_aware_location.py. changelog.d/1151.md.
- Tests first, each failing today unless marked as a guard:
Acceptance criteria (added to the criteria below, all of which stay)
-
git grep -n common_hallucinations -- src .githubreturns nothing. Undertests/, the name remains only in checks that the catalog stays gone or unwritten (tests/test_codebase_hygiene_and_shims.py:38,tests/test_personas.py:107,tests/commands/test_review.py:63, PR 5'smatch_hardening_surfacecase) and in feat(review): devops review score scores saved review sessions against a label file offline and reproduces the S11 and loop baselines #1138's label fixtures undertests/fixtures/review_labels/, which stay as recorded. -
CONST_HARDENING_SURFACESisAGENTS.md,src/devops_cli/ai/tasks/*.md,src/devops_cli/ai/knowledge_base/,.devops/review.tomlandsrc/devops_cli/review/rules/.docs/ROADMAP.mdstill matches nothing. - The workflow's intake body lists the same surfaces, and a test checks this.
-
devops pr hardening-reportcounts additions to.devops/review.tomlorsrc/devops_cli/review/rules/as hardening, and additions to acommon_hallucinations.jsonas none. -
rg -n "CONST_VERIFICATION_NOTE_KINDS|CONST_VERIFIER_|CONST_VERIFICATION_UNAVAILABLE|CONST_CRITERIA_NON_DISCRIMINATING|CONST_MITIGATION_UNPROVEN|CONST_CITATION_OUT_OF_RANGE|_unverified_note_counts|relocated_from|verification_note" srcreturns nothing. Undertests/,verification_noteandrelocated_fromappear only in PR 5's tests that assert they are gone. - profile.json's verdict distributions have no
verification_notekey. - A finding that carries
verification_noteorrelocated_from, whether from a model reply or a saved session, loads without either field, and a test covers each path. No model text can set a pipeline-only note. - The challenger's
role.mdandprompt.mddescribe no findings, verification or invalidation, anddevops ai chat --persona challengerstill loads. - In
docs/SELF_IMPROVEMENT.md,common_hallucinationsappears only in section 2's calibration records, below the note that refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150 deleted the catalog. - PRs 1, 2, 3 and 5 say "Part of 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 only PR 4 carries a closing keyword for this item.
Current references
- Hardening surface:
src/devops_cli/config/constants.py:2953-2960, with the catalog at:2959.src/devops_cli/github/defect_classifier.py:5-7and:94-117, with the catalog branch at:114-117..github/workflows/defect-pr-hardening-audit.yml:68-72.tests/test_defect_classifier.py:83-104, with the catalog cases at:94-96.tests/test_pr_hardening_report.py:164-191, with the catalog file at:169and the "1 of 3" count at:191.- Checks that keep the name:
tests/test_codebase_hygiene_and_shims.py:38,tests/test_personas.py:107,tests/commands/test_review.py:63.
- Successors:
docs/adr/0005-review-findings-come-from-tools-not-models.md:50.src/devops_cli/review/suppression.py:72.src/devops_cli/review/rules/.
- Note kinds:
src/devops_cli/config/constants.py:3359-3403(the ten constants at:3363-3389, the tuple at:3392-3403) and the details row at:2738.
- The
verification_notefield and its writers:src/devops_cli/ai/review_schema.py: import at:35, field at:691-695, reset at:1443, strip at:1465(docstring:1457-1459), distribution at:1589, counter at:1593-1606.src/devops_cli/ai/review/verdicts.py:96,:161and:179.src/devops_cli/ai/review/adjudication.py:63.- Callers that pass no note:
src/devops_cli/ai/review/adjudication.py:185-191andsrc/devops_cli/ai/review/pipeline.py:896.
- Note tests:
tests/test_review_verification.py:197-223and:240-272,tests/test_verdict_writers.py:326-347,tests/test_verdict_polarity.py:239,tests/test_ui_reactive.py:871and:890. relocated_from:src/devops_cli/ai/review_schema.py:696and:1158; its test is attests/test_construct_aware_location.py:9-27.- Challenger:
src/devops_cli/ai/personas/challenger/role.md:1andprompt.md:1-13.- Loaded at
src/devops_cli/ai/personas/__init__.py:63-69:system_prompt(role,ai/tasks/review.md, prompt) at:68,chat_prompt(role,ai/tasks/chat.md) at:69. - Read at
src/devops_cli/commands/ai.py:1072(chat,chat_prompt) and:1288(pipeline,system_prompt). - KB line:
src/devops_cli/ai/knowledge_base/devops_cli/architecture.md:94.
.devops/review.mdreaders that PR 4 removes:tests/test_personas.py:119and:137.docs/SELF_IMPROVEMENT.md:- Catalog mentions at
:253,:280,:292,:370-371and:401, and at:456, which is already under the existing note. - The records start at
:197, and the existing history note is at:438-441.
- Catalog mentions at
Dependencies and order
- fix(github): a pull request that delivers part of an item says Part of #N and passes readiness #1617 (open, v0.2.37): the part PRs start after it merges, so that readiness accepts "Part of 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".
- fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation #876 (open, v0.2.37, P2): it no longer waits for PR 1.
- Its fix is in
_execute_single_group_job(src/devops_cli/review/analysis.py:689). - PR 1 changes
_run_group_analysis_stage(src/devops_cli/ai/review/pipeline.py:4191). - Whichever lands second rebases
tests/test_review_group_analysis.py.
- Its fix is in
- refactor(review): review session store that owns layout, fingerprints and verdicts #771 (open, v0.2.40, P1): the order is unchanged.
- 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 (open, backlog, P2): they follow refactor(review): review session store that owns layout, fingerprints and verdicts #771 (D13, D19) and are no longer in v0.2.37.
- refactor(review): report rendering leaves the orchestrator #1008 (open, backlog, P3, blocked): it waits for PR 2.
- refactor(review): the review's single-owner tables move out of config/ into ai/review/ and review/ #1025 (open, backlog, P3, blocked): it waits for PR 2 and PR 3, docs(agents): a matching table lives beside its one owner, and moves to config/ only when a second package imports it #1016 (v0.2.38) and refactor(config): the config barrel and the unused config names go, and the package inits stop re-exporting #776 (v0.2.38).
- Decision D15 (owner, 2026-10-17): refactor(review): the review's single-owner tables move out of config/ into ai/review/ and review/ #1025 widens to cover src/devops_cli/review/, with no new sibling item.
- That scope now includes PR 3's
diff.pyandtargets.py.
- docs(agents): a matching table lives beside its one owner, and moves to config/ only when a second package imports it #1016 (open, v0.2.38, P3): it writes
tests/fixtures/config_placement_baseline.json, an exact list of config names that may only shrink. Any of this item's PRs that lands after it and deletes a listed name, such as PR 5's note constants, also deletes that name's entry. - 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 feat(ai): knowledge-base manuals state the tool, language and dependency versions they apply to, and reviews ground explanations in the manuals that match the reviewed project #1149 (open, v0.2.38, P1): they build on PR 1 (order only).
- fix(review): Semgrep runs pinned and offline with metrics off, from a cached registry ruleset plus devops-cli's tested rule pack #1144 (open, backlog, P1) and fix(review): a branch review leaves the files it deletes out of persona pages and scanners, and a file a scanner cannot read does not mark the scanner failed #1140 (open, backlog, P2): unchanged.
- Closed:
- feat(review): review page size against quality and speed #480 and fix(review): the devsecops persona does not treat a function parameter as untrusted until it quotes where an untrusted value enters it #1052, as not planned (D7).
- 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 (v0.2.28), feat(review): devops review score scores saved review sessions against a label file offline and reproduces the S11 and loop baselines #1138 (v0.2.30), refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150 (v0.2.33), refactor(review): delete the legacy segment engine so the orchestrator is the only review engine #995 (v0.2.34) 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 (v0.2.36).
Ready: implementation plan (refined 2026-10-17 at 3dd7fa6)
This section supersedes any text below that conflicts with it.
Decisions
- Keep an opt-in for comparison: no. The saved S11–S21 sessions and
tests/fixtures/review_labels/labels.json(feat(review): devops review score scores saved review sessions against a label file offline and reproduces the S11 and loop baselines #1138) are the baseline, and pre-1.0 keeps no flag for a deleted stage. - The challenger persona: its review use goes and it stays a chat persona.
ai/personasstays becausedevops aireadsPersonaDefinition.system_prompt(commands/ai.py:896,:1288,ai/pydantic_ai_bridge.py:368), soai/tasks/review.mdstays too; only the review-only prompts go (code_review_prompt.md,config_review_prompt.md,docs_review_prompt.md,mcp_code_review_output.md). - Slice order: group analysis is made independent of the persona stage first (PR 1), then the deletions. Group analysis is gated on the persona list today (
pipeline.py:4198,:4854), which is empty for a review of routed files alone (runner.py:1171) and would be empty for every review once personas are deleted. - What replaces
_are_findings_duplicateand consolidation: exact identity. EachSavedFindingcarriesfingerprint, copied from the admitted finding'sfingerprint_v2in_sanitize_admitted_candidate; the report keeps one row per (fingerprint, location), and adjudication finds a raised finding's copy in findings.json by the same key. Every reported finding is now admitted with a fingerprint, so no fuzzy title match is needed, and the key is order-independent as Q17 asked. - Why not call
normalization.deduplicatedirectly: it takesNormalizedFindingand recomputes each fingerprint from file text it reads by a path relative to the working directory (normalization.py:364-369,:181-187), which in a review is not the reviewed tree. The (fingerprint, location) key is whatdeduplicatecomputes when it has the text: the fingerprint plus an occurrence per line (normalization.py:357-402). _refuse_reported_elsewhereand thecandidate_already_reportedmessage are deleted. Rows are no longer merged, so a raised finding's copy is always found by its key.- Switching group analysis off:
--no-group-analysisonreview path|branch|pr. There is no--group-analysis-only, and the unwiredgroup_analysis_onlyparameter ofresolve_stage_flagsis deleted, because group analysis needs the static scan's admitted findings. - The model client: built only when a model stage is on. In PR 1 that is
persona_review or group_analysis; after PR 2 it isgroup_analysisalone. The orchestrator takesllm_client: ReviewLLMClient | None, theLLMClient()fallback (pipeline.py:2430) goes, and pre-analysis sizes its workers fromDEFAULT_PRE_ANALYSIS_WORKERSwhen there is no client. --persona,--all,--no-persona-reviewand--persona-review-only: deleted fromreview path|branch|pr,review benchmarkandreview samples validate. The MCP review tools lose theirpersonaargument, and the MCP promptcode_review_promptgoes.- The reranking stage,
--no-rerankingand--reranking-only: deleted. Since refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150 it only recountsreportableand rewritesfiles/(pipeline.py:3811-3872), and_collect_and_deduplicate_findingsapplies the same filter. - Who produced a finding:
SavedFinding.personaandpersona_titleare replaced byproducer(the tool name from the admitted finding), andReviewSessionPayload.personasis deleted. One name then serves the session files,review statsand the metric. review stats --persona: no such option exists. The per-persona table (commands/review.py:1225-1282) becomes a per-producer table. For the same reason, the feedback export'sFeedbackRecord.persona(exporter.py:44) becomesproducer, anddevops ai prompt-eval --persona(commands/ai.py:1924-1927) becomes--producer.- Telemetry:
devops_cli_findings_total's labelpersonabecomesproducerin PR 2, together with the code that emits it (runner.py:964-993) and the dashboard panel (k8s/monitoring/dashboards/devops-cli.json:697). PersonaExecutionError: deleted with its exports and its ERRORS.md entry. Nothing raises it.- Project conventions (
AGENTS.md,.devops/review.md): only persona prompts read them (pipeline.py:3360-3398,:3511,:3744), so their loading, the PR-head copy of convention files (runner.py:866-895) and.devops/review.mdgo. The rules in that file that can be enforced are already.devops/review.tomlsuppressions (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), which settles feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137's Q10. - The chunker: deleted in PR 3. Diff parsing (
extract_diff_hunks,extract_file_diff_hunks,extract_added_diff_lines, the header parser made public asdiff_file_names, and one numbered block per file) moves tosrc/devops_cli/review/diff.py.find_repo_filesand the routing predicate move tosrc/devops_cli/review/targets.py. The predicate is renamedis_secret_scan_onlyand keeps its behaviour, so the scanned file set does not change. - Page size:
review_page_chars,review_setup'spage_charsandreview_page_tokensgo.devops ai gateway tune's default prompt size becomesDEFAULT_GATEWAY_TUNE_PROMPT_TOKENSinconfig/defaults.py, derived asDEFAULT_ANALYSIS_REFERENCE_BUDGET_CHARS / CONST_REVIEW_CHARS_PER_TOKEN, because the group-analysis job is now the gateway's main review load. - fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation #876: no longer superseded. It is re-scoped to group-analysis replies and lands after PR 1. This item supersedes only fix(review): the devsecops persona does not treat a function parameter as untrusted until it quotes where an untrusted value enters it #1052 and feat(review): review page size against quality and speed #480.
Delivery
- PR 1 (M): group analysis without personas. It removes the
has_personasgate, adds--no-group-analysis, fixesReviewStageFlags.to_dict()(which omitsgroup_analysis), addsReviewStageFlags.needs_model(), builds the client only whenneeds_model()is true, and regenerates the CLI docs. Tests first, each failing today:devops review pathwith--no-persona-review --no-group-analysisandLLMClientpatched to raise on construction exits 0 (today the client is built unconditionally);--no-group-analysismakes zero calls to a fake client and writes no analysis.json (today the option does not exist); a review whose every file is routed to the secret scan alone, with one admitted Gitleaks finding, calls the fake client once and writes analysis.json (todaypersonas=[]switches group analysis off,runner.py:1171);to_dict()holds all six stages. Files:src/devops_cli/ai/review/flags.py,src/devops_cli/ai/review/pipeline.py,src/devops_cli/ai/review/runner.py,src/devops_cli/commands/review.py,src/devops_cli/lang/en/help.py,tests/test_review_stage_flags.py,tests/test_review_group_analysis.py, generateddocs/commands/*.mdanddocs/CLI_REFERENCE.md. Refs 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 2 (L): the deletions.
- Deleted: the persona stage (
pipeline.py:238-418,:922-960,:982-1005,:1192-1230,:1814-2011,:3360-3872), with its RAG and contract-grounding calls;classification.py;contract_grounding.py; the review-only prompts; consolidation (review_schema.py:931-1212);ai_scratchpad; the reranking stage; the persona flags and MCP arguments; the convention loading; the profile's persona fields (profile.py:147-149,:199-238) and the corpus score's persona columns that read them (commands/review.py:1860-1870,:1934);PersonaExecutionError. - Added:
SavedFinding.fingerprintandproducer, withFeedbackRecord.produceranddevops ai prompt-eval --producer. The report dedupes by (fingerprint, location), adjudication keys copies the same way, andReviewSessionPayload.sorted_findingsbecomessort_findings(self.findings). - Telemetry and docs: the metric label becomes
producer, the dashboard panel follows, and the CLI docs are regenerated. - Tests first: two payloads holding one admitted finding give one row, and two findings with one fingerprint at different lines give two rows; a verdict on a raised finding is mirrored on its findings.json copy found by key; a full
devops review path --no-group-analysiswith a fake client records zero calls; the removed options exit 2;importlib.util.find_specis None fordevops_cli.ai.review.classificationanddevops_cli.ai.review.contract_grounding; an emitted findings metric carriesproducer. - Files:
src/devops_cli/ai/review/pipeline.py,runner.py,adjudication.py,profile.py,flags.py,src/devops_cli/ai/review_schema.py,src/devops_cli/ai/mcp/server.py,src/devops_cli/ai/mcp/__init__.py,src/devops_cli/commands/review.py,src/devops_cli/ai/review/exporter.py,src/devops_cli/ai/prompt_eval.py,src/devops_cli/commands/ai.py,src/devops_cli/exceptions/ai.pyand the modules that re-export it,src/devops_cli/telemetry/instruments.py,k8s/monitoring/dashboards/devops-cli.json,docs/TELEMETRY.md,docs/ERRORS.md, deletedsrc/devops_cli/ai/review/classification.py,contract_grounding.pyand the four prompts, and the tests that cover only deleted code. - Refs 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.
- Deleted: the persona stage (
- PR 3 (M): pages go. It deletes
chunker.py, moves its survivors tosrc/devops_cli/review/diff.pyandsrc/devops_cli/review/targets.py, makes branch, PR and path reviews hand one block per file to the pipeline with no size cap, deletesreview_page_chars,page_charsandreview_page_tokens, and addsDEFAULT_GATEWAY_TUNE_PROMPT_TOKENS. Tests first: a branch diff larger thanDEFAULT_REVIEW_MAX_DIFF_CHARSyields one block per changed file with the same added lines and hunks as today;review_setup()has nopage_chars;devops ai gateway tunewithout--prompt-tokenssends the new default. Files:src/devops_cli/ai/review/runner.py,pipeline.py,sample_validation.py,__init__.py,src/devops_cli/commands/review.py,src/devops_cli/ai/run_store.py,src/devops_cli/ai/gateway_tune.py,src/devops_cli/commands/ai_gateway.py,src/devops_cli/config/defaults.py, newsrc/devops_cli/review/diff.pyandtargets.py,tests/test_review_path.py,tests/test_review_page_line_numbers.py,tests/test_review_path_routing.py. Refs 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 4 (M): hand-written docs. It covers README.md's title, feature line and persona list (
README.md:118-122), DEVCONTAINER_USAGE.md's persona examples, AGENTS.md §5 ("Multi-Persona Code Review",AGENTS.md:202),docs/SELF_IMPROVEMENT.md,docs/KNOWN_ISSUES.md:34-39, the KB's architecture, code-review and RAG articles, thedevops review --explainpersonas section (ai/explain.py:147), anddocs/github-pages.config.yaml:19anddocs/_layouts/default.html:85. It replaces CONTEXT.md's code-review Finding and Known false positive entries with feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137's Finding, Anchor, State, Suppression, Coverage gap, Lead and Rule pack entries; Verdict changes with feat(review): feedback export counts each review subject once and keeps every human verdict #877. It deletes.devops/review.md. Tests first:rg -n -i "multi-persona|persona review|reviewer persona" README.md AGENTS.md CONTEXT.md docs/*.md src/devops_cli/ai/knowledge_base src/devops_cli/ai/explain.pyreturns nothing (--personastays documented fordevops ai chat), anduv run devops docs checkpasses. Closes 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.
Acceptance criteria
- With
--no-group-analysis,devops review path|branch|prconstructs no model client and makes no model call. With group analysis on, it constructs one client, and only group analysis calls it. - Group analysis runs whenever its flag is on, whichever other stages run, and
ReviewStageFlags.to_dict()includes it. -
rg -n "execute_multi_persona_review|consolidate_duplicate_findings|_are_findings_duplicate|classify_file_context|contract_grounding|review_page_chars|review_page_tokens|split_review_pages|ai_scratchpad|persona_review|all_personas|PersonaExecutionError" -t py src testsreturns nothing, andsrc/devops_cli/ai/review/chunker.pydoes not exist. -
--persona,--all,--no-persona-review,--persona-review-only,--no-rerankingand--reranking-onlyexit 2 as unknown options. The MCPreview_path,review_branchandreview_prtools have nopersonaparameter. - Every finding in findings.json carries
fingerprintandproducer. Duplicates of one admitted finding give one row, and one fingerprint at two lines gives two rows. -
devops_cli_findings_totalis labelled byproducer, and the dashboard panel anddocs/TELEMETRY.mdsay so. -
devops aichat and agent commands still load every persona, and their tests pass unchanged. - (person-run) 3 fresh
--no-group-analysisruns on the loop input give identical findings.sarif, apart from run ids and timestamps, and 0 model calls in profile.json. - Tests run offline with fakes and recorded tool output: no network, no real scanner and no model, and each test runs under 1 s.
-
changelog.d/1151.mdrecords the change;CHANGELOG.mdanddocs/ROADMAP.mdare not edited. -
uv run devops cipasses.
Current references
- Persona stage call:
src/devops_cli/ai/review/runner.py:1061-1064; reranking call::1066-1067. - Persona stage code:
src/devops_cli/ai/review/pipeline.py:238-418,:922-960,:982-1005,:1192-1230,:1814-2011,:3400-3810; reranking:3811-3872. - Review-time RAG and contract grounding:
src/devops_cli/ai/review/pipeline.py:1814-1862. - Group analysis gate:
src/devops_cli/ai/review/pipeline.py:4191-4198, call:4854;run_group_analysis:src/devops_cli/review/analysis.py:753. - Stage flags:
src/devops_cli/ai/review/flags.py:10-41,:44-94. - Client construction:
src/devops_cli/ai/review/runner.py:86-90,:461-478; callerssrc/devops_cli/commands/review.py:322,:534,:842; fallbacksrc/devops_cli/ai/review/pipeline.py:2430. - Flags on the commands:
src/devops_cli/commands/review.py:204-211,:244-259(path),:420-427,:464-479(branch),:723-730,:767-782(pr),:1443-1450(benchmark),:2264-2266(samples validate). - Consolidation:
src/devops_cli/ai/review_schema.py:931-1212;_are_findings_duplicate:1003;sorted_findings:1306-1308;SavedFinding:1256-1268. - Report dedupe:
src/devops_cli/ai/review/pipeline.py:3875-3884; admission copy point_sanitize_admitted_candidate:604-623; persona stamp on tool findings_wrap_static_findings:448-460. - Adjudication:
src/devops_cli/ai/review/adjudication.py:33,:194-211,:214-221,:224-264. - Admitted fingerprint:
src/devops_cli/review/admission.py:154-162,src/devops_cli/review/finding.py:43. - Normalization dedupe:
src/devops_cli/security/normalization.py:457-472, occurrence indices:357-402. - Metric:
src/devops_cli/ai/review/runner.py:964-993,src/devops_cli/telemetry/instruments.py:57,docs/TELEMETRY.md:26,k8s/monitoring/dashboards/devops-cli.json:697. - MCP:
src/devops_cli/ai/mcp/server.py:165-206, stats:229, prompt:3040-3056;src/devops_cli/ai/mcp/__init__.py:24,:169. - Chunker importers:
src/devops_cli/ai/review/pipeline.py:46-51,:2040,:3277;runner.py:19-23,:732,:805;src/devops_cli/commands/review.py:597;src/devops_cli/ai/review/sample_validation.py:24;src/devops_cli/ai/review/__init__.py:17. - Page size:
src/devops_cli/ai/run_store.py:150-162;src/devops_cli/ai/gateway_tune.py:377-381;src/devops_cli/commands/ai_gateway.py:452;DEFAULT_ANALYSIS_REFERENCE_BUDGET_CHARSsrc/devops_cli/config/defaults.py:1005. - Profile persona fields:
src/devops_cli/ai/review/profile.py:147-149,:199-238. PersonaExecutionError:src/devops_cli/exceptions/ai.py:156.- Conventions:
src/devops_cli/ai/review/pipeline.py:3360-3398;src/devops_cli/ai/review/review_environment.py:26-32,:149-150;src/devops_cli/ai/review/runner.py:866-895;src/devops_cli/config/constants.py:486. - Feedback export and prompt-eval:
src/devops_cli/ai/review/exporter.py:38-65;src/devops_cli/commands/ai.py:1922-1927;src/devops_cli/ai/prompt_eval.py:82-83. - Docs:
README.md:1,:19,:118-122;AGENTS.md:202;docs/KNOWN_ISSUES.md:34-39;src/devops_cli/ai/explain.py:147;CONTEXT.md:135-149.
Dependencies and order
- 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, refactor(review): delete the legacy segment engine so the orchestrator is the only review engine #995, refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150 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.
- PR 1 lands first among the v0.2.37 review items. fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation #876 (re-scoped to group-analysis replies) follows it.
- refactor(review): review session store that owns layout, fingerprints and verdicts #771: its PR 1 and PR 2 can land after this item's PR 1. Its PR 3, which moves adjudication into the store, lands after this item's PR 2, which replaces
_are_findings_duplicatethere. - feat(review): feedback export counts each review subject once and keeps every human verdict #877 (v0.2.37): after PR 2. Its matcher becomes the (fingerprint, location) key, because
_are_findings_duplicateis gone. It also lands after refactor(review): review session store that owns layout, fingerprints and verdicts #771's PR 3, which moves the exporter. - feat(review): verified findings about merged code enter the roadmap through intake #883 (v0.2.37): after refactor(review): review session store that owns layout, fingerprints and verdicts #771's PR 3. It reads findings by fingerprint through the store.
- fix(review): Semgrep runs pinned and offline with metrics off, from a cached registry ruleset plus devops-cli's tested rule pack #1144: independent. It touches the pipeline only at
_scan_semgrepand the coverage matrix, so either may land first. - fix(review): the devsecops persona does not treat a function parameter as untrusted until it quotes where an untrusted value enters it #1052 and feat(review): review page size against quality and speed #480: a person closes them as not planned when PR 4 merges.
- fix(review): a branch review leaves the files it deletes out of persona pages and scanners, and a file a scanner cannot read does not mark the scanner failed #1140: its persona-page half is moot after PR 2. Its per-file failure status remains.
- 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 feat(ai): knowledge-base manuals state the tool, language and dependency versions they apply to, and reviews ground explanations in the manuals that match the reviewed project #1149 (v0.2.38) build on group analysis after PR 1.
Problem
- Persona rows: S11 1/17 valid; loop 26/219. 90 findings appeared in only one run, 84 of them false. Jaccard 0.131.
- Review-time RAG is pure cost: 602–1,980 worker-s per run for 0 results.
- Two engines exist (refactor(review): delete the legacy segment engine so the orchestrator is the only review engine #995).
Acceptance criteria
- Deleted, with no flags and no re-exports:
- the persona stage [code: pipeline.py:949-987, :1539-1652, :2574-2984] and classification.py;
- chunker.py, with
review_setup's page size [code: ai/run_store.py:146] andreview_page_tokens[code: ai/gateway_tune.py:379]; - the review prompts in
ai/tasksand stages/adversarial_debate.py; - consolidation [code: ai/review_schema.py:1039-1248] and
ai_scratchpad; - review-time RAG lookups and contract_grounding.py;
- the legacy engine [code: runner.py:874-1361] and its fork, through refactor(review): delete the legacy segment engine so the orchestrator is the only review engine #995, a child that lands first so
runner.pyis not deleted by two items.
-
ai/personasstays for chat and analysis. It is imported bycommands/ai.py,ai/tools/registry.py,ai/pydantic_ai_bridge.pyandai/analyze/outlines.py. Only review-specific prompts go. -
--persona,--alland the MCP review tools' persona argument are removed [code: ai/mcp/server.py:137-183]. - Telemetry:
devops_cli_findings_total'spersonalabel becomesproducer[code: docs/TELEMETRY.md:20], and dashboards are updated. - Docs:
- README.md's title and persona sections [README.md:1, :19];
- the
--personaexamples in DEVCONTAINER_USAGE.md and CLI_REFERENCE.md; PersonaExecutionErrorin ERRORS.md and the exceptions module, if no remaining caller raises it;- AGENTS.md §5 through its generator;
- the KB's architecture and RAG articles;
- the release-epic step "Multi-Persona Review Verification", which becomes "tool review".
- A test asserts that
devops reviewbuilds a model client only when an explanation stage is on. - (person-run) 3 fresh runs on the loop input give identical findings.sarif and 0 model-originated rows.
- Tests run offline with fakes and recorded tool output: no network, no real scanner, no model; each test under 1 s.
-
changelog.d/<n>.mdrecords the change;CHANGELOG.mdanddocs/ROADMAP.mdare not edited. -
uv run devops cipasses.
Key questions
-
Keep an opt-in for comparison? (proposed) No. The saved S11–S21 sessions are the baseline.
-
The challenger persona (refactor(review): one rulebook for known false positives #770's question)? (proposed) Its review use goes with this item; it stays as a chat and stream persona.
Strategic alignment
- Milestone: none; the roadmap tooling places it. Depends on: 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.
- Children:
- refactor(review): delete the legacy segment engine so the orchestrator is the only review engine #995: the legacy segment engine (lands first; it carries fix(review): multi-page reviews drop unverified findings and can recommend approval #789's orchestrator test).
- Supersedes (each frozen now, closed as not planned when this item lands): fix(review): a group-analysis reply cut at its token cap is rejected, not shown as a checked explanation #876, fix(review): the devsecops persona does not treat a function parameter as untrusted until it quotes where an untrusted value enters it #1052 (its devsecops prompt stays for chat; only the review rule goes), feat(review): review page size against quality and speed #480.
- Parent: feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137 (phase P1b).
- Evidence tags ([measured: …], [code: path:line], [sourced: …], [estimate], [inference]; "S11" is the single review run of 2026-10-03 and "the loop" the ten runs S12–S21; c-feasibility and c-fidelity are the two design critiques) are explained in feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137.
Update 2026-10-08: refinement
#871 landed; #995 lands first. The stage is now ai/review/pipeline.py:1163-1201, :1860-1942 and :3203-3613; the old ranges hold #871's admission code and the verifier (from :3614, #1150's), which stay out of this item. Legacy engine runner.py:873-1370; MCP persona argument ai/mcp/server.py:167-211.
Proposed design
Problem statement
The devops-cli project needs to refactor its codebase by removing the persona review stage, the legacy segment engine, and review-time RAG features. These components are deemed costly and redundant, with the persona review stage showing poor consistency (Jaccard 0.131) and review-time RAG consuming excessive resources (602–1,980 worker-seconds per run for zero results). The refactor will simplify the review process and reduce operational overhead.
Acceptance criteria
- Criterion 1: The persona stage code is deleted with no remaining exports or flags
Verification: Verify that pipeline.py lines 949-987, 1539-1652, 2574-2984 and classification.py are removed from the codebase - Criterion 2: Chunker.py is deleted with related page size and review_page_tokens variables
Verification: Verify that chunker.py is removed and ai/run_store.py line 146 and ai/gateway_tune.py line 379 are deleted - Criterion 3: Review prompts in ai/tasks and adversarial_debate.py are removed
Verification: Verify that the review prompts files and stages/adversarial_debate.py are deleted from the codebase - Criterion 4: Consolidation code and ai_scratchpad are deleted
Verification: Verify that ai/review_schema.py lines 1039-1248 and ai_scratchpad module are removed - Criterion 5: Review-time RAG lookups and contract_grounding.py are deleted
Verification: Verify that review-time RAG code and contract_grounding.py are removed from the codebase - Criterion 6: Legacy engine in runner.py is deleted
Verification: Verify that runner.py lines 874-1361 are removed - Criterion 7: The ai/personas module stays for chat and analysis but removes review-specific prompts
Verification: Confirm that ai/personas is not deleted but review-specific prompts are removed from it - Criterion 8: The --persona, --all and MCP review tools' persona argument are removed
Verification: Verify that ai/mcp/server.py lines 137-183 no longer contain these arguments - Criterion 9: Telemetry label 'persona' becomes 'producer' in devops_cli_findings_total metric
Verification: Check that docs/TELEMETRY.md line 20 shows the persona label is renamed to producer and dashboards are updated - Criterion 10: Documentation sections about persona are removed or updated
Verification: Verify README.md title and persona sections, DEVCONTAINER_USAGE.md and CLI_REFERENCE.md examples, ERRORS.md, AGENTS.md section 5, KB articles, and release-epic step are updated - Criterion 11: A test asserts that devops review builds a model client only when an explanation stage is on
Verification: Run tests to ensure the assertion that model client is built only for explanation stages holds true - Criterion 12: 3 fresh runs on loop input give identical findings.sarif and 0 model-originated rows
Verification: Execute 3 fresh runs on loop input and verify they produce identical findings.sarif files with no model-originated rows - Criterion 13: Tests run offline with fakes and recorded tool output: no network, no real scanner, no model; each test under 1 s
Verification: Run all tests in offline mode with fakes and recorded outputs ensuring they complete within 1 second each
Key questions
- Keep an opt-in for comparison?: No. The saved S11–S21 sessions are the baseline. (proposed)
- The challenger persona (refactor(review): one rulebook for known false positives #770's question)?: Its review use goes with this item; it stays as a chat and stream persona. (proposed)
Fit
Needs splitting into 2 items:
- Delete legacy segment engine (refactor(review): delete the legacy segment engine so the orchestrator is the only review engine #995) which lands first
- Delete the persona review stage, legacy engine and review-time RAG features in main item
Suspected block
None.
Dependencies
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 11, 2026
Proposal needs splitting into 2 items at 6e862cd (see proposed design in issue body).
dan-petty commentedon Oct 17, 2026
Readiness check for v0.2.37, against
release/v0.2.36at 22d8748. Line numbers are at that commit.Status: needs a split. It is partly done: #995 deleted the legacy engine and
adversarial_debate.py.Today
src/devops_cli/ai/review/runner.py:1061-1063runsexecute_multi_persona_review.src/devops_cli/ai/review/pipeline.py:238-418,:922-1005,:1192-1230,:1814-1972and:3400-3870.:1814-1862.classification.py,contract_grounding.pyandchunker.pystill exist.src/devops_cli/commands/review.py:206/210,422/426and725/729.References that moved
run_store.py:146→:150-162.gateway_tune.py:379→:377-381, called fromai_gateway.py:452.review_schema.py:1039-1248→:931-1212.mcp/server.py→:165-206, plus the prompt at:3041-3056and the stats tool at:229.TELEMETRY.md:20→:26.SELF_IMPROVEMENT.md:568anddevops-cli.json:697.Dependencies
Gaps in the body
extract_added_diff_lines(:2040);extract_file_diff_hunks(:3277);find_repo_files(src/devops_cli/ai/review/sample_validation.py:24);diff_pagesand_extract_header_filenames(runner.py:732,:805,:1048).adjudication.py:33and:203, and bypipeline.py:3884. Should it move tonormalization.deduplicate(:457)?pipeline.py:4198,:4854), and there is no flag to turn it off.--no-persona-review,--persona-review-only,--no-reranking, the reranking stage andreview stats --persona?Couplings
_are_findings_duplicateaffects refactor(review): review session store that owns layout, fingerprints and verdicts #771, which should land after this or agree on its replacement.Slices (L overall)
(M) Decouple group analysis from personas:
--no-group-analysis;commands/review.py:322,:534,:842);A "no client when it's off" test comes first.
(L) The deletions. The chunker's surviving functions move to
review/diff.py.(M) Telemetry, dashboards and docs.
dan-petty commentedon Oct 17, 2026
Moved to the backlog: it was New, not Ready, when v0.2.37 started. (devops roadmap reprioritize)
refactor(review): group analysis without personas (Part of #1151) (#1765
refactor(review): delete persona review stage, legacy engine, and rev…
refactor(review): remove #1150 leftovers from hardening surface, find…
refactor(review): diff parsing and target extraction relocations to d…
refactor(review): update documentation, delete review.md and obsolete…
dan-petty commentedon Oct 21, 2026
What changed
#1775, merged into
release/v0.2.38as a592171.38 file(s) changed.
How it was verified
Check runs at 86cff68:
Acceptance Criteria of
docs/agent/tasks/task-1151-review-simplification-engine-deletions.md:No Acceptance Criteria section.
feat(release): v0.2.38 (#1799)
feat(release): v0.2.38 (#1798)
refactor(review): the synthetic corpus drops contradict-documented-de…
refactor(ai): delete devops ai pipeline and persona leftovers (#5044)