Skip to content

feat(roadmap): result lines state first-pass, model calls and cost #5168

Closed

Description

@dan-petty

Part of #5164 (child 3).

Problem or Motivation

The owner grades a workflow by "success with no fix rounds" and, at 80% or more, by "cost, time, and token efficiency" (2026-11-12, #5164). The result line of roadmap/job_result.py gives neither for most jobs:

  • No line says whether the attempt succeeded with no fix round. A query must know the counts of each job, and refine, refine_judge, alternatives and intake have no count of fix rounds.
  • tokens and seconds exist only for stage, implement and fix_plan. No line has a count of model calls, the cost in money or the GitHub requests.
  • retitle makes one model call for each item and writes no line.
  • The spend ledger (ai/spend/ledger.py) keeps cost_usd for each request, but no attempt adds it up. In 7 days, $72.95 of $78.31 of devops_cli_ai_spend_usd_total had no row label.

Proposed Solution & Architectural Design

  • Add first_pass=<true|false> to each line. A table FIRST_PASS next to SUCCESS_RESULTS gives the rule of each job:
Job First pass
stage staged, plan_calls ≤ 1, gate_returns = 0, verify_rounds ≤ 1
implement ready, repair_rounds = 0, extensions = 0
fix_plan revised or cleared, gate_returns = 0, verify_rounds ≤ 1, after = 0
refine success with tries = 1
refine_judge approved with round = 1 and findings = 0
alternatives a verdict with returns = 0
intake placed or duplicate with no model fallback (fallbacks = 0)
retitle retitled or kept on the first reply
  • Add one attempt context (a context variable that the job opens around one attempt). The spend ledger adds model_calls, tokens and cost_usd_micros (integer micro-dollars) to it for each request, and the paced GitHub session adds gh_requests. seconds is the wall time of the context. The writer adds these counts to every line. A local model adds 0 to the cost; its tokens show its load (fix(ai): an agent run on a hosted group is not local spend #3665).
  • Add the counts that the first-pass rules need: tries (refine), round (refine_judge), returns (alternatives), fallbacks (intake).
  • Add RoadmapJob.RETITLE, its results (retitled, kept, failed) and its intended results (retitled, kept).
  • Update the table of docs/roadmap/job-success.md and the spec openspec/specs/roadmap-service-logs/spec.md.

Target Subsystem

SDLC, Git & PR Governance (src/devops_cli/roadmap/, src/devops_cli/ai/spend/ledger.py).

Existing Tool Considered

OpenTelemetry spans can carry the same counts, but Loki holds the result lines and the spans keep no prompt text by the privacy defaults; a span does not give a ratio for each attempt. LiteLLM spend logs hold a cost for each request, but they do not know the attempt. Custom code: the attempt context (about 150 lines) and the table. Cost: about 400,000 tokens, 10 hours elapsed.

Acceptance Criteria

  • For each job, a test writes an attempt and finds first_pass, model_calls, tokens, seconds, cost_usd_micros and gh_requests with the values of the fake ledger and session.
  • A table test covers each FIRST_PASS rule on its boundary values.
  • A retitle attempt writes one line.
  • devops docs check passes.

Dependencies

#5166 (the measure defects, so the new counts start from a correct line).

Owner decision 2026-11-13

The approved pipeline split (tracker #5482, Phase 0) uses tokens and cost_usd_micros of this item as a Phase 0 exit check. The scope of this item does not change. The other result-line fields (attempt, class, extensions, pipeline and unit) go to #5500, after this item. The trial arm uses the trial field of #5177.

The row label of devops_cli_ai_tokens_total and devops_cli_ai_spend_usd_total must name the job in a Job pod too.

  • A test: a model call in a Job pod adds to the counters with the row label of its job.
  • Live proof: after the merge and the release, the stage, refine, intake and fix-plan jobs run as the App. A comment gives one result line of each with tokens and cost_usd_micros.

Activity

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

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 12, 2026
  4. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 15, 2026
  5. removed
    status/in-review
    owner/agent
    on Nov 15, 2026
  6. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-15 04:09 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/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions