Skip to content

fix(roadmap): check CI job-time premise before staging time-budgeted items #4026

Closed

Description

@dan-petty

Problem Description

The roadmap service stages items that depend on CI job time limits without validating current job durations. Issue #2163 has an acceptance criterion that requires Tests & Coverage average job duration to stay under 300 s.

Current runs average 328 s over the last 20 runs, and over 500 s over the last 5 runs. The service staged the issue into pull request #3960 despite the false premise.

Reproduction Steps

  1. Run devops ci job-time when CI test duration exceeds 300 s.
  2. Note that the command reports that runs are over the limit.
  3. Observe that the roadmap service still stages an issue that requires duration under 300 s.

Expected vs Actual Behavior

Expected: The service evaluates the job-time premise before staging an issue that specifies CI duration criteria, or returns the issue to New.

Actual: The service stages the item into a plan pull request that cannot satisfy its time criteria.

Environment Diagnostics

  • DevOps CLI Version: 0.82.0
  • Python Version: 3.14.10
  • OS & Architecture: Linux x86_64
  • Execution Environment: DevContainer

Logs, Traces, or Terminal Output

✗ Over the limit: the last 20 runs of Tests & Coverage took 328 s on average, and the limit is 300 s.

Proposed design

Problem statement

The stage job writes a plan for an item that states a CI job time limit, but it never reads the current job duration. A false premise then reaches a plan pull request, as issue #2163 and pull request #3960 show. The fix makes the stage job read the check name and the limit from the item's own acceptance criteria, compare them with the mean that devops ci job-time already measures, and return the item to New with the evidence when the premise fails.

Acceptance criteria

Requirement: Stated job-time limit is read

The stage job SHALL read the CI check name and the duration limit from the item body and its acceptance criteria before it calls the planner.

Scenario: Item states a Tests & Coverage limit

  • WHEN an item body states that Tests & Coverage stays under 300 s
  • THEN the premise check returns the check name Tests & Coverage and the limit 300 s

Requirement: Measured duration is compared

The stage job SHALL compare the stated limit with the mean duration that check_job_time reports for the named check over its last 20 runs.

Scenario: Mean is over the limit

  • WHEN the stated limit is 300 s and the last 20 runs average 328 s
  • THEN the premise check reports a failure with the measured mean 328 s and the sample size 20

Requirement: Verdict matches the job-time command

The stage job SHALL fail the premise only when the mean is over the stated limit, as devops ci job-time does, so a mean equal to the limit passes.

Scenario: Mean equals the limit

  • WHEN the stated limit is 300 s and the last 20 runs average 300 s
  • THEN the premise check reports no failure and the stage job stages the item

Requirement: Failed premise returns the item to New

The stage job SHALL set the item Status to New and comment the evidence when the job-time premise fails.

Scenario: False premise is reported

  • WHEN the premise check fails for a Ready item
  • THEN the item has Status New, the comment names the check, the measured mean, the sample size and the limit, and the stage job creates no branch and calls no planner

Requirement: Item without a time limit stages as before

The stage job SHALL stage an item that states no CI duration limit without a job-time read.

Scenario: No time limit in the item

  • WHEN an item body and its acceptance criteria name no CI duration limit
  • THEN the stage job makes no job-time read and stages the item as before

Requirement: Unreadable job-time data keeps the item Ready

The stage job SHALL retry the job-time read once and, when the second read fails, record the failure in the item's stage record and leave the item Ready.

Scenario: Job-time read fails

  • WHEN the job-time read fails twice for an item that states a limit
  • THEN the item stays Ready, stage.failed_error names the error, stage.failed_class is ci_infra, and the stage job creates no branch and calls no planner

Existing Tool Considered

The GitHub Actions REST API covers the measurement: it is open and documented, and this repository already reads it through GitHubClient.get_job_run_times (src/devops_cli/github/client.py:499) and reports it as devops ci job-time (src/devops_cli/ci/job_time.py:43). What it lacks is the gate: the command reads one job name and one limit for the whole repository, and knows nothing of the check name and limit that an item's acceptance criteria state. No open library gates a roadmap item on a measured CI job time, and no check has run for one. The change builds no measurement: it reuses check_job_time and JobTimeReport (src/devops_cli/ci/job_time.py:19) and the existing acceptance-criteria reader (src/devops_cli/roadmap/stage/stage_criteria.py:207), and adds the criterion parse, the comparison and the return path. Cost: about 25,000 tokens to write the parse, the check and their tests, about 5,000 tokens a year to keep and fix, and about half a working day.

Key questions

  • Where does the service decide to stage a Ready item?: The stage job decides. It runs in the model lane after the retitle row, reads the repository, writes the OpenSpec change and opens the draft plan pull request. [sources: CONTEXT.md]
  • Which CI check does the 300 s limit apply to?: Tests & Coverage is the default --job of devops ci job-time, and CI is the authoritative gate, so a duration limit on that job is a limit on a real check. [sources: docs/commands/ci.md:382, docs/adr/0004-ci-is-the-authoritative-gate.md]
  • Where does the premise check run?: In the stage job, before the planner model call, and it reuses the return path that the stage probe already has for a false premise. (best practice) [sources: CONTEXT.md, docs/ROADMAP_WORKFLOW.md:84, src/devops_cli/roadmap/stage/stage.py:730]
    • Chosen: Stage job, before the planner call. The false premise first becomes a plan here. A check before the call spends no plan tokens and stops the wrong plan. The stage job already returns an item to New, with no model call, when its premise probe finds a cited path that an open plan creates.
    • Rejected: Implement job. The plan pull request already exists, and the implement run is wasted.
    • Rejected: Intake. Intake sees a candidate before refinement writes the acceptance criteria that state the limit.
  • Which status does a failed premise set?: New, with a comment that gives the evidence. (best practice) [sources: docs/ROADMAP_WORKFLOW.md:84, AGENTS.md:10]
    • Chosen: New, with the evidence in a comment. The project already returns an item to New with its evidence when a premise is false, and the stage job does it in process for a blocked dependency. Refinement then reads the item again.
    • Rejected: Blocked. A slow check is not an outside wait that a person must clear. A retry comment does not make the premise true.
    • Rejected: Stay Ready. The stage job selects the same item every round and spends a job-time read each time.
  • How does the stage job find the stated limit?: It reads the item body with the acceptance-criteria reader that the stage check already uses, acceptance_criteria (src/devops_cli/roadmap/stage/stage_criteria.py:207), and takes the check name and the duration from the criterion text; the stage probe already takes the same body for its premise lines. (best practice) [sources: src/devops_cli/roadmap/stage/stage_criteria.py:207, src/devops_cli/roadmap/stage/stage_probe.py:173]
    • Chosen: Parse the item body and acceptance criteria. The limit is part of the item's own acceptance criteria, every item states it in the same form, and the stage job already parses that list to refuse a plan that drops a criterion.
    • Rejected: A setting in .github/roadmap.toml. One value cannot express the limit of each item, and a repository setting is not the item's criterion.
    • Rejected: A label or body field that a person sets. It adds a manual step, and the items that already state a limit carry no such field.
  • Which duration statistic does the premise use?: The mean of the last 20 runs, which is the default of devops ci job-time (--runs 20), read over the completed push runs of the branch. (best practice) [sources: docs/commands/ci.md:385, src/devops_cli/ci/job_time.py:28, docs/TESTING.md:170]
    • Chosen: Mean of the last 20 runs. It is the command default, so the check and the command give one verdict on one set of runs.
    • Rejected: Mean of the last 5 runs. It is noisier, and it is not the command default.
    • Rejected: Both values. Two values give no single verdict when they disagree.
  • What does the stage job do when the job-time read fails?: It reads once more in the round. If the second read fails, the error reaches the stage job's failure record: the item stays Ready, stage.failed_error names the error, stage.failed_class is ci_infra because a GitHub read error is an infrastructure error, and the job takes the item again after the one-hour wait of that class. (best practice) [sources: docs/roadmap/stage.md:75, src/devops_cli/roadmap/failure.py:136, src/devops_cli/roadmap/failure.py:152]
    • Chosen: Fail closed through the stage failure record. The false premise cannot pass, the item stays Ready, and the existing class wait retries the read in an hour without a second status or a comment each round.
    • Rejected: Fail open and stage the item. The false premise passes, which is the defect.
    • Rejected: Set Blocked. A transient read error is not an outside wait that a person must clear, and the stage failure record already holds it with a retry time.
  • At what value does an under N s limit fail?: It fails when the mean is over N, and a mean equal to N passes, because the premise takes the verdict of devops ci job-time: JobTimeReport.passes is mean_seconds <= limit_seconds, and the project's own budget fails a check that averages more than five minutes. (best practice) [sources: src/devops_cli/ci/job_time.py:40, docs/commands/ci.md:386, AGENTS.md:13]
    • Chosen: Fail only above N, as the command does. The command's --limit is the most seconds the mean may be and passes compares with <=, and AGENTS.md makes a check that averages more than five minutes the bug. One boundary means the gate and the command never give two verdicts on the same runs.
    • Rejected: Fail at or above N, from the word under. At exactly N the gate would return an item to New while devops ci job-time reports the same runs inside the budget, so the repository would hold two verdicts on one measurement.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Alternatives check of 2026-11-10: none.
Tool: none found.

Activity

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

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. The bug causes wasted staging work but does not block delivery or corrupt data.
    • Value: Medium. Prevents the service from creating pull requests that cannot satisfy their acceptance criteria, saving person or agent time.
    • Effort: Low. The devops ci job-time command already exists; the fix adds a gate check in the staging path.
    • Related: feat(roadmap): the stage job keeps a limit on Planned items #3487, which asks for a different change. Both concern the roadmap stage job's planning logic, but #3487 limits the count of Planned items while the candidate checks a CI time premise before staging.
  3. added
    priority/p2-medium
    on Nov 7, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 8, 2026
  5. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

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

  6. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The search found no open tool that gates a roadmap item on a CI job-time limit that the item states in its own acceptance criteria. The need is logic inside this project's stage job: parse the limit, compare it with the existing check_job_time mean, and return the item to New. The measurement already exists in the repo as devops ci job-time, so this is project glue and not a missing tool. No ADR rejects a relevant tool.

    Tool: none found

    Covers:

    • Measuring job time is already built into the repo (devops ci job-time, check_job_time)

    Lacks:

    • Reading the check name and limit from an item's acceptance criteria
    • Gating or returning a roadmap item to New on a failed premise
    • Retry and failure-record handling in the stage job

    Searches run:

    • gate project plan on GitHub Actions job duration threshold check workflow run time, results: 5

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

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

    @devops-cli-service
    Contributor

    Live since 2026-11-15 01:32 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/lowpriority/p2-mediumscope/roadmapsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions