Repository navigation
Description
Problem
devops roadmap intake takes 4 to 5 minutes for one issue. In one session, 14 calls took between 4 min 19 s and 6 min 58 s each. The rule "one devops ai call at a time" makes batches slow: filing five issues takes about 25 minutes. The cause is not known.
What to find out
- Where the time goes: the embedding call for the duplicate check, the nearest-neighbour search over the open and closed issues, the
triagemodel call (localqwen3.8:27bin the CLI environment,deepseek-v4.1-flash-1017in the Service), GitHub requests (pacing bydevops gh), label and project writes, the reason comment. - Whether the local model is slow because other agents use the same GPU, or the call is slow by itself.
- What can be cut with no loss: a cache of the issue embeddings, a smaller shortlist, parallel reads, one batch of GitHub writes.
Done when
A timing table by phase for five runs, and a fix issue for each large phase. A target of 1 minute for one issue is set in the fix issues.
Related: #4372 (a different fault), the triage task slot.
Proposed design
Problem statement
devops roadmap intake takes 4 to 5 minutes for one issue. A person measured five runs on 2026-11-11 and filed four fix issues. No command in the repository measures the phases again, so nobody can show that the fix issues reach the 1 minute target. This change records the duration of each intake phase, sends each duration to the step histogram, and prints a table of several runs with their medians.
Acceptance criteria
Requirement: Phase durations of one intake run
One intake run SHALL record a duration for each of the six phases: read, parse, embed, neighbour, model and write.
Scenario: Six phase entries
- WHEN A test runs one intake over the
Roadmapbuilder with a model and a store that shift the fake clock by a known duration in each phase. - THEN The timing record holds one entry for each of the six phase names, and each entry equals the sum of the shifts of that phase.
Requirement: Phase samples in the step histogram
Each timed phase of an intake run SHALL send one sample to devops_cli_roadmap_step_seconds with the row intake and the phase's step name.
Scenario: Six step samples
- WHEN A test runs one intake with the telemetry emitter replaced by a capture.
- THEN The capture holds at least one sample for each of the six step names under the row
intake.
Requirement: Append of timed runs to one file
The intake command SHALL append one JSON line for each timed run to the file that --timing-json <path> names.
Scenario: Five runs append five lines
- WHEN A test runs the intake command five times with
--timing-jsonpointed at one temporary file. - THEN The file holds five lines, and each line parses as JSON with a
phasesobject of six entries andtotal,model,hostandstarted_atvalues.
Requirement: Markdown table of the runs
devops roadmap intake-timing <path> SHALL print a Markdown table with one column for each of the six phases, a total column, an other column and one row for each recorded run.
Scenario: Five runs print five rows
- WHEN A test renders a file of five runs with known durations.
- THEN The output has a header row that names the six phases, the total and the other column, and five body rows.
Requirement: Medians of the phases and the run
The report MUST print the median of each phase, of the other time and of the whole run.
Scenario: Median of five known values
- WHEN A test renders five runs whose read durations are 1, 2, 3, 4 and 5 seconds.
- THEN The read median reads 3 s, and the total median equals the median of the five run totals.
Requirement: No record without the option
The intake command SHALL write no timing record when --timing-json is absent.
Scenario: No option, no record
- WHEN A test runs one intake without
--timing-jsonin a temporary directory. - THEN No timing file exists in the directory, and the run prints no timing line.
Requirement: The intake writes stay the same
The change MUST leave the label writes, the field writes and the reason comment of an intake run unchanged.
Scenario: Timing on and timing off write the same
- WHEN A test runs one intake twice with the same stubs, once with
--timing-jsonand once without it. - THEN Both runs record the same list of issue writes and the same reason comment text.
Requirement: A page for the report command
The report command SHALL have the page docs/roadmap/intake-timing.md, and its help SHALL name that page.
Scenario: The help names the page
- WHEN A test reads the help text of
devops roadmap intake-timing. - THEN The help text holds
docs/roadmap/intake-timing.md, and that file exists.
Existing Tool Considered
No alternatives check has run for this issue. OpenTelemetry is already the project's telemetry library: observe_step sends the seconds of each job step to the histogram devops_cli_roadmap_step_seconds (src/devops_cli/roadmap/step_metrics.py, src/devops_cli/telemetry/instruments.py, docs/TELEMETRY.md). It covers the seconds of each phase of every run, the Service's runs included, and Prometheus computes their medians. It lacks a per-run record that a test reads back as one row, and a Markdown table across runs. The change adds a small recorder and renderer on top of observe_step; it builds no timer and adds no dependency. Cost: about 10,000 tokens to build, about 2,000 tokens a year to keep and fix, and about 3 hours of elapsed time.
Key questions
- Which helper records the duration of each intake phase?: The existing
observe_stephelper on thedevops_cli.core.clock.monotonicseam, with six new intake step names. Each phase also sends its seconds todevops_cli_roadmap_step_seconds. Theclockfixture moves the seam, so a test sets each duration with no sleep. (best practice) [sources: src/devops_cli/roadmap/step_metrics.py, src/devops_cli/core/clock.py, tests/support/fakes/clock.py, src/devops_cli/telemetry/instruments.py]- Chosen: The existing
observe_stepand the step histogram. It is the project's timing helper for a job step. It sends the phase samples to the existing histogram, and theclockfixture moves its reading, so a test needs no sleep. - Rejected: A new timer on
time.perf_counter. It duplicatesobserve_step. Theclockfixture does not movetime.perf_counter, so a test would need real sleeps, whichdocs/TESTING.mdforbids. - Rejected: OpenTelemetry spans. A span needs a collector to read. It gives no per-run row that a test renders offline.
- Rejected:
py-spysampling of the live process. It gives a flamegraph of a live process, not a per-run record. The offline test suite cannot run it.
- Chosen: The existing
- Which phases get a timer?: The six phases that the measured runs name: read, parse, embed, neighbour, model and write. The parse is its own phase, because the largest fix issue targets it. The report also prints the run total and the other time, so the time outside the six is visible. (best practice) [sources: src/devops_cli/roadmap/intake/intake.py, src/devops_cli/roadmap/stores/store.py, docs/roadmap/intake.md]
- Chosen: Six phases, the parse apart from the read. The parse takes about 89 s of the 163 s read in the measured runs, and one fix issue targets it. A separate timer shows a change to it.
- Rejected: The body's six phases, the parse inside the read. The parse then hides inside the read, so a change to the parse shows as a change of the read.
- Rejected: One timer for the whole run. It gives one number and no breakdown, so it cannot show where the time goes.
- Rejected: Timers in the GitHub client only. It misses the embedding call, the nearest-neighbour search and the model call.
- What command interface gives the report its runs?:
devops roadmap intake --timing-json <path>appends one JSON line per run.devops roadmap intake-timing <path>prints the table from that file. (best practice) [sources: src/devops_cli/commands/roadmap.py, src/devops_cli/lang/en/help.py, docs/roadmap/intake.md]- Chosen: One option that appends, and one command that renders. It keeps the table of several runs, and a test renders a fixed file with no live call. The report command makes no external request, so it declares the no-external-request dry-run class.
- Rejected: One option that prints a single row. It cannot show the several runs that the fix issues need.
- Rejected: An environment variable. It hides the record path from the command help and from the test.
- Rejected: The report proposes a fix issue title for each large phase. A person filed the four fix issues from the measured table, so the report adds none. A 23 s model call would get a title that the measurement does not justify.
- Does the timing record cover the Service's runs?: The JSONL record is a CLI option. The histogram covers the Service's runs too, because the same step names come from
plan_intake. (best practice) [sources: src/devops_cli/roadmap/step_metrics.py, src/devops_cli/telemetry/instruments.py, docs/TELEMETRY.md, src/devops_cli/roadmap/intake/intake.py]- Chosen: The histogram for both, the file for the CLI. The histogram already holds the step seconds of every run. A file for each Service round would grow without limit beside
schedule.json. - Rejected: A timing file for each Service round. It grows without limit, and no test reads it.
- Chosen: The histogram for both, the file for the CLI. The histogram already holds the step seconds of every run. A file for each Service round would grow without limit beside
- Which test doubles does the timing test use?: The intake tests use the
Roadmapbuilder,FakeModeland theclockfixture. The fixture movesdevops_cli.core.clock.monotonic, so a test sets each phase duration with no sleep. [sources: tests/support/roadmap_intake.py, tests/support/fakes/clock.py, tests/roadmap/intake/test_roadmap_intake_command.py, docs/TESTING.md] - Does this change make one of the cuts?: No. The change measures only. The four fix issues hold the cuts. (best practice) [sources: src/devops_cli/ai/rag/embeddings.py, docs/TELEMETRY.md, src/devops_cli/roadmap/intake/intake.py]
- Chosen: Measure only. The four fix issues hold the cuts. A cut in this change would hide the baseline that the next measurement compares with.
- Rejected: Add the issue-embedding cache. The cache exists, and
devops_cli_embedding_cache_lookups_totalcounts its lookups. The measured runs show that the cache misses. - Rejected: Read the issues in parallel. It changes the run before the report shows the read time after the fix issues.
- Rejected: Send one batch of GitHub writes. It changes the run before the report shows the write time after the fix issues.
- Where does one intake run start?: The CLI path starts at
intake_cmdinsrc/devops_cli/commands/roadmap.py, which callsplan_intakeinsrc/devops_cli/roadmap/intake/intake.py. The Service runs the same plan. [sources: src/devops_cli/commands/roadmap.py, src/devops_cli/roadmap/intake/intake.py, src/devops_cli/roadmap/run.py]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-11: not-applicable.
Class: chore, no search.
Tool: none found.
Activity
dan-petty commentedon Nov 10, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
choreprefix of the title gives the type.(roadmap)scope of the title gives the scope.It slows developer workflow but does not block delivery or affect end users.It cuts 4 to 5 minutes per issue from the intake path, saving time for the team.It requires timing five phases over five runs and filing fix issues for each slow phase.Both items add per-stage timing to a devops command, but #473 targets review while the candidate targets roadmap intake.devops-cli-service commentedon Nov 10, 2026
Refine cannot set this item to Ready at cbd3c64 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
dan-petty commentedon Nov 11, 2026
Timing table of the intake call
I timed five runs of
devops roadmap intake --title <t> --body-file <f>for one new candidate on 2026-11-11. Runs 1 to 3 used--plan: they read GitHub and call the model, but they write nothing. Runs 4 and 5 used--confirm, and they filed #4445 and #4447. A scratch harness put a monotonic timer around each phase function in the same process. Run 1 also ran under cProfile, so its CPU-bound phases are longer. The host is the shared devcontainer, with a load average of 67 to 85 during the runs.All values are seconds. The median is of runs 2 to 5.
state=all)split_record(4,431 bodies).github/labels.ymlWhat the table shows
split_recordparses all 4,431 bodies with markdown-it, but only 1,084 bodies hold a record block. On an idle copy of the bodies, the parse takes 18 s to 23 s of CPU time, so the load of the host makes it 3 to 5 times longer.qwen3-embedding:0.6bthrough the AI gateway again, with 0 cache hits. The Valkey tier is off on a workstation (valkey.urlislocalhost, and the connection is refused), and the memory tier holds 1,024 entries, which is less than one comparison set.qwen3.8:27bthrough the AI gateway, with a request of 4.7 to 6.2 thousand characters and a shortlist of 5. It is not a large phase. I did not measure if other agents on the same GPU make it slower.PATCHfor each of 4 fields, and the reason comment.Fix issues, each with the target of 1 minute for the whole call
With all four, the estimate for one call is about 1 minute: 10 s listing, 5 s embeddings, 23 s model, 2 s search, 10 s writes, and the parse of the changed bodies only.
This comment holds the timing table that the refine question asks for, and the four sub-issues of this item track the fixes.
perf(roadmap): parse only the bodies that hold a job record (#4455)
devops-cli-service commentedon Nov 11, 2026
Status set to Ready at 2f6114f (see proposed design in issue body).
Moved to new items: #4499.
devops-cli-service commentedon Nov 11, 2026
Alternatives check: not-applicable
Class: chore. The check makes no search and no model call for an item of this class.
Tool: none found
Checked on 2026-11-11. A person decides what this means for the item. The check changes no label and closes no issue.
dan-petty commentedon Nov 11, 2026
Embedding phase after #4447 (pull request #4546), measured on the devcontainer on 2026-11-11 with
devops roadmap intake --plan:embed_texts, 59 gateway requests, 1,866 texts to the model, 0 cache hits. Whole call 249 s.embed_texts, 1 gateway request, 1 text to the model, 1,867 disk hits. Whole call 89 s.The disk lookup of 1,867 texts takes 0.55 s. The rest is one gateway request: three single-text embedding requests took 13.4 s, 9.4 s and 10.2 s. Thus the target of 5 s for 50 changed texts in #4447 needs a faster single embedding request at the gateway. The before batches show the same latency: 59 requests, 4 at a time, in 155 s is about 10 s for each request.
dan-petty commentedon Nov 12, 2026
Measurements from 13
devops roadmap intake --title ... --confirmruns on 2026-11-12 (01:00 to 04:10 UTC), filed one at a time behind the intake lock while other sessions also filed:Could not read .github/labels.yml at the default branch in dan-petty/devops-cli (exit 124): GitHub API command timed out after 30.0 seconds(after 2 min 24 s). A retry passed.devops gh apifailed once withgh auth token could not run (no answer within 5 s). A retry passed.