Skip to content

feat(roadmap): eval funnel reports each item cohort by step #5494

Description

@dan-petty

Problem or Motivation

The job grades of devops roadmap eval grades rate each job alone. At 90 % for each hop, 8 hops give 43 %, so the grades can hide an end-to-end fall. The approved pipeline split design (owner approval 2026-11-13, tracker #5482) makes a funnel for each item cohort the gate of each phase. No command gives this funnel today.

Measured base (7 days to 2026-11-13): stage staged 5 of 15 attempts; refine made 34 items ready of 78 lines; implement made 4 ready PRs of 8 lines. The critique count gives about 21M tokens for each staged plan, with no interval.

Proposed Solution & Architectural Design

  • Add devops roadmap eval funnel --since <date> [--repo <owner/name>] [--json]. A cohort is the items that got status/ready in one ISO week.
  • Each item has a path field: G1 (the plan PR merges, and delivery starts on a new branch) or continue (tests and implement continue on the plan branch, D3). The command gives the steps of each path:
    • Both paths: New (placed) to Ready; Ready to plan PR open.
    • Path G1: plan PR merged to ready delivery PR; ready delivery PR to merge.
    • Path continue: plan PR open to ready delivery PR; ready delivery PR to merge.
  • For each step, give n, the share that passed, the Wilson 95 % interval, the smallest change that n can show, and the median and p90 time.
  • An item that is still in a step, and is younger than the p90 time of that step, counts as in progress. It is not a failure, and it is not in the share.
  • Give the tokens and the cost_usd_micros for each success: the sum of these fields over the result lines of the cohort items, from Loki, divided by the successes of the step. Also give the tokens from New to staged for each item.
  • Read the label events from the issue timeline API through the paced GitHub session. Read Loki as eval grades does.
  • --dry-run makes zero requests and prints the queries that it would send.
  • Add the command to docs/roadmap/job-success.md.

Target Subsystem

Roadmap Service and roadmap jobs (src/devops_cli/roadmap/, the eval commands).

Acceptance Criteria

  • Test first: a fake timeline and fake result lines give the expected n, share, Wilson bounds, times, and tokens for each success. The test fails on the base.
  • A test: an item on the path continue counts in its own steps, and not as a failure of the step "plan PR merged".
  • A test: an item younger than the p90 time of its step counts as in progress, not as a failure.
  • A test: an item with no result line counts in n with 0 tokens, and the output states the count of items with no line.
  • A test: --dry-run sends 0 requests.
  • uv run devops docs check passes.
  • Live proof: after the merge and the release, the command runs in a runner Job in the cluster as the App against devops-cli for the last 28 days. A comment on this issue gives the Phase 0 base: n, each share with its interval, and the tokens and cost_usd_micros for each staged plan. The comment names the cohorts that have token data (from the release of feat(roadmap): result lines state first-pass, model calls and cost #5168).

Existing Tool Considered

devops roadmap eval grades (the Loki reader), statsmodels proportion_confint (Wilson; 0.15.0 is locked) and the GitHub issue timeline API cover the parts. No open tool joins GitHub label events with the result lines of this project. Build: 200,000 to 400,000 agent tokens and 0.5 to 1 day. Upkeep: about 10 % of the build tokens each quarter.

Related

Tracker #5482, Phase 0. Depends on #5168 (tokens and cost on each line) and #5169 (Job pods log the line). #5164 (job grades), #5443 (the agentic workflow specification: job model, bands, funnel), #5437 (one run id for each agent run). #3655 can show the funnel on the pipeline dashboard later.

Source: #5482

Alternatives check of 2026-11-23: in-use.
The repository already uses this tool.
Tool: statsmodels (https://pypi.org/project/statsmodels), BSD-3-Clause, last activity 2026-08-30, maintained.
Reason: Searches found no open tool that joins GitHub label events with Loki result lines; statsmodels, which the project already pins and uses, covers only the Wilson 95 % bounds of each step's share.

Covers:

  • Wilson 95 % interval from n and successes
  • Bounds via proportion_confint, matching eval grades
  • Already a locked dependency of the project

Lacks:

  • No join of label events with result lines
  • No ISO-week cohort, p90 or in-progress rule
  • No per-item tokens, cost or dry-run query plan

Proposed design

Problem statement

devops roadmap eval grades rates each job alone. A fall across 8 hops can hide: 90 % for each hop gives 43 % end to end. The approved pipeline split design (#5482) makes a per-cohort funnel the gate of each phase. No command gives that funnel today. This item adds devops roadmap eval funnel to report each item cohort by step, with its interval, times, tokens and cost.

Acceptance criteria

Requirement: Cohort of one ISO week

The funnel command SHALL put each item in the cohort of the ISO week of its latest status/ready label event, and an unlabeled event of status/ready SHALL cancel an earlier one.

Scenario: An item ready twice counts once

  • WHEN A fake timeline gives one item status/ready in ISO week 45, an unlabeled of status/ready, and status/ready again in week 47, and the command runs with --since before week 45
  • THEN The week 47 cohort holds the item once, and no week 45 cohort holds it

Requirement: Step path of each item

The funnel command SHALL give the steps of path G1 or of path continue for each cohort item, from the head branches of its plan and delivery pull requests.

Scenario: An item on the continue path

  • WHEN A fake timeline gives an item a plan pull request on branch docs/openspec/5494-eval-funnel and a delivery pull request on the same branch
  • THEN The item counts in the continue step plan PR open to ready delivery PR, and not in the G1 step plan PR merged to ready delivery PR

Requirement: Measures of each step

The funnel command SHALL give n, the share that passed, the Wilson 95 % interval, the smallest change that n can show, and the median and p90 time of the passes for each step.

Scenario: Known pass share gives known bounds

  • WHEN A fake timeline gives one step 8 successes in 10 attempts
  • THEN The step shows n=10, share 0.8, the bounds 0.490 and 0.943 within 0.001, the smallest change 0.227 within 0.001, and the median and p90 times of its passed items

Requirement: An item younger than the p90 time

The funnel command SHALL count an item that is still in a step and is younger than that step's p90 time as in progress, outside the share.

Scenario: A young item is in progress

  • WHEN A fake timeline gives an item that is still in the step Ready to plan PR open with an age below the p90 time of the passed items of that step
  • THEN The step counts the item as in progress, and its share holds no failure for the item

Requirement: Tokens and cost for each success

The funnel command SHALL give the tokens and cost_usd_micros of each success as the sum over the cohort's result lines divided by the step's successes.

Scenario: An item with no result line

  • WHEN A fake Loki answer holds tokens=1000 and cost_usd_micros=2000 for 2 of the 3 cohort items, and the third item has no result line
  • THEN The third item counts in n with 0 tokens, each success shows the summed tokens and cost divided by the successes, and the output states the count of items with no line

Requirement: Tokens from New to staged for each item

The funnel command SHALL give the tokens from New to staged for each cohort item.

Scenario: Each item shows its own New to staged tokens

  • WHEN A fake Loki answer holds the stage result lines of two cohort items with tokens=700 and tokens=900
  • THEN Each item shows its own New to staged tokens, and an item with no stage line shows 0

Requirement: Label events from the timeline API

The funnel command SHALL read the status/ready and unlabeled events of each cohort item from the issue timeline API through the paced GitHub session.

Scenario: The paced session serves the timeline

  • WHEN The test runs the command on a cohort of one item with a fake paced GitHub session that records each path
  • THEN The session receives the path repos/<owner>/<name>/issues/<n>/timeline, and the command sends no request outside the session

Requirement: One repository

The funnel command SHALL report only the items of the repository that --repo <owner/name> names.

Scenario: Two repositories with --repo

  • WHEN A fake timeline holds a cohort in dan-petty/devops-cli and one in dan-petty/other, and the test runs the command with --repo dan-petty/devops-cli
  • THEN The report holds the cohort of dan-petty/devops-cli and no item of dan-petty/other

Requirement: Dry run sends no request

The funnel command with --dry-run MUST send zero requests and print each timeline and LogQL query that it would send.

Scenario: Dry run with counting fakes

  • WHEN The test runs the command with --dry-run and a fake GitHub session and a fake Loki client that count their requests
  • THEN The command prints the timeline and LogQL queries, each request count stays 0, and the command declares the dry-run class request-plan

Requirement: JSON gives one object for each cohort and step

The funnel command with --json SHALL give one object for each cohort and each step, with the values of the text report.

Scenario: JSON holds each step measure

  • WHEN The test runs the command with --json on the fake timeline and result lines
  • THEN Each cohort object holds its ISO week and its items, and each step object holds n, the share, the two bounds, the smallest change, the median and p90 time, the in-progress count, and the tokens and cost for each success

Requirement: The job success page documents the funnel

The change SHALL add the funnel command to docs/roadmap/job-success.md.

Scenario: Docs check passes

  • WHEN The test runs uv run devops docs check
  • THEN The command exits 0 and reports no problem with the page or a generated document

Existing Tool Considered

statsmodels (https://pypi.org/project/statsmodels), the tool of the in-use alternatives block of 2026-11-17, supplies proportion_confint for the Wilson 95 % bounds. The block's Lacks: list names what the command must build itself; the command does not restate or widen that list. Written cost of the build: 200,000 to 400,000 agent tokens and 0.5 to 1 day. Upkeep: about 10 % of the build tokens each quarter.

Key questions

  • Which library gives the Wilson 95 % interval of each step's share?: statsmodels proportion_confint with method="wilson". The project pins statsmodels at 0.15.0 and uses it in job_grade.py and stage_findings.py; the alternatives check records the verdict in-use. (best practice) [sources: src/devops_cli/roadmap/job_grade.py:198, src/devops_cli/roadmap/stage/stage_findings.py:274, docs/guidelines/agentic-jobs.md:80]
    • Chosen: statsmodels proportion_confint. Already pinned and used for the same interval, so the funnel matches eval grades.
    • Rejected: Own Wilson formula. Adds code that the project must keep and fix, with no gain over the pinned library.
    • Rejected: scipy.stats. Adds a dependency for a function that statsmodels already gives.
  • Which status/ready label event puts an item in a cohort?: The latest status/ready label event of the item, after an unlabeled of status/ready cancels an earlier event. A return to New and a new Ready restarts the funnel, so the earlier event no longer marks the start. (best practice) [sources: openspec/changes/archive/2026-11-05-2919-stuck-item-age-metrics-and-one/design.md:10, docs/ROADMAP_WORKFLOW.md:57]
    • Chosen: Latest ready event. The current pass through the funnel starts at the latest Ready, and the project already reads the latest labeled event after an unlabeled event for the age of an item.
    • Rejected: First ready event. An item that returned to New keeps a start time that no longer leads to its delivery.
    • Rejected: Ready time from the job record. The body reads the label events from the timeline, and the job record is not the source of a label change.
  • How does the command tell path G1 from path continue?: It compares the head branch of the delivery pull request with the head branch of the plan pull request. The same branch is continue. A different branch, with the plan pull request merged, is G1. (best practice) [sources: docs/ROADMAP_WORKFLOW.md:25, docs/ROADMAP_WORKFLOW.md:61]
    • Chosen: Compare the two head branches. The branch names hold the split: continue stays on the plan branch, and G1 starts a new branch.
    • Rejected: Plan merge state only. A merged plan can still continue on its branch, so the state alone gives the wrong path.
    • Rejected: A path field in the job record. No such field exists, and the pull requests hold the fact.
  • Which items give the p90 time that separates in progress from a failure?: The items that passed the same step in the cohorts of the window. The guideline takes the p90 of the successful attempts of the last 7 days as its reference, so the cutoff comes from completed passes and does not depend on the items that the rule holds in progress; a cohort's own p90 is noisy under 30 items. (best practice) [sources: docs/guidelines/agentic-jobs.md:81, docs/guidelines/agentic-jobs.md:153, docs/guidelines/agentic-jobs.md:113]
    • Chosen: p90 of the passed items across the window. The set is completed passes, so the in-progress rule does not change it, and it is stable for a small cohort; the guideline measures a p90 over the successful attempts of the window.
    • Rejected: p90 of the cohort's passed items. The p90 then changes with the items that the rule holds in progress, and it is noisy under 30 items.
    • Rejected: A fixed p90 for each step in the config. A fixed cut goes stale and adds a setting that a person must keep.
  • What is the smallest change that n can show?: The half-width of the Wilson 95 % interval at the step's share, in percentage points. It is the change that n can separate at 95 % confidence, and it falls as n grows. (best practice) [sources: docs/guidelines/agentic-jobs.md:80]
    • Chosen: Half-width of the Wilson interval. It follows from the interval that the report already gives, and it falls as n grows.
    • Rejected: 1/n. It states the count step, not the change in the share that n can separate.
    • Rejected: Minimum detectable difference between two cohorts. It compares two cohorts, and the step reports one share.
  • How does the command read the label events and the result lines?: It reads the label events from the issue timeline API through the paced GitHub session. It reads the result lines from Loki with the RESULT_LINES base and metric instant queries, as eval grades does. (best practice) [sources: docs/adr/0006-github-session-requests-go-through-gidgethub.md:37, docs/roadmap/job-success.md:68, src/devops_cli/roadmap/job_grade_report.py:112]
    • Chosen: Timeline API and Loki instant queries. It is the read that the body states, and it reuses the base that eval grades keeps.
    • Rejected: Result lines only. A result line holds no label event, so it gives no Ready time and no cohort.
    • Rejected: A webhook store of label events. No such store exists, and it would need a new writer and a new history.
  • How does an item with no result line count?: It counts in n of its steps with 0 tokens and 0 cost_usd_micros. The report states the count of items with no line, so a missing line is visible and not a silent zero. (best practice) [sources: src/devops_cli/roadmap/job_result.py:214]
    • Chosen: Count in n with 0 tokens. The item entered the step, so it belongs in n, and the stated count shows the missing data.
    • Rejected: Leave it out of n. It inflates the share and hides the item that wrote no line.
    • Rejected: Fail the step. A missing line is no failure of the step, and the body asks for the count.
  • What does --dry-run do?: It prints each timeline query and each LogQL query and sends no request, as eval grades does. (best practice) [sources: docs/roadmap/job-success.md:68, src/devops_cli/commands/roadmap_eval_grades.py:76]
    • Chosen: Print each query and send none. It is the dry-run rule of the eval command, and a test can count 0 requests.
    • Rejected: Send read-only requests. The body asks for 0 requests, and a read still needs a token and a live service.
  • Which flag gives the machine-readable report?: --json, as the body states and as eval grades offers beside --format; the funnel has one report format, so it declares --json alone. (best practice) [sources: docs/commands/roadmap.md:605, src/devops_cli/commands/roadmap_eval_grades.py:60, ARCHITECTURE.md:174]
    • Chosen: --json. The body names it, and the project's commands declare their own --json flag for machine-readable output.
    • Rejected: --format json. It matches eval grades, but it changes the command that the body states and adds a format choice that the funnel does not have.
  • Does the item still depend on feat(roadmap): result lines state first-pass, model calls and cost #5168 and fix(roadmap): a Job pod and a local run log the job result line #5169?: No. The result line already holds tokens and cost_usd_micros, and the OpenTelemetry handler already exports the lines. Both issues are delivered at this commit. [sources: src/devops_cli/roadmap/job_result.py:214, docs/roadmap/job-success.md:20, openspec/specs/roadmap-service-logs/spec.md:94, openspec/changes/archive/2026-11-15-5168-result-lines-first-pass-calls-cost/proposal.md:4, openspec/changes/archive/2026-11-15-5169-job-pod-logs-result-line/proposal.md:9]
  • Does the live Phase 0 proof stay in this item?: No. It runs after the release that carries the command and needs a runner Job as the App, so a pull request check cannot do it. The item delivers the command, the tests and the docs, and a follow-up issue holds the proof. (best practice) [sources: docs/guidelines/agentic-jobs.md:116]
    • Chosen: Defer the proof to a follow-up issue. The proof waits on the release and on a cluster run, and the command is workable without it.
    • Rejected: Keep it and tick it after the release. The implement job cannot tick a task whose check needs the released image, so the item stops.
    • Rejected: Run it from the workstation before the merge. The released image does not hold the command yet, and the body asks for a runner Job as the App.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    on Nov 13, 2026
  2. added
    type/feature
    scope/roadmap
    status/new
    value/high
    effort/medium
    on Nov 13, 2026
  3. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 13, 2026
  5. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: The searches found no open tool that builds a per-cohort funnel by joining GitHub label-timeline events with this project's Loki result lines; the only reusable piece is the binomial interval maths. statsmodels, already pinned at 0.15.0, supplies proportion_confint for the Wilson 95 % bounds of each step's pass share, and nothing else of the requested command.

    The repository already uses this tool.

    Tool: statsmodels (https://pypi.org/project/statsmodels)

    • License: BSD-3-Clause
    • Last activity: 2026-08-30
    • Maintained: yes

    Covers:

    • Wilson 95 % confidence interval for a binomial proportion (proportion_confint) on each step's pass share
    • An open, maintained statistics library that the project already pins at 0.15.0

    Lacks:

    • The devops roadmap eval funnel --since/--repo/--json command and its cohort (items that got status/ready in one ISO week)
    • The G1 and continue step paths, with plan-PR-merged and plan-PR-open as different step entries
    • The in progress rule for items younger than the step's p90 time, kept out of the pass share
    • Median and p90 step times, and the smallest change that n can show
    • Reading label events from the issue timeline API through the paced GitHub session
    • Joining cohort items with Loki result lines to give tokens and cost_usd_micros per success, and New-to-staged tokens per item
    • --dry-run that sends zero requests, and the docs/roadmap/job-success.md entry

    Tools considered:

    Searches run:

    • statsmodels proportion_confint Wilson interval documentation, results: 5
    • open source library compute funnel conversion per cohort with Wilson confidence interval, results: 5
    • python package Wilson score interval binomial proportion confidence interval, results: 5
    • tool join GitHub issue label timeline events with Loki log metrics funnel stages, results: 5
    • statsmodels proportion_confint, results: 5
    • grafana loki logcli query logs command line, results: 5
    • funnel analysis library python events cohorts conversion rate open source, results: 5

    Sources:

    Checked on 2026-11-17. A person decides what this means for the item. The check changes no label and closes no issue.

  6. added
    status/ready
    and removed
    status/new
    on Nov 18, 2026
  7. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 2b7f32c (see proposed design in issue body).

    Moved to new items: #6256.

  8. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 25, 2026
  9. removed
    status/in-review
    on Nov 25, 2026
  10. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-25 06:00 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/roadmapsource/agenttype/featurevalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions