Repository navigation
Description
Part of #5164 (child 5).
Problem or Motivation
devops review is an agentic workflow that agents run on each branch and pull request. It writes no result line, so it gets no grade (#5164). devops review stats and the verdicts (docs/SELF_IMPROVEMENT.md) measure the precision of the findings, but no measure says how many review sessions end complete, how many retry a chunk or fall back to another model, and what a session costs.
Proposed Solution & Architectural Design
- Add the job
reviewto the result line (roadmap/job_result.py). - Attempt: one review session of a pull request, a branch or a path.
- Results:
completed(each file of the target reviewed and the report written),partial(a chunk failed or a budget stopped the session),failed. Intended result:completed. - First pass: completed with
chunk_retries= 0 andfallbacks= 0. - Counts:
files,chunks,chunk_retries,fallbacks,findings, and the attempt counts of the result line (model_calls,tokens,seconds,cost_usd_micros,gh_requests). repois the repository of the target, anditemis the pull request number ornone.- The precision of the findings stays in
review stats. The grade report shows it next to the grade when verdicts exist.
Target Subsystem
AI & Agentic Review Pipeline (src/devops_cli/review/).
Existing Tool Considered
devops review stats reads the verdicts and gives precision, not the success of a session. The line uses the writer of the roadmap jobs; no new tool. Cost: about 200,000 tokens, 5 hours elapsed.
Acceptance Criteria
- A test review session with a fake model writes one line with
result=completed first_pass=true. - A session with one failed chunk writes
result=partialand the class of the error. devops roadmap eval gradeslistsreview.
Dependencies
#5168 (the attempt context and first_pass), #5169 (a local run sends the line to Loki).
Owner decision 2026-11-13
The approved pipeline split (tracker #5482, Phase 7) uses this result line in the review unit (#5521).
- Live proof: after the merge and the release, a review session runs on an open bot PR. A comment gives its result line.
Proposed design
Problem statement
devops review writes no result line, so its sessions get no grade. The change adds a code_review job result line (the review job name already belongs to the roadmap verdict step, #5969) with the session result, the first-pass state, the file and finding counts and the cost. Finding precision stays in devops review stats.
Acceptance criteria
Requirement: Review session result line
Each review session SHALL write one job result line with job="code_review".
Scenario: A completed session writes one line
- WHEN a test review session runs with a fake model over one file and writes its report
- THEN the line has
job=code_review,result=completed,success=true,first_pass=true,files=1andfindings=0, with the attempt counts of the session.
Requirement: Partial result on a failed file
A review session SHALL write result="partial" when a file unit fails or a budget stops the session and the report is still written.
Scenario: A failed file unit records partial
- WHEN a test review session has one file unit that fails with an
AIClientErrorand writes its report - THEN the line has
result=partial,success=falseandclass=provider.
Requirement: Failed result with no report
A review session SHALL write result="failed" when it ends with no report.
Scenario: A session that raises before its report records failed
- WHEN a test review session raises an
AIClientErrorbefore it writes its report - THEN the line has
result=failed,success=falseandclass=provider.
Requirement: First pass from retry and fallback counts
The code_review result line SHALL set first_pass=false when chunk_retries or fallbacks is not zero.
Scenario: One chunk retry clears first pass
- WHEN a test logs a
code_reviewline withresult=completedandchunk_retries=1 - THEN the line has
first_pass=falseandchunk_retries=1.
Requirement: Review counts and attempt counts
The code_review result line SHALL carry the review counts and the attempt counts of the session.
Scenario: Counts come from the session
- WHEN a test review session reviews two files and raises one finding
- THEN the line has
files=2andfindings=1, andmodel_calls,tokens,seconds,cost_usd_microsandgh_requestsfrom the attempt context.
Requirement: Target repository and item
The code_review result line SHALL set repo to the target repository and item to the pull request number, or none for a branch or path target.
Scenario: A pull request target records its item
- WHEN a test review session targets pull request 123 of
owner/repo - THEN the line has
repo=owner/repoanditem=#123.
Requirement: Grade report lists code_review
The grade report SHALL list code_review when a result line for job code_review exists.
Scenario: The grades command lists code_review
- WHEN the test runs
uv run devops roadmap eval gradeswith a fake Loki client that returns one result line for jobcode_review - THEN the output lists
code_review.
Existing Tool Considered
OpenTelemetry logs (open, maintained, CNCF; https://opentelemetry.io/docs/specs/otel/logs/) covers one structured line per attempt and its export to the collector and Loki, which the project already uses for these lines (docs/roadmap/job-success.md:22, #5169). It lacks the roadmap job schema: the job set, the intended results, the first-pass rules and the grade are the project's own in src/devops_cli/roadmap/job_result.py. devops review stats gives finding precision only, not the success of a session. The change extends the existing writer rather than building a second one; written cost: about 200,000 tokens and 5 hours elapsed.
Key questions
- Where should the review session's result line be written?: Extend the existing result-line writer in
src/devops_cli/roadmap/job_result.py(log_job_result) and call it once fromexecute_review_workflowinsrc/devops_cli/ai/review/runner.py, so every path, branch and pull request session writes one line. Do not add a second writer. (best practice) [sources: src/devops_cli/roadmap/job_result.py:269, src/devops_cli/ai/review/runner.py:1369, docs/roadmap/job-success.md:7]- Chosen: Extend roadmap/job_result.py. The grade reads one schema and one job set, and the OpenTelemetry handler already exports this module's lines.
- Rejected: A review-specific result writer. It duplicates the schema, and
devops roadmap eval gradescannot read it.
- Which job name does the review session's line use?:
code_review. The namereviewalready belongs to the roadmap step that gives a bot pull request a verdict (RoadmapJob.REVIEW, resultsjudgedandfailed, feat(roadmap): a review job gives each bot PR its verdict #5969), so a secondreviewjob would collide with that job's result enum, success set and grade.code_reviewnames thedevops reviewsession and its report. (best practice) [sources: src/devops_cli/roadmap/job_result.py:61, src/devops_cli/roadmap/job_result.py:108, docs/roadmap/job-success.md:39, src/devops_cli/ai/review/runner.py:1369]- Chosen: code_review. It names the command's work and does not collide with the
reviewjob of the roadmap verdict step. - Rejected: review.
RoadmapJob.REVIEWexists with its own result enum and success set (feat(roadmap): a review job gives each bot PR its verdict #5969); a secondreviewbreaks the one-job-one-result-set rule and the grade. - Rejected: review_session. It puts
reviewandreview_sessionside by side in the job table, where a reader confuses the roadmap step with the code review command.
- Chosen: code_review. It names the command's work and does not collide with the
- Which review outcome maps to each result value?:
completedwhen each file of the target is reviewed and the report is written;partialwhen a file unit fails or a budget stops the session and the report is still written;failedwhen the session writes no report.successis true only forcompleted, and the job's result enum holds the three values. (best practice) [sources: src/devops_cli/ai/review/runner.py:1369, src/devops_cli/ai/review/runner.py:1487, docs/roadmap/job-success.md:26]- Chosen: Map the report and the file units to the result. The report and the state of each file unit are the observable facts of a session.
- Rejected: Use the exit code only. A session stopped by a budget can exit with a report and is not a failure.
- How is
first_passset for a review session?: Addcode_reviewtoFIRST_PASSwithCountLimit("chunk_retries", 0)andCountLimit("fallbacks", 0).is_first_passthen returns true only for acompletedsession with both counts at zero, and a retry or a fallback clears it. (best practice) [sources: src/devops_cli/roadmap/job_result.py:121, src/devops_cli/roadmap/job_result.py:172, docs/roadmap/job-success.md:90]- Chosen: Derive from the retry and fallback counts. The writer's first-pass rule already reads the counts of the job, and the counts are the fix rounds of a session.
- Rejected: Set from the session exit code. A retry that succeeds still exits zero but is not a first pass.
- Does the review session retry a chunk or fall back to another model today?: No.
execute_review_workflowbuilds one orchestrator and runs each file's payload once throughReviewWorkerPool; no module undersrc/devops_cli/ai/review/retries a chunk or counts a model fallback. Thechunk_retriesandfallbackscounts have no producer in the session yet. [sources: src/devops_cli/ai/review/runner.py:1369, src/devops_cli/ai/review/runner.py:1487, src/devops_cli/ai/review/pool.py:53] - Which counts belong in the review session's result line?:
filesandfindingsfrom the session, plusmodel_calls,tokens,seconds,cost_usd_microsandgh_requestsfrom the attempt context.chunksis not a unit of the session (the pipeline runs one payload per file), andchunk_retriesandfallbacksare deferred until the session has the retry and fallback behavior that produces them. (best practice) [sources: src/devops_cli/roadmap/job_result.py:207, src/devops_cli/ai/review/runner.py:1369, src/devops_cli/ai/review/pipeline.py:1]- Chosen: Add the review counts to the existing line. The grade and the cost report read one line, and the attempt context already holds the efficiency counts.
- Rejected: A separate review metrics file. It adds a second source, and the grade cannot join it.
- Rejected: Report chunk_retries and fallbacks now. The session records neither count, so the line would carry a number that no code measures.
- How should a partial or failed session record the error?: Put the
FailureClassof the stopping error in the line'sclassfield (providerfor a model failure,limit_reachedfor a budget stop), and keep the message out of the line. The writer takes aFailureClassand writes its value; the line has noerrorfield, and a Python exception class name is not a value of the taxonomy. (best practice) [sources: src/devops_cli/roadmap/job_result.py:269, src/devops_cli/roadmap/failure.py:67]- Chosen: Record the FailureClass. The class is a fixed name of the taxonomy, stable across versions, and reveals no secret.
- Rejected: Record the Python class name. The line's
classfield takes aFailureClass; a Python class name is not one, and the line has noerrorfield. - Rejected: Record the full error message. The message can hold paths, tokens or user data.
- How does
devops roadmap eval gradeslistcode_review?: Addcode_reviewtoRoadmapJob. The grade report lists every member ofRoadmapJob, so the job appears with no change to the command, and the test that maps each job to its result enum intests/roadmap/test_job_result.py:84gets the new job's enum. (best practice) [sources: src/devops_cli/roadmap/job_grade_report.py:523, tests/roadmap/test_job_result.py:84, docs/ROADMAP_WORKFLOW.md:496]- Chosen: Add code_review to the shared job set. One list keeps the writer, the grade report and the result-enum test in step.
- Rejected: Hard-code code_review in the grades command. The writer would accept a job that the grade report does not know.
- Does the result line replace
devops review stats?: No.devops review statsremains the source of finding precision; the result line records the session outcome and its cost. The grade report shows the precision next to the grade only when verdicts exist. (best practice) [sources: docs/SELF_IMPROVEMENT.md:91, docs/commands/review.md:244, src/devops_cli/commands/review.py:1388]- Chosen: Keep precision in review stats. Precision needs verdicts, and the result line records the outcome of a session.
- Rejected: Move precision into the result line. A session can have no verdict, so the line cannot hold precision.
- Which approved pipeline split uses this result line?: The approved pipeline split into jobs is tracker feat(roadmap): track the roadmap pipeline split into jobs #5482 (P3, AW-J1), recorded at
docs/ROADMAP_WORKFLOW.md:518; the issue's Owner decision of 2026-11-13 places this result line in its review unit (feat(roadmap): a review unit posts a COMMENT review on each ready PR #5521). [sources: docs/ROADMAP_WORKFLOW.md:518]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 12, 2026
Both work in the review session subsystem, but #771 builds the session store layout while the candidate adds a result-line writer for each session.devops-cli-service commentedon Nov 17, 2026
Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.