Skip to content

feat(ai): ai model and gateway commands list their requests in a dry run and make none #2241

Description

@dan-petty

Part of #886. Depends on sub-issue 00 (the dry-run class ratchet test).

Problem or Motivation

The owner's dry-run rule (#412) says that a dry run makes no external request and returns the requests that the real run would make. The #886 inventory (2026-10-25, commit 1bb164b) found 18 ai model and gateway commands that do not obey it:

  • 16 commands make an external request, or possibly make one, and have no request plan.
  • 1 commands change local state, make no external request and have no --dry-run.
  • 1 commands make no external request and need only the no-external-request class.

A command without a request plan either prints the generic Would run delegated command line under devops --dry-run, or fails with No such option: --dry-run, or prints an echo of its arguments. None of these shows the requests.

A command that makes no external request prints the generic Would run delegated command line under devops --dry-run and does not run, although running it is safe. Some of these commands have an echo-only --dry-run that prints only their arguments.

Proposed Solution & Architectural Design

For each command in the table:

  • Request plan: add --dry-run if it is missing. The dry run makes no external request, reads included. It returns the command's real result type, marked as a dry run, with the ordered PlannedRequest items (argv, stdin and env with <placeholders>, plus condition and repeat). Build each PlannedRequest from the same argument builder that the real run uses, so that the plan cannot drift from the run. Print it with render_request_plan. Give the command the request-plan class.
  • Local preview: add --dry-run. The preview prints the change and writes nothing. Give the command the no-external-request class.
  • Mark only: give the command the no-external-request class. devops --dry-run <command> then runs it normally.
  • Remove an echo-only preview (render_dry_run_result or @dry_run_command) when the command gets its new dry run, with no shim.
  • Remove the command's paths from tests/fixtures/dry_run_gaps.json.

Notes from the inventory:

  • These commands call a model or the gateway over HTTP (http/client.py:new_http_client, pydantic-ai). A plan names the endpoint and the method, and keeps prompts and keys out (<placeholders>).
  • ai gateway failover changes only local gateway state. It gets a --dry-run preview.
  • The table comes from a static walk of each callback and the functions that it calls. Check each row against the code before you change it. If a row is wrong, change the class to match the code, and record the evidence in the pull request.
Command --dry-run today External request Work Evidence
ai agents no yes request plan http: httpx2.Client @ http.client:new_http_client:169
ai benchmark yes yes request plan http: httpx2.Client @ http.client:new_http_client:169
ai chaos-model yes yes request plan http: httpx2.Client @ http.client:new_http_client:169
ai chat no yes request plan http: httpx2.Client @ security.vulnerability_lookup:OSVClient.init:211
ai gateway connect no yes request plan kubectl @ k8s.node_port:kubectl:41
ai gateway failover no no local preview -
ai gateway load no yes request plan http: httpx2.Client @ ai.pool_load:prometheus_query:47
ai gateway probe-backend no yes request plan http: httpx2.Client @ ai.gateway:_probe_backend_http:650
ai gateway render no no mark only -
ai gateway routes no yes request plan http: httpx2.Client @ ai.gateway:_query_model_info:281
ai gateway status no yes request plan http: httpx2.Client @ ai.gateway:GatewayRouter.probe_gateway:464
ai gateway tune no yes request plan valkey: valkey.Valkey @ valkey.client:ValkeyClient.init:151
ai models no yes request plan http: httpx2.HTTPTransport @ http.client:egress_transport:106
ai pipeline yes (echo only) yes request plan http: httpx2.Client @ security.vulnerability_lookup:OSVClient.init:211
ai preload no yes request plan http: httpx2.HTTPTransport @ http.client:egress_transport:106
ai prewarm no yes request plan http: httpx2.HTTPTransport @ http.client:egress_transport:106
ai prompt-eval yes (echo only) yes request plan valkey: valkey.Valkey @ valkey.client:ValkeyClient.init:151
ai test no yes request plan http: httpx2.Client @ http.client:new_http_client:169

Target Subsystem

AI & Agentic Review Pipeline

Existing Tool Considered

The work uses what the repository has: devops_cli.dry_run.requests.PlannedRequest and render_request_plan (#741), the dry-run class decorator and ratchet test from sub-issue 00, and the test guards in tests/conftest.py and tests/test_roadmap_dry_runs.py. No new dependency is necessary.

Acceptance Criteria

  • Each command in the table is out of tests/fixtures/dry_run_gaps.json, and the ratchet test passes.
  • For each request-plan command, devops <command> --dry-run and devops --dry-run <command> make no external request and print the ordered requests. Verified by tests with the process runner, the HTTP clients and the other clients patched to fail.
  • For each request-plan command with --format json or --json, the dry run returns the real result type marked as a dry run, with the planned requests. Verified by tests.
  • For each request-plan command, the plan holds the requests that the real run makes, in the same order. Verified by a test that runs the real command against a fake runner or client that records each call, and compares the calls with the plan (the pattern of tests/test_roadmap_dry_runs.py).
  • For each local-preview command, --dry-run prints the change and writes nothing. Verified by tests with the writer patched to fail.
  • For each mark-only command, devops --dry-run <command> runs the command normally. Verified by tests with the process runner and the HTTP clients patched to fail.
  • Echo-only previews of these commands are gone, with no shim.
  • The new tests start no process and open no socket. The pull request records their time.
  • uv run devops ci passes.

Source: #886

Proposed design

Problem statement

The dry-run rule (#412) requires that --dry-run makes no external request and prints the requests a real run would make. An inventory of 18 AI model and gateway commands found that none comply. Sixteen make external requests without a request plan. One changes local state without a --dry-run preview. One makes no external request but lacks the no-external-request class. Each command prints a generic line, fails with an unknown option, or echoes its arguments instead of showing the planned requests.

Acceptance criteria

  • Criterion 1: Each command in the table is removed from tests/fixtures/dry_run_gaps.json.
    Verification: Run the ratchet test and confirm it passes.
  • Criterion 2: For each request-plan command, devops --dry-run and devops --dry-run make no external request and print the ordered requests.
    Verification: Run tests with the process runner, HTTP clients, and other clients patched to fail.
  • Criterion 3: For each request-plan command with --format json or --json, the dry run returns the real result type marked as a dry run, with the planned requests.
    Verification: Run tests that check the returned type and its dry_run flag.
  • Criterion 4: For each request-plan command, the plan holds the requests that the real run makes, in the same order.
    Verification: Run a test that runs the real command against a fake runner or client that records each call, and compare the calls with the plan, following the pattern in tests/test_roadmap_dry_runs.py.
  • Criterion 5: For the local-preview command (ai gateway failover), --dry-run prints the change and writes nothing.
    Verification: Run tests with the writer patched to fail.
  • Criterion 6: For the mark-only command (ai gateway render), devops --dry-run runs the command normally.
    Verification: Run tests with the process runner and HTTP clients patched to fail.
  • Criterion 7: Echo-only previews of these commands are removed, with no shim.
    Verification: Search the codebase for render_dry_run_result and @dry_run_command on these commands and confirm they are absent.
  • Criterion 8: The new tests start no process and open no socket.
    Verification: Run the tests and confirm the network and process guards in tests/conftest.py do not trigger.
  • Criterion 9: uv run devops ci passes.
    Verification: Run uv run devops ci and confirm exit code 0.

Key questions

  • What existing infrastructure does the change use to build and render request plans?: The change uses PlannedRequest and render_request_plan from devops_cli.dry_run.requests, the dry-run class decorator, and the test guards in tests/conftest.py. The pattern is shown in tests/test_roadmap_dry_runs.py. [sources: src/devops_cli/commands/ci.py:54, tests/test_roadmap_dry_runs.py, tests/conftest.py]
  • How are the external requests of these commands classified in the inventory table?: Sixteen commands make HTTP calls (httpx2.Client or httpx2.HTTPTransport via http.client), one makes a kubectl call (ai gateway connect), and two make valkey calls (ai gateway tune, ai prompt-eval). One command (ai gateway failover) changes only local state. One command (ai gateway render) makes no external request. [sources: tests/test_roadmap_dry_runs.py]
  • What is the issue number of sub-issue 00 (the dry-run class ratchet test) that this issue depends on?: The body states the dependency on sub-issue 00 but does not give its issue number. The intake comment links feat(cli): each command declares its dry-run class, and a ratchet test stops a new command without one #2230 as a related item that asks for a different change. The exact number must be confirmed before planning this issue into a milestone. (proposed)
  • Which commands currently have an echo-only --dry-run that must be removed?: ai benchmark, ai chaos-model, ai pipeline, and ai prompt-eval have an echo-only --dry-run today. Their render_dry_run_result or @dry_run_code must be removed when the new request-plan dry run is added, with no shim. [sources: tests/test_roadmap_dry_runs.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/feature
    on Oct 25, 2026
  2. dan-petty commented on Oct 25, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.

    • Type: type/feature. The candidate adds a new feature to list requests in a dry run for ai commands.
    • Priority: P1-High. The change fixes a core rule about how dry runs work and is part of a larger effort.
    • Value: High. The change improves the predictability and safety of ai model and gateway commands during dry runs.
    • Effort: High. Many commands need modification to add request plans and handle dry-run logic correctly.
    • Related: feat(cli): each command declares its dry-run class, and a ratchet test stops a new command without one #2230, which asks for a different change. Both items work on the dry-run class ratchet test and related to #886.
  3. dan-petty commented on Oct 27, 2026

    @dan-petty
    OwnerAuthor

    Status set to Ready at d594b55 (see proposed design in issue body).

  4. added
    priority/p1-high
    status/ready
    effort/high
    value/high
    scope/ai
    status/in-progress
    and removed
    status/ready
    on Oct 28, 2026
  5. added a commit that references this issue on Oct 31, 2026
    cc32a2d
  6. added
    status/in-review
    and removed
    status/in-progress
    on Oct 31, 2026
  7. removed
    status/in-review
    on Oct 31, 2026
  8. added a commit that references this issue on Oct 31, 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/highpriority/p1-highscope/aisource/agenttype/featurevalue/high

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions