Repository navigation
Description
Problem Description
Since #4237, the stage, refine and alternatives runs send no model answer count, and no AI series can tell one roadmap row from another.
#4237 removed the record_run_spend call from investigate (src/devops_cli/roadmap/refine/refine_investigation.py). The stage, refine and alternatives rows all run their model through investigate. #4237 added a hook in build_agent (src/devops_cli/ai/client/factory.py) that writes one spend record for each model request. That hook writes the ledger row and the request, token and spend counters, but it does not add to devops_cli_ai_model_answers_total. Only record_run_spend adds to that counter, and only the implement step calls it now. The implement step runs in a runner Job, not in the Service.
Also, the series devops_cli_ai_requests_total, devops_cli_ai_tokens_total, devops_cli_ai_spend_usd_total and devops_cli_ai_model_answers_total have no row label. The ledger gives the stage, refine and alternatives requests the same stage, analysis. So no query can split the tokens of the Service by row (intake, refine, alternatives, stage, implement).
Reproduction Steps
git log -S record_run_spend --onelineshows refactor(ai): replace PydanticAgent with pydantic-ai Agent #4237 (5edd7a5). Its diff removesrecord_run_spend(model, messages, ..., stage="analysis")fromrefine_investigation.py.- Prometheus:
max by (job) (max_over_time(timestamp(devops_cli_ai_model_answers_total)[2d:5m])). The last sample of jobroadmap-serviceis at 2026-11-09T17:32:53Z, the rollout of refactor(ai): replace PydanticAgent with pydantic-ai Agent #4237. The runner Jobs (jobdevops-cli-job) still send it. - Prometheus:
sum by (type) (increase(devops_cli_ai_tokens_total{job="roadmap-service"}[6h])). The tokens continue after 17:32Z, and thereasoningtype, which only thebuild_agenthook sends, grows from about 72K to about 1.4M tokens in 6 hours. So the spend records do not stop; only the answer count stops. devops_cli_ai_tokens_totalhas the labels provider, model, server, backend, operation, local and type. It has no row.
Expected vs Actual Behavior
Expected: each model request of an agent run adds one answer count (asked, answered, fallback), and the request, token, spend and answer series of the Service carry the job row (row) whose work sent the request. A request counts one time only.
Actual: the Service sends no answer count after 2026-11-09T17:32Z, and its AI series have no row.
Environment Diagnostics
origin/main c653bde. roadmap-service in namespace devops, Prometheus of the homelab cluster.
Logs, Traces, or Terminal Output
Last devops_cli_ai_model_answers_total samples by job: roadmap-service 2026-11-09T17:32:53Z, devops-cli-job 2026-11-10T20:36:29Z.
Series in the last 7 days for job roadmap-service: tokens 32, spend 8, requests 11, answers 2.
The request_scope context variable (src/devops_cli/github/request_scope.py) already holds the job row of each Service row for devops_cli_github_requests_total. Its values are the rows of the due table and other, so a row label from it is bounded.
The price of DeepSeek models (spend 0 USD) is #4403 and is not part of this item.
Pre-Submission Checklist
- I searched open issues: fix(ai): price the DeepSeek models in the price table #4403, chore(ai): Confirm DeepSeek price on OpenRouter activity #4422 and chore(k8s): apply the DeepSeek price to the live devops-cli-config #4423 are about DeepSeek prices; fix(ai): an agent run on a hosted group is not local spend #3665 (closed) is about local spend of hosted groups.
Activity
dan-petty commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(roadmap)scope of the title gives the scope.Monitoring is broken since #4237 but no user-facing function is lost; it is an observability gap.The regression commit 5edd7a5 does not set P0: the author has no write access, and no caller attached it as evidence. A person can set P0 with the label priority/p0-critical.Restores a broken counter and adds a label that operators need to split Service spend by row.Requires restoring the answer count in the build_agent hook and wiring the request_scope row into four Prometheus series.Both attribute AI spend to a stage or row, but #594 changes the ledger structure while the candidate fixes a Prometheus counter regression and adds a row label to existing series.devops-cli-service commentedon Nov 11, 2026
Released in v0.111.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.111.0
devops-cli-service commentedon Nov 11, 2026
Live since 2026-11-11 05:46 UTC
fix(ai): price cached prompt tokens of chat calls (#4584)