Skip to content

feat(roadmap): report the live shadow bar of the command gate from Loki #5208

Not planned

Description

@dan-petty

Problem or Motivation

The step from mode shadow to mode on needs live data over 14 days: rest parts judged, the would-run share, fallbacks, gate latency and cost (rollout gate b of tracker #5199). A pull request cannot wait 14 days for its own acceptance, and the owner can merge a pull request minutes after it opens.

  • Prometheus counters of runner Jobs lose the count up to their first sample in increase(). For devops_cli_ai_requests_total{job="devops-cli-job"} over 7 days, sum(last_over_time) = 83 but sum(increase) = 1.5. So these counters cannot measure the bar.
  • The framework records no cost for Jev: increase(litellm_spend_metric_total{model=~".*jev.*"}) = 0 over 7 days.

Proposed Solution & Architectural Design

Add devops roadmap eval command-gate --shadow --days <n>. It reads the Loki lines of the runner Jobs: the decision record lines of implement.command_gate, and the Command gate: lines with their seconds field. It prints the values of rollout gate (b):

The report also lists the kept masked text of the would-run commands (owner decision 3 of 2026-11-12, kept by #5201 and #5206). A person labels at least 30 of them for the labelled review. Who labels waits for the owner (tracker #5199, open question 2).

Put the LogQL text of each value in README.md. Set implement.command_gate: shadow in k8s/devops/configmap.example.yaml, with a comment.

After the merge, an agent does these steps (agents may set mode shadow):

  1. Apply shadow to the live ConfigMap.
  2. Check the facts probe line of feat(roadmap): build the command gate facts from the manifests and a probe #5203 in the first live Job.
  3. After 14 days, run the report, and file an owner decision issue with it through devops roadmap intake.

Files: src/devops_cli/roadmap/command_gate/shadow_report.py, src/devops_cli/commands/roadmap_eval_command_gate.py, k8s/devops/configmap.example.yaml, README.md, tests/roadmap/command_gate/test_roadmap_command_gate_shadow_report.py.

Target Subsystem

SDLC, Git & PR Governance (src/devops_cli/roadmap/, the eval commands) and Kubernetes & Minikube Automation (the ConfigMap).

Existing Tool Considered

Loki LogQL through the existing Loki client. Cost: about 0.3M tokens and half a day.

Acceptance Criteria

  1. tests/roadmap/command_gate/test_roadmap_command_gate_shadow_report.py: on a recorded fixture of Loki lines, the report prints the right counts, excludes audit records and cache hits, and computes p95 from the seconds field.
  2. The report sends 0 model requests. A socket-blocked test asserts this for every request except the Loki fake.
  3. README.md holds the LogQL of each rollout value, and k8s/devops/configmap.example.yaml sets shadow.
  4. uv run devops ci test tests/roadmap/command_gate passes.

Dependencies

Related

Source: #5199

Alternatives check of 2026-11-28: in-use.
The repository already uses this tool.
Tool: grafana/loki (https://github.com/grafana/loki), AGPL-3.0, last activity 2026-11-28, maintained.
Reason: Searches confirmed Loki as the log store and LogQL engine the project already queries through its existing client; its range aggregations give the counts, shares, fallback rate and p95 seconds the shadow bar needs, so only a thin report command is added.

Covers:

  • Label filters and line matching over runner Job logs
  • Range aggregations such as count_over_time and sum by
  • quantile_over_time over the parsed seconds field for p95
  • JSON or logfmt parsing of decision record lines
  • Existing Loki client in the project already queries it

Lacks:

  • No ready-made command-gate shadow report
  • Does not know which records are audit records or cache hits
  • No listing of kept masked would-run command text
  • No rollout gate bar thresholds or owner decision output
  • Needs project README docs for each LogQL value

Proposed design

Problem statement

Prometheus counters for runner Jobs lose the count before their first sample. The Jev spend metric is zero. The project cannot measure rollout gate (b) from these metrics. This item adds a command-gate shadow report. The report reads Loki lines and prints rest parts, would-run share, fallbacks, gate p95 and cost.

Acceptance criteria

Requirement: Command accepts shadow options

The devops roadmap eval command-gate command SHALL accept --shadow and --days <n> and print the rollout gate (b) report.

Scenario: Recorded Loki fixture run

  • WHEN a test runs devops roadmap eval command-gate --shadow --days 7 with a recorded Loki fixture
  • THEN the command exits 0 and prints the rest parts, the would-run count and share, the fallback rate, the gate p95 and the cost

Requirement: Report reads runner Job lines

The command-gate shadow report SHALL read the implement.command_gate decision records and the Command gate: lines with their seconds field from Loki.

Scenario: Runner Job lines are read

  • WHEN the report reads a recorded Loki fixture of runner Job lines
  • THEN the report uses the decision records and the gate lines in its values

Requirement: Report excludes audit and cache records

The command-gate shadow report SHALL count rest parts, the would-run count and share, and the fallback rate with audit records and cache hits excluded.

Scenario: Audit and cache records are not rest parts

  • WHEN the report reads a recorded Loki fixture that holds decision records, audit records and cache hits
  • THEN the report shows the rest-part count, the would-run count and share, and the fallback rate with audit records and cache hits excluded

Requirement: Report computes gate p95

The command-gate shadow report MUST compute the gate p95 from the seconds field of the Command gate: lines.

Scenario: Known seconds values give the p95

  • WHEN the report reads a recorded Loki fixture whose Command gate: lines have known seconds values
  • THEN the report prints the p95 of those values

Requirement: Report reports Jev cost

The command-gate shadow report SHALL report the cost from the Jev spend records of #4296.

Scenario: Spend records give the cost

  • WHEN the report reads a recorded Loki fixture with Jev spend records
  • THEN the report prints the cost that those records hold

Requirement: Report lists kept masked commands

The command-gate shadow report SHALL list the kept masked text of the would-run commands.

Scenario: Masked commands are listed

  • WHEN the report reads a recorded Loki fixture with would-run commands and their kept masked text
  • THEN the report prints each kept masked command

Requirement: Report sends no model request

The command-gate shadow report MUST send zero model requests.

Scenario: Socket-blocked test

  • WHEN a test blocks sockets except the Loki fake and runs the report
  • THEN the report completes and no model request is made

Requirement: README documents LogQL

README.md SHALL hold the LogQL text of each rollout gate (b) value.

Scenario: Docs check passes

  • WHEN a person runs uv run devops ci --check --only docs
  • THEN the docs row passes for README.md

Requirement: Example ConfigMap sets shadow

The example ConfigMap MUST set the implement.command_gate mode to shadow under roadmap.decisions.

Scenario: Kubernetes check passes

  • WHEN a person runs uv run devops ci --check --only k8s
  • THEN the k8s row passes for k8s/devops/configmap.example.yaml

Requirement: Command-gate test suite passes

The command-gate tests SHALL pass with uv run devops ci test tests/roadmap/command_gate.

Scenario: Test command passes

  • WHEN a person runs uv run devops ci test tests/roadmap/command_gate
  • THEN the command exits 0

Existing Tool Considered

grafana/loki is in use (alternatives check in the issue body). The proposal adds the devops roadmap eval command-gate --shadow --days subcommand. It adds the exclusion of audit records and cache hits. It lists the kept masked would-run commands that the block says Loki lacks.

Key questions

  • Which data source supplies the command-gate shadow measurements?: Loki LogQL over the runner Job lines supplies the measurements. The lines are the implement.command_gate decision records and the Command gate: lines with their seconds field. (best practice) [sources: src/devops_cli/roadmap/jev_shadow_report.py]
    • Chosen: Loki LogQL over runner Job lines. Loki selects the decision and gate lines. It runs the count, share, fallback and quantile queries.
    • Rejected: Prometheus counters with increase(). The runner Job counters lose the count before their first sample. The Jev spend metric is zero.
  • Which command and module layout does the report use?: A new devops roadmap eval command-gate command in src/devops_cli/commands/roadmap_eval_command_gate.py calls the report in src/devops_cli/roadmap/command_gate/shadow_report.py. (best practice) [sources: src/devops_cli/commands/roadmap_eval_jev.py, src/devops_cli/roadmap/jev_shadow_report.py, tests/commands/test_roadmap_eval_jev.py]
    • Chosen: New eval command and report module. It keeps command-gate reporting separate from Jev. It follows the existing eval command pattern.
    • Rejected: Extend devops roadmap eval jev. It mixes two decision points in one command and one report module.
  • How does the report avoid model requests?: The report uses the existing Loki client only and no AI client. A socket-blocked test permits the Loki fake and asserts that every other request fails. (best practice) [sources: src/devops_cli/roadmap/jev_shadow_report.py, tests/roadmap/test_roadmap_jev_shadow_report.py]
    • Chosen: Loki client only. The report needs log queries. A socket-blocked test can prove that no model request leaves.
    • Rejected: Use the AI client to summarize the report. It adds model cost and breaks the zero-model-request criterion.
  • Which mode goes into the example ConfigMap?: Set roadmap.decisions.implement.command_gate to shadow with a comment. (best practice) [sources: k8s/devops/configmap.example.yaml, src/devops_cli/roadmap/decision_point.py]
    • Chosen: shadow. The issue asks for shadow. ADR 0020 says shadow records the answer and keeps the rule.
    • Rejected: on. A person has not read the shadow records and their fit.
  • Where does the cost value come from?: The cost comes from the Jev spend records of feat(ai): record the cost of Jev calls that pass through the gateway #4296. It does not come from the Prometheus Jev spend metric. (best practice) [sources: k8s/devops/configmap.example.yaml]
  • Should the report use the decision point registry for the command gate?: Yes. implement.command_gate is a decision point. The report reads its mode and records from the registry and the shadow records. (best practice) [sources: src/devops_cli/roadmap/decision_point.py, k8s/devops/configmap.example.yaml]
    • Chosen: Use the decision point registry. ADR 0020 and the existing roadmap.decisions settings make each mode a registered point.
    • Rejected: Add a standalone roadmap.implement.command_gate setting. It duplicates the mode handling that the decision point registry already gives.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#6521, #5207, #4296

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 12, 2026
  3. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 12, 2026
  5. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 485e4cd while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

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

    @devops-cli-service
    Contributor

    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 (6)

    Tools considered:

    Searches run:

    • open source tool report log-derived metrics p95 from Loki logs, results: 5
    • logcli Grafana Loki command line LogQL metric queries quantile_over_time, results: 5
    • grafana loki logcli GitHub repository, results: 5
    • logcli query Loki logs from the command line, results: 5
    • loki logcli binary release assets, results: 5
    • "logcli" grafana.com docs loki query instant range, results: 5

    Sources:

  7. dan-petty commented on Nov 20, 2026

    @dan-petty
    OwnerAuthor

    Frozen on 2026-11-20. The stage, implement and fix-checks jobs grade under 60%, so the owner rule asks for a re-architecture before more fixes inside the current design (tracker #6519). This item is incremental work on those jobs, so its Dependencies section now names #6521 first. Stage and implement leave this item while #6521 is open. When the experiments of #6519 decide, a person closes #6521 (this item can then continue) or closes this item as not planned.

  8. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    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.

  9. dan-petty commented on Nov 30, 2026

    @dan-petty
    OwnerAuthor

    Triage under #6519 (owner instruction of 2026-11-30), before the hold #6521 closes. This item adds or extends a gate, refusal, screen, cap, limit, retry, result line, shell allowlist, tool catalog or plan-shape rule of the stage, implement or fix-checks job. #6519 found that 263 of about 900 issues in four weeks added such rules and none replaced the engine. Stage now runs on stock Coder (grade 60 on 30 graded attempts), where the agent reads the repository, runs the checks in its loop and has a real shell; implement follows (#6527). The code paths that this item names have also moved. If the failure class still shows in graded attempts, file a new item from that evidence. Closed as not planned; a person may reopen it.

  10. removed
    status/new
    on Nov 30, 2026
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/mediumpriority/p2-mediumscope/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions