Repository navigation
Description
Problem
The grade of the stage job counts an attempt as a success when it opens a plan pull request (docs/roadmap/job-success.md, devops roadmap eval grades). This measure does not show if the plan can be built.
On 2026-11-14, an agent vetted 9 plan pull requests that the stage job opened between 23:23Z and 01:59Z: #5576, #5580, #5581, #5586, #5587, #5589, #5591, #5592 and #5593. Only #5580 (#3332) was safe. The other 8 had blocking defects, for example:
- docs(openspec): plan #3257 Require a fact for each rejected alternative #5576 (feat(roadmap): Require a rejected alternative with a fact #3257): the plan did not name
tests/support/builders.py, and its rule makes 571 tests fail. - docs(openspec): plan #1976 Add process-safety ast-grep rules #5591 (feat(ci): Add ast-grep rules for RLIMIT_NPROC, O_NONBLOCK, os.killpg #1976): the plan builds a rule on
fcntl.O_NONBLOCK, which does not exist (the flag isos.O_NONBLOCK). - docs(openspec): plan #3051 Check the strength of the new tests #5586 (feat(roadmap): new tests of an implementation are checked for strength #3051): the mutation run of the plan cannot finish in a runner Job.
In the same window, the stage grade was 9/10 over 6 h. The cost of a bad plan shows later, in the implement job: the implement attempt of #3257 used 36.2M tokens (the item budget is 40M) and 4710 s on that plan, and it stopped. Over 24 h, implement was 2/8, and its top failure class was outside_plan: the plan did not name a path that the failed check needed (#4449, #5272).
So the stage grade says that the job meets the 80% target, while most of its plans cannot be built.
Expected behavior
The stage grade shows how many plans can be built, from data that a program reads (no model judges the plan for the grade). Keep "opens a plan pull request" as the first step of a funnel, and add a measure of the plan outcome.
Fix options (the plan decides)
- A lagging plan outcome for each staged attempt. Success: the implement job reaches a ready pull request on that plan with no stop of a plan class (
outside_plan,plan_defect,tests_lost) and no plan revision. Failure: the plan pull request getsplan/needs-fix, a person closes it, or the implement job stops with a plan class. Open: no outcome yet. Show the funnel: attempts, plan pull requests, plans that build. - Report the tokens of failed implement attempts for each plan, so the cost of a bad plan shows next to the stage grade.
- Use the result lines and labels that already exist (
roadmap job result,implement attempt,plan/needs-fix). Add a field to a result line only where no current signal holds the outcome.
Test first: a fixture with a staged attempt whose plan later gets plan/needs-fix counts as a plan failure, and a staged attempt whose implement reaches a ready pull request counts as a plan success.
Related
- feat(roadmap): a fix-checks step fixes a failed check #5023: a fix-checks step that adds a missing path to the plan and runs the fix again.
- feat(roadmap): Stage items whose draft plan fails the check #3387 (docs(openspec): plan #3387 Re-stage an item whose draft plan fails #5581): re-stage an item whose draft plan fails.
- Owner direction 2026-11-14: "yes" to grading stage by plan quality.
Alternatives check of 2026-11-26: partly.
Tool: apache/devlake (https://github.com/apache/devlake), Apache-2.0, last activity 2026-11-26, maintained.
Reason: Searches found Apache DevLake, an open dev-data platform that ingests GitHub and CI data and builds metric dashboards, so it covers the collection and counting part; it reads none of the project's result lines and sums no implement tokens.
Covers:
- Ingests GitHub pull requests, issues and CI data sources
- Prebuilt Grafana dashboards for delivery and success rates
- Custom SQL metrics over the collected data
Lacks:
- No read of the plan= result lines
- No join of a staged attempt to its plan pull request
- No sum of tokens of failed implement attempts
- Needs a deployed platform beside the existing report
Proposed design
Problem statement
The stage grade counts a plan pull request as a success. It does not show if the plan can be built. Eight of nine plans from 2026-11-14 had blocking defects while the stage grade was 9/10. The change keeps plan pull requests as the first funnel step and adds a plan outcome measure from result lines and labels, with no model judgment.
Acceptance criteria
Requirement: Plan verdict failure
The plan outcome classifier SHALL mark a staged plan as a failure when the first verdict label of its plan pull request is verdict/fix-plan or verdict/discard-plan.
Scenario: Plan verdict is failure
- WHEN A fixture stage line has
result=staged plan=101, and plan pull request 101 has a first verdict labelverdict/fix-planorverdict/discard-plan. - THEN
plan_outcomereturns failure with reasonplan_needs_fixforverdict/fix-planandplan_discardedforverdict/discard-plan.
Requirement: Closed plan is failure
The plan outcome classifier SHALL mark a staged plan as a failure when a person closes its plan pull request without a merge.
Scenario: Plan closed
- WHEN A fixture stage line has
result=staged plan=101, and plan pull request 101 has stateCLOSEDandmergedAtnull. - THEN
plan_outcomereturns failure with reasonplan_closed.
Requirement: Built plan is success
The plan outcome classifier SHALL mark a staged plan as a success only when its implement line is drafted with forge outcome success and no failure signal exists.
Scenario: Plan builds
- WHEN A fixture has a stage line with
item=#1 result=staged plan=101, an implement line withitem=#1 result=drafted pull=202, pull 202 is merged, and plan 101 has no firstverdict/fix-planorverdict/discard-planlabel event. - THEN
plan_outcomereturns success.
Requirement: Plan class stop is failure with tokens
The plan outcome classifier SHALL mark a staged plan as a failure and carry its tokens when its implement line stops with one of outside_plan, plan_defect or tests_lost.
Scenario: Implement stops with a plan class
- WHEN A fixture has a stage line with
item=#1 result=staged plan=101, and three implement lines withitem=#1 result=stopped, classesoutside_plan,plan_defectandtests_lost, andtokens=36200000. - THEN
plan_outcomereturns failure with the class as the reason and tokens 36200000 for each line.
Requirement: Open plan
The plan outcome classifier SHALL return open when no success or failure signal exists.
Scenario: No outcome yet
- WHEN A fixture stage line has
item=#1 result=staged plan=101, plan 101 is open with no fix label, and no implement line exists. - THEN
plan_outcomereturns open.
Requirement: Funnel counts
The plan funnel SHALL count stage attempts, unique plan pull requests, plans that build, plan failures and open plans.
Scenario: Mixed plan outcomes
- WHEN A fixture holds four staged stage lines, three unique plan pull requests, one success, one failure and one open plan.
- THEN
plan_funnelreturns attempts 4, plan_pull_requests 3, plans_that_build 1, failures 1 and open 1.
Requirement: JSON stage row
The JSON report SHALL give each stage row a plan_outcome object with the funnel counts and the tokens of failed implement attempts.
Scenario: Stage row with plan cost
- WHEN
build_reportruns on a fixture with one plan success and one plan failure whose implement line hastokens=36200000. - THEN The stage row
plan_outcomehasplans_that_build1,failures1 andtokens36200000.
Requirement: Text report
The text report SHALL print the plan funnel and the tokens of failed implement attempts beside the stage grade.
Scenario: Text stage section
- WHEN The text report runs on the same fixture.
- THEN The stage section contains
Plans that build 1/2andFailed implement tokens 36200000.
Requirement: Stage line plan field
A stage result line for a staged attempt MUST contain a plan field that names its plan pull request.
Scenario: Stage line names plan
- WHEN The stage job writes a result line for a staged attempt that opened plan pull request 101.
- THEN The line contains
plan=101.
Requirement: Plan query captures plan
The stage query builder MUST capture the plan field and group the stage and implement outcomes by it.
Scenario: Plan query
- WHEN The stage query builder returns the LogQL query for a fixture.
- THEN The query contains
plan=(?P<plan>\S+)and a grouping clauseby (plan).
Requirement: No model call
The plan outcome report MUST read only result lines and pull request labels, with no model call.
Scenario: No model judgment
- WHEN
build_reportruns on the fixture with a patched model client that raises on any call. - THEN The report returns the funnel and the patched client records no call.
Requirement: Latest stage line joins
The plan outcome join SHALL attach an implement line to the latest staged line of the same item before the implement line.
Scenario: Second plan of one item
- WHEN Fixtures hold stage lines for item Release v0.1.8 #1 at 00:00 with
plan=100and at 01:00 withplan=101, and an implement line for item Release v0.1.8 #1 at 02:00. - THEN
plan_outcomeuses the plan number 101 from the 01:00 stage line.
Existing Tool Considered
The alternatives check of 2026-11-20 in the issue body records verdict none and no tool. No open, maintained tool or library covers the join of result lines to plan pull request labels and the plan-outcome funnel. The proposal extends the existing devops roadmap eval grades report and adds no library. Written cost of the new join: 40k tokens to build, 12k to keep and 8k to fix, about 2 days.
Key questions
- Which labels mark a plan that needs repair or discard?:
verdict/fix-planmarks a plan that needs repair, andverdict/discard-planmarks a plan that cannot be built. Both are plan failures. The issue text'splan/needs-fixis not the current workflow label. [sources: docs/roadmap/job-success.md, src/devops_cli/roadmap/workflow_labels.py] - Which failure classes count as plan failures in an implement stop?: The plan classes are
outside_plan,plan_defectandtests_lost. An implement line withresult=stoppedand one of these classes is a plan failure. Other classes are not plan failures. [sources: src/devops_cli/roadmap/failure.py, docs/roadmap/job-success.md, src/devops_cli/config/settings.py:1387] - How does the report link a staged attempt to its plan pull request?: Add an optional
plan=<n>field to the stage result line whenresult=staged. The stage job knows the plan pull request that it opened. The implement line joins to the latest staged stage line of the same item before it. An item and time join alone is ambiguous after a re-stage. (best practice) [sources: docs/roadmap/job-success.md, src/devops_cli/roadmap/job_result.py]- Chosen: Add plan field to stage line. The stage job knows the pull request number, and the line identifies the plan with no search.
- Rejected: Join by item and time only. A re-stage and a second plan of the same item make the join ambiguous.
- Rejected: Search GitHub by title for each attempt. It adds a request for each attempt and can match the wrong plan after a re-stage.
- What makes a staged plan a success?: A plan is a success when an implement line for the same item is
drafted, its delivery pull request has forge outcome success, no plan-class stop exists, and the plan pull request has no firstverdict/fix-planorverdict/discard-planlabel event. A ready line after a plan revision is not a success. (best practice) [sources: docs/roadmap/job-success.md, src/devops_cli/roadmap/job_grade_report.py, docs/adr/0005-review-findings-come-from-tools-not-models.md]- Chosen: Drafted with forge success and no failure label. It follows the success rule in the issue and uses the existing forge outcome, labels and result lines.
- Rejected: Any implement drafted line. It counts a plan that needed a fix as a success.
- Rejected: Drafted with no plan failure class. It misses the plan revision signal.
- What makes a staged plan a failure?: A plan is a failure when its plan pull request has a first
verdict/fix-planorverdict/discard-planlabel event, a person closes it without a merge, or an implement line is stopped with a plan class. An open plan with no such signal is open. (best practice) [sources: docs/roadmap/job-success.md, src/devops_cli/roadmap/failure.py, src/devops_cli/roadmap/workflow_labels.py]- Chosen: Failure label, close or plan-class stop. It uses the failure signals that the issue names and the existing labels and result lines.
- Rejected: Only a plan-class implement stop. It misses a plan that a label or a close already refused.
- Rejected: Any implement result that is not drafted. It counts an open plan and an infrastructure cut as a plan failure.
- How does the funnel count a re-staged plan pull request?: Each stage result line is an attempt. A plan pull request counts once by its plan number. The latest stage line for that plan gives its outcome. An earlier attempt on the same plan is not a second plan. (best practice) [sources: docs/roadmap/job-success.md, CONTEXT.md]
- Chosen: Count each plan number once. A re-stage updates one pull request, and the funnel shows attempts and plan pull requests as different steps.
- Rejected: Count each stage attempt as a plan. A re-stage updates one pull request and would inflate the plan count.
- Rejected: Count only the latest stage line. It hides the attempts that the funnel must show.
- How does the report get per-plan outcomes with no model call?: Use Loki metric instant queries grouped by the
planfield to get the sets of stage and implement outcomes. Addplanto the result-line regexp. Use the existing GraphQL search of bot pull requests for label events and closed state. Do the set operations injob_grade_report.py. A model makes no judgment. (best practice) [sources: docs/roadmap/job-success.md, src/devops_cli/roadmap/job_grade_report.py, docs/adr/0005-review-findings-come-from-tools-not-models.md]- Chosen: Loki metric queries by plan plus the GitHub search. It uses the existing report queries and the existing bot pull request search.
- Rejected: Loki range query of every result line. The line limit and the volume of 7 days of lines make the report fragile.
- Rejected: A model reads the plans. The expected behavior forbids model judgment for the grade.
- How does the report show the tokens of failed implement attempts?: Sum the
tokensfield of implement lines whose plan outcome is failure. Show the sum for each plan and in the stage row. A plan failure by label or close has no implement line, so its token value is none. (best practice) [sources: docs/roadmap/job-success.md, src/devops_cli/roadmap/job_result.py]- Chosen: Sum tokens of failed implement lines per plan. It shows the cost of a bad plan next to the stage grade.
- Rejected: Sum tokens of every implement line. It mixes the cost of good plans with the cost of bad plans.
- Rejected: Show one aggregate only. The issue asks for the cost of each plan.
- Where does the report show the plan funnel?: Add a
plan_outcomeobject to each stage row in the JSON report. Print the funnel and the failed implement tokens in the text stage section. Do not add a separate dashboard or a new report. (best practice) [sources: docs/roadmap/job-success.md, src/devops_cli/roadmap/job_grade_report.py]- Chosen: Add to the stage row and text report. The stage grade and its plan outcome stay in one place for a person and for an agent.
- Rejected: Add a separate report command. It splits one grade across two commands and two reads.
- Rejected: Add a dashboard only. The command and its JSON report are the contract that tests check.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 14, 2026
Both measure plan quality in the stage job, but #3028 adds a golden test set and scoring command while the candidate changes the live grade to a plan-outcome funnel.devops-cli-service commentedon Nov 18, 2026
Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.
devops-cli-service commentedon Nov 20, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (10)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 21, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
devops-cli-service commentedon Nov 26, 2026
The result in the alternatives block of the issue body changed. Before this check:
none, no tool. A person decides what the new result means for the item.Searches (10)
Tools considered:
Searches run:
Sources:
chore(main): release 0.251.0 (#7782)
devops-cli-service commentedon Nov 29, 2026
Released in v0.251.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.251.0
devops-cli-service commentedon Nov 29, 2026
Live since 2026-11-29 18:59 UTC