Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/TELEMETRY.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ writes by name.
| `devops_cli_roadmap_page_fetches_total` | Counter | `1` | Calls of the tool fetch_page in refine's investigation and in the alternatives check, by toolset (refine or alternatives) and result: ok for a page whose text the tool returned, refused for a URL that the tool refused before any request (not https, not named by a search result or by the item text, or not on a public host), limit for a call over the limit of fetches for one item, and error for a fetch that failed. The fetches that reach the Crawl4AI service also count in devops_cli_crawl4ai_fetches_total. |
| `devops_cli_roadmap_stage_plan_record_total` | Counter | `1` | Uses of the plan file of the stage job, by result: hit for a plan that the job read from the file and so sent the planner no request, miss for an item with no file of its key, and written for a plan that the job wrote to the file. A miss that plans adds one to miss and one to written. The hit rate is hit divided by the sum of hit and miss. |
| `devops_cli_decision_point_total` | Counter | `1` | Decisions of a registered decision point (ADR 0020), by point, resolver (rule, model or fallback), band (continue, review or flag, or none for a fallback) and mode (shadow or on). A point in the mode off, and a point with no rule while ai.decision_model is empty, count nothing. A point writes only the resolvers that it has: one resolver besides the fallback gives 8 series, and a rule and a model give 14. The registry refuses a catalogue of more than 60 series. The registry holds stage.verify_screen, a model and no rule: 8 series. The decision record and the outcome record of each decision are log lines that share an identifier, and their join gives the false-clear rate of a point. |
| `devops_cli_roadmap_stage_total` | Counter | `1` | Items that a stage round handled, one count for each item, by repository and result: staged for an item written as a branch and a draft pull request, needs_split for an item stopped on a task group over the budget, failed for an item that failed in the plan or in the writes, degenerate for an item whose plan reply was a placeholder in every text (the job sent no second request), and skipped for an item the job left out with a reason. A plan with no write counts nothing. |
| `devops_cli_roadmap_stage_total` | Counter | `1` | Items that a stage round handled, one count for each item, by repository and result: staged for an item written as a branch and a draft pull request, needs_split for an item stopped on a task group over the budget, failed for an item that failed in the plan or in the writes, degenerate for an item whose plan reply was a placeholder in every text (the job sent no second request), and skipped for an item the job left out with a reason. The label reason names the rule of a skipped item, such as title_type, held, failed_lately, queue_full, returned or rejected, and is none for the other results. A plan with no write counts nothing. |
| `devops_cli_roadmap_tool_calls_total` | Counter | `1` | Tool calls of the roadmap planner and verifier, by tool, row, toolset and outcome. The outcome ok is a call that gave its result. The outcome empty is a call that ran and found nothing, such as a search with no match. The outcome error is a call that could not run or got no answer. The row is the job row of the run: stage for the planner, stage_verify for the verifier. Each run adds 0 for every tool of its toolset before its first model request. So a tool that no run calls keeps a series. |
| `devops_cli_roadmap_tool_answer_chars` | Histogram | `{char}` | Characters in the answer of each tool call of the roadmap planner and verifier, after the cut of the tool, by tool, row and toolset. The text of a refusal counts. A call that got no answer adds no observation. |
| `devops_cli_roadmap_tool_calls_per_run` | Histogram | `{call}` | Tool calls of each run of the roadmap planner and verifier, by row and toolset. A run that raised because a model call failed adds no observation. |
Expand Down
2 changes: 1 addition & 1 deletion k8s/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
schema: spec-driven
created: 2026-11-11
skip_specs: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Design

## Decisions

- The label holds the kind of the reason, and not the text. The text holds item numbers, times and counts, so it is not bounded. The kind is one value of `LeftOutKind` for each check of `_Judge`.
- A log line repeats only when the kind changes. The text of `queue_full` and `failed_lately` changes with counts and times, so a key on the text would log the same reason in each round.
- An item that the round handled with another result loses its logged kind, so a later reason logs again. An item that the round did not judge (past the limit) keeps its kind.
- The logged kinds are in a dict of the process with a lock and a public reset (`reset_left_out_log`), which the test floor calls.
- `LeftOut.kind` does not take part in the comparison, so two left-out items compare by their text as before.
- `reason` is on each point, with `none` for a result other than `skipped`, so each series of the counter has the same label names.

## Rejected alternatives

- A reason record in the job record of each item: each change of a reason makes a GitHub write in the round, and the Service already reads the record only to judge. The log line and the metric need no write.
- A log line for each left-out item in each round: 72 rounds in 48 hours for each repository give 72 lines with the same text for each item, which the issue names as noise.
- A label with the text of the reason: the text holds numbers and times, which make an unbounded set of series.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Proposal: #4521

## Why

The stage job of the Service gives no reason when it leaves out an item (#4521). `stage_results` gives the result `skipped` to each left-out, returned and rejected item, and `devops_cli_roadmap_stage_total` has only the labels `result` and `repo`. The Service logs no left-out reason. So in 48 hours, four managed repositories were idle in each round, and only `devops roadmap explain` on a clone showed the three reasons.

## What Changes

- Each rule of the stage selection has a bounded kind, `LeftOutKind` in the new module `roadmap/stage/stage_left_out.py`. `LeftOut` holds the kind of its reason. The checks of the title and of the author are split, so each kind names one rule.
- `devops_cli_roadmap_stage_total` gets the label `reason`: the kind of a skipped item, `returned` or `rejected` for an item that the writes returned or rejected, and `none` for the other results.
- The Service logs one line for each left-out item with its kind and text, and logs it again only when the kind changes. The memory of the logged kinds is in the process, so a restart logs each reason one time more.
- This is a change of the behavior that a person observes (a metric label and a log line), so it has a spec delta.

## Capabilities

- `roadmap-stage`: ADDED requirement "A left-out item counts and logs its reason".

## Impact

- `src/devops_cli/roadmap/stage/stage.py`, the new `src/devops_cli/roadmap/stage/stage_left_out.py`, `src/devops_cli/telemetry/instruments.py`, `docs/TELEMETRY.md` and `k8s/README.md`.
- The counter has a new label with at most 23 values for each repository. A dashboard or a query that sums by `result` gives the same totals.
- The change fits one pull request.

## Feasibility

Confirmed on origin/main 7234d718: `stage_results` (`src/devops_cli/roadmap/stage/stage.py`) maps each `plan.left_out`, `applied.returned` and `applied.rejected` item to `StageResult.SKIPPED`, and `emit_stage_results` emits only `result` and `repo`. `_Judge.reason` returns the first text of a list of checks, so each check gives one kind with no new judgment. `git grep -n "stage left out"` finds no log line. The issue holds the Prometheus and Loki queries that show the gap.

## Existing Tool Considered

The OTLP counter of the project (`emit` in `telemetry/instruments.py`) and the standard `logging` module, which the Service already uses, cover the label and the log line. The change adds no tool and deletes no code.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## ADDED Requirements

### Requirement: A left-out item counts and logs its reason
A stage round SHALL count a skipped item in `devops_cli_roadmap_stage_total` with the label `reason`, a bounded kind of the rule that left it out, such as `title_type`, `held`, `returned` or `rejected`, and `none` for another result. The Service SHALL log the kind and the text of the reason of a left-out item once, and again only when its kind changes.

#### Scenario: Each result carries a reason label
- **WHEN** a round leaves one item out for its title type, stages one, returns one and finds one rejected
- **THEN** the counter has one point each for `title_type`, `returned` and `rejected` under `skipped`, and one for `none` under `staged`

#### Scenario: A reason logs once until it changes
- **WHEN** three rounds leave one item out, the first two for its title type and the third for the label `needs-split`
- **THEN** each round counts the item, and two log lines name the item, one with `title_type` and one with `needs_split`
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Tasks

## 1. The kind of a left-out reason in the metric and the log (behavior)

- [x] 1.1 Write failing tests: each left-out item of the selection carries its kind, a skipped item counts under the kind of its reason, and three rounds log the reason of one item once for each kind.
- Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_selection.py tests/roadmap/stage/test_roadmap_stage_job.py`
- [x] 1.2 Add `LeftOutKind` and `log_left_out` in `src/devops_cli/roadmap/stage/stage_left_out.py`, give each check of `_Judge` its kind, add `skipped_reasons`, and add the label `reason` and the log call to `emit_stage_results` in `src/devops_cli/roadmap/stage/stage.py`.
- Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_selection.py tests/roadmap/stage/test_roadmap_stage_job.py`

## 2. Documents (other)

- [x] 2.1 Name the label `reason` in the counter description of `src/devops_cli/telemetry/instruments.py`, write `docs/TELEMETRY.md` again with `uv run devops docs generate`, and name the label and the log line in `k8s/README.md`.
- Verification: `$ uv run devops ci docs`

- Pending a person: review the diff in tuicr (tuicr -r origin/main..HEAD).
11 changes: 11 additions & 0 deletions openspec/specs/roadmap-stage/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -4224,3 +4224,14 @@ The stage plan validation SHALL NOT count a test file as a test of a module when
#### Scenario: The search reads a dotted name as fixed text
- **WHEN** `grep_at` searches for `devops_cli.lang.en.messages`, and one test holds that dotted name while another holds only the path `src/devops_cli/lang/en/messages.py`
- **THEN** `grep_at` returns only the test that holds the dotted name

### Requirement: A left-out item counts and logs its reason
A stage round SHALL count a skipped item in `devops_cli_roadmap_stage_total` with the label `reason`, a bounded kind of the rule that left it out, such as `title_type`, `held`, `returned` or `rejected`, and `none` for another result. The Service SHALL log the kind and the text of the reason of a left-out item once, and again only when its kind changes.

#### Scenario: Each result carries a reason label
- **WHEN** a round leaves one item out for its title type, stages one, returns one and finds one rejected
- **THEN** the counter has one point each for `title_type`, `returned` and `rejected` under `skipped`, and one for `none` under `staged`

#### Scenario: A reason logs once until it changes
- **WHEN** three rounds leave one item out, the first two for its title type and the third for the label `needs-split`
- **THEN** each round counts the item, and two log lines name the item, one with `title_type` and one with `needs_split`
Loading