Repository navigation
Description
Update 2026-11-26 (infra move): The recording rules go in k8s/devops/monitoring/prometheus-rules-values.yaml.
k8s/monitoring/prometheus-values.yaml moved to dan-petty/homelab and holds only environment rules.
Part of #5164 (child 9, long term).
Problem or Motivation
The owner wrote on 2026-11-12: "These aren't hard numbers and I would like to have dynamic gaugesin the long term tuned to project performance history", and "above 80% success we can also look at cost, time, and token efficiency". The grades of #5164 use fixed floors (0.90 to 0.60), and child 8 uses a fixed 25% rise as the efficiency signal. A workflow that normally holds 0.95 and falls to 0.86 stays at grade 80 with no signal, and a fixed 25% is too tight for one workflow and too loose for another.
Proposed Solution & Architectural Design
Design note (in the OpenSpec change of this item):
- Baseline. For each workflow and repository, the 28-day success ratio
p̄from the recorded series of child 7. 28 days stay inside the 30-day retention of Prometheus and Loki. - Success limit. A binomial p-chart: lower limit
p̄ − 3·√(p̄(1 − p̄)/n)for the attemptsnof the 7-day window. A 7-daypunder the lower limit is "under its own normal". This is a signal next to the owner floors. The owner floors stay the policy. - Efficiency targets. The 28-day median and p90 of tokens, seconds and cost for each success. A 7-day median over the 28-day p90 is an efficiency signal. This replaces the fixed 25% of child 8.
- Cold start. Under 28 days of lines or under 100 attempts in the baseline, the fixed values of child 8 apply.
- Prometheus recording rules compute both. The grade report and the grade-check step read them.
Target Subsystem
Kubernetes monitoring (k8s/devops/monitoring/prometheus-rules-values.yaml) and SDLC, Git & PR Governance (src/devops_cli/roadmap/).
Existing Tool Considered
A p-chart is the standard statistical process control chart for a proportion (NIST/SEMATECH e-Handbook, section 6.3.3.2), and PromQL computes it. No maintained Python SPC library is in use (pyspc has had no release for years). Cost: about 300,000 tokens, 6 hours elapsed, after 28 days of lines.
Acceptance Criteria
promtool test rulespasses for the limit atp̄0.95, n 40 (lower limit about 0.85), and for the cold start.- The grade report shows "under its own normal" for a fixture at 0.82 on a 0.95 baseline.
- The efficiency signal of child 8 reads the 28-day p90 when the baseline is ready.
Dependencies
#5172, #5173, and 28 days of result lines (about 2026-12-10 for the roadmap jobs).
Alternatives check of 2026-11-28: in-use.
The repository already uses this tool.
Tool: prometheus/prometheus (https://github.com/prometheus/prometheus), Apache-2.0, last activity 2026-11-28, maintained.
Reason: Searches confirm PromQL recording rules compute the binomial lower limit and 28-day median/p90 targets, and no maintained Python SPC library exists; the grade report and grade-check read path remain project code.
Covers:
- Recording rules for the 28-day success ratio per workflow and repository
- PromQL arithmetic for the p-chart lower limit from n and p̄
- quantile_over_time for 28-day median and p90 of tokens, seconds, cost
- promtool test rules for the fixture acceptance criteria
Lacks:
- No grade report showing under its own normal
- No grade-check step that reads the recorded series
- No cold-start fallback under 28 days or 100 attempts
- Retention caps the baseline window at about 30 days
Proposed design
Problem statement
Build the 28-day baseline with Prometheus recording rules, and add project code for the grade report and grade-check. Fixed grade floors and a fixed 25% efficiency rise do not fit each workflow's history. The item adds a 28-day baseline for each workflow and repository, a binomial p-chart lower limit and median/p90 efficiency targets. Prometheus recording rules compute the values, and the owner floors stay policy. A cold-start fallback keeps the fixed child 8 values until the baseline has 28 days and 100 attempts. The work waits only on #5172 and #5173.
Acceptance criteria
Requirement: Baseline success ratio
The monitoring rules SHALL record a 28-day success ratio for each workflow and repository from the result series.
Scenario: 28-day ratio from a fixture
- WHEN
promtool test rulesruns a fixture with 28 days of success and failure attempts for one workflow and repository. - THEN The recorded 28-day success ratio series returns the expected ratio, and
promtool test rulesexits 0.
Requirement: Binomial lower limit
The monitoring rules SHALL record the lower binomial limit p̄ − 3·√(p̄(1 − p̄)/n) for the 7-day attempt count n.
Scenario: Lower limit at p̄ 0.95 and n 40
- WHEN
promtool test rulesruns a fixture with a 28-dayp̄of 0.95 and a 7-daynof 40. - THEN The recorded lower limit is 0.85 within 0.01 of the formula result, and
promtool test rulesexits 0.
Requirement: Efficiency targets
The monitoring rules SHALL record the 28-day median and p90 of tokens, seconds and cost for each success, and the 7-day median of each.
Scenario: 7-day median over 28-day p90
- WHEN
promtool test rulesruns a fixture whose 7-day median tokens exceed its 28-day p90 tokens. - THEN The recorded token efficiency signal is 1, and
promtool test rulesexits 0.
Requirement: Under its own normal
The grade report SHALL show under its own normal when the 7-day success ratio is below the recorded lower limit and the baseline is ready.
Scenario: 0.82 on a 0.95 baseline
- WHEN A test renders the grade report for a fixture with a 28-day
p̄of 0.95, a 7-daynof 40 and a 7-daypof 0.82. - THEN The report shows
under its own normaland keeps the owner floor grade unchanged.
Requirement: Efficiency signal in the grade report
The grade report SHALL show the efficiency signal when the 7-day median exceeds the 28-day p90 and the baseline is ready.
Scenario: 7-day median over 28-day p90 in the report
- WHEN A test renders the grade report for a fixture with a 28-day p90 tokens of 1000 and a 7-day median tokens of 1200.
- THEN The report shows the token efficiency signal and keeps the owner floor grade unchanged.
Requirement: Cold start fallback
The grade report SHALL use the fixed child 8 values while the baseline has under 28 days of lines or under 100 attempts.
Scenario: Cold start uses fixed values
- WHEN A test renders the grade report for a workflow with 27 days of lines, and for one with 99 attempts in 28 days.
- THEN The report uses the fixed 25% efficiency value and shows no
under its own normalsignal.
Requirement: Grade-check reads recorded signals
The grade-check step SHALL read the recorded lower limit and efficiency series from Prometheus and MUST NOT compute its own baseline.
Scenario: Grade-check reads the recorded limit and efficiency
- WHEN A test runs the grade-check step on a fixture with a recorded lower limit and efficiency series and a 7-day ratio below the limit.
- THEN The step reports the
under its own normaland efficiency signals from the recorded series and starts no baseline query of its own.
Existing Tool Considered
in-use: prometheus/prometheus (https://github.com/prometheus/prometheus). The alternatives block in the issue body lists what the tool covers and lacks. The proposal uses its recording rules and PromQL for the 28-day baseline, the p-chart lower limit and the median/p90 targets, and its promtool test rules for the rule tests. It adds project code in src/devops_cli/roadmap/ for the grade report, the grade-check read path and the cold-start fallback, which the tool lacks. The 28-day window stays inside the 30-day retention that the block names.
Key questions
- Where do the new recording rules live?: The new recording rules go in
k8s/devops/monitoring/prometheus-rules-values.yaml. The environment rules moved to dan-petty/homelab and are not in this repository. [sources: k8s/devops/monitoring/prometheus-rules-values.yaml] - Which tool computes the control limits and efficiency targets?: Prometheus recording rules with PromQL compute the p-chart lower limit and the 28-day median and p90 targets. The alternatives check records
in-usefor prometheus/prometheus. The grade report and grade-check read path are project code insrc/devops_cli/roadmap/. (best practice) [sources: k8s/devops/monitoring/prometheus-rules-values.yaml]- Chosen: Prometheus recording rules. The repository already uses Prometheus, and PromQL computes the lower limit and the percentiles.
- Rejected: Python SPC library. No maintained SPC library is in use, and the alternatives check found none.
- Rejected: App-side computation. It duplicates the history store and gives no shared series for the report and check.
- Does the dynamic success limit replace the owner floors?: No. The lower limit is a signal next to the owner floors. The owner floors stay the policy. (best practice) [sources: docs/roadmap/job-success.md]
- Chosen: Keep the owner floors and add the signal. The owner set the floors as policy, and the limit adds history context.
- Rejected: Replace the owner floors. The owner floors are policy and do not change with a workflow history.
- What applies before the baseline is ready?: The fixed child 8 values apply while the baseline has under 28 days of lines or under 100 attempts. The fixed 25% efficiency signal applies in that time. (best practice) [sources: docs/roadmap/job-success.md]
- Chosen: Fixed cold-start fallback. A workflow with no baseline still needs a grade.
- Rejected: No signal. A new workflow would show no efficiency signal at all.
- Rejected: Wait for 28 days. A new workflow cannot wait for a baseline before it reports a grade.
- Does a signal fail the grade-check?: No. The grade report and the grade-check show the signal with the grade. A signal does not fail the check. (best practice) [sources: docs/roadmap/job-success.md]
- Chosen: Signal only. The owner asked to look at cost, time and tokens, not to gate on them.
- Rejected: Hard gate. Normal variation would fail the check.
Fit
Fits in one pull request.
Suspected block
None.
Activity
dan-petty commentedon Nov 12, 2026
Marked long-term child 9, depends on 28 days of data, and improves existing fixed values rather than fixing a break.Both work on Prometheus monitoring for job grades, but #5172 records the raw success series while the candidate computes dynamic statistical limits from that series.devops-cli-service commentedon Nov 20, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.
devops-cli-service commentedon Nov 22, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (10)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 28, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.