Skip to content

fix(review): the review dry run shows the request the model client would send, built by that client #1430

Closed

Description

@dan-petty

Problem

Checked at release/v0.2.29 (05e9388). --dry-run must send nothing and return the requests a real run would send (#412). The review's preview, _llm_request_preview (ai/review/runner.py:165-226), is a separate hand-written copy of each provider's request, and it no longer matches what the client sends:

  • claude: getattr(config, "api_base_url", "https://api.anthropic.com") returns None, because the field exists and is unset, so the previewed endpoint is None/v1/messages (:187-189).
  • gateway: the provider falls into the OpenAI branch with an empty base, so the previewed endpoint is /chat/completions (:206-213).
  • openai: the preview shows https://api.openai.com/v1/chat/completions, while the client posts without /v1 (the OpenAI base-URL item filed from the same audit).
  • ollama: the preview falls back to a localhost Ollama URL when none is configured (:150, :171), which fix(config): service clients use only configured urls and never fall back to an unconfigured localhost default #1165 forbids.
  • all providers: the previewed body omits max_tokens, thinking, sampling and Ollama options, which the client sends.

Proposed remedy

Acceptance criteria

Related: #412, #886, #1001, #1314, #1165

Found by the 2026-10-08 client-library audit.

Opened as a borrow (#1153, budget/borrowed): the agent filing quota is spent for this cycle, and this is a defect or security finding of the owner-requested 2026-10-08 client-library audit.

Activity

  1. added
    type/bug
    scope/review
    source/agent
    on Oct 8, 2026
  2. dan-petty-bot commented on Oct 8, 2026

    @dan-petty-bot
    Collaborator

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Priority: P2-Medium. It misleads users about what a real run would send, but only affects a diagnostic preview and does not break production runs.
    • Value: Medium. Users relying on dry-run to verify provider configuration or request shape receive wrong endpoints and incomplete bodies, undermining the feature's purpose.
    • Effort: Medium. Requires wiring a MockTransport recording path through the client, deleting per-provider preview branches, handling secret masking, and adding offline tests across five providers.
  3. dan-petty commented on Oct 20, 2026

    @dan-petty
    OwnerAuthor

    Friction

    devops review path --dry-run starts a real gh auth token, and in tests that gh reaches the developer's real D-Bus session bus. A dry run should make no requests, and no test may start a real gh.

    Evidence

    • In tests/test_cli_startup_imports.py::test_cli_dry_run_imports_only_plan_dependencies[review], the test's child devops review path --dry-run runs gh auth token. That happens on the first git call, from _lookup_github_token in src/devops_cli/core/process.py.
    • gh is the test's grandchild, so a guard on the test process's own subprocess.Popen doesn't see it.
    • strace shows that gh connecting to /run/user/1000/bus, the real session bus where gnome-keyring holds secrets, although the test floor's isolate_session_bus is in place. gh gets a minimal environment without XDG_RUNTIME_DIR and falls back to the default bus path.
    • The same child runs gcc, ld and ldconfig: ctypes.util.find_library looks for macOS frameworks on Linux.

    Remedy

    • A dry run resolves no GitHub token and starts no gh.
    • The environment given to git and gh children keeps the floor's bus isolation, so a child can't reach the real bus.

    Acceptance criteria

    • Tests first: devops review path --dry-run starts no gh. A spawn probe of the child process tree shows it.
    • No test's process tree connects to the real session bus.
    • uv run devops ci passes.
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

    scope/reviewsource/agenttype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions