Skip to content

test(ai): harness slot tests patch no internals #3764

Closed

Description

@dan-petty

Problem or Motivation

Part of #1330. Two small test files outside the hand-rolled agent loop still patch devops_cli internals or import private names. The hand-rolled loop itself goes in #2489, so its tests are not part of this child.

Measured at origin/main 29309f0:

File Internal patches Private imports
tests/ai/harness/test_harness_slots.py 1: harness.slots.load_settings (line 458) 2: _evaluate_tiered_status, _summarize_search (line 433)
tests/ai/agents/test_agent.py 1: client._ollama_stream_request on an LLMClient instance (line 88) 0

Facts that decide the design:

  • AgentHarness.execute_tiered (ai/harness/slots.py:761) is the public caller of _evaluate_tiered_status and _summarize_search. It calls no model. It runs a symbol search, a file scout, or both, and gives the status from their outcomes.
  • The one load_settings patch tests that devops ai harness status shows the configured provider and model. The config fixture (tests/support/config.py) writes ai.provider and ai.model into the test's own config file.
  • test_ollama_stream_400_raises_client_error in test_agent.py is a test of the Ollama client. It sits in an agent file. LLMClient takes an httpx2 transport as a parameter, and the tests in tests/ai/client/ use it.

The other files of the old list stay out of this child:

Proposed Solution & Architectural Design

  1. Harness settings. Replace the load_settings patch with the config fixture (ai.provider and ai.model). Keep the same checks.
  2. Private helpers. Test the partial and failed statuses through AgentHarness.execute_tiered. Use one repository on which exactly one of the two searches fails. Use another on which both fail. Check status and summary of the result. If no public input gives one failing search, delete the case, because no public path reaches the branch (Q22). I did not check which input fails one search.
  3. Misplaced test. Move test_ollama_stream_400_raises_client_error to tests/ai/client/. It builds the LLMClient with an httpx2.MockTransport that answers HTTP 400, and calls the public streaming method with thinking on. It patches no method of the client and uses no MagicMock response.

Acceptance criteria

  • git grep -nE 'patch\("devops_cli\.|monkeypatch\.setattr\("devops_cli\.|patch\.object\(' -- tests/ai/harness/test_harness_slots.py returns no line.
  • tests/ai/harness/test_harness_slots.py imports no _-name from devops_cli.
  • tests/ai/agents/test_agent.py has no test of the Ollama client, and tests/ai/client/ holds the moved test under the same name.
  • The moved test fails if the client stops raising AIClientError with "HTTP 400" for that answer.
  • Every test that existed before still exists under the same name. Otherwise the pull request body lists it as deleted, with the reason, or as moved, with the new path.
  • uv run devops ci passes. The pull request body gives the patch and private-import counts before and after.

Out of scope: file names and splits (child F), and all tests of PydanticAgent, runner.py and the pipeline (#2489).

Target Subsystem

tests/ai/harness/test_harness_slots.py, tests/ai/agents/test_agent.py, tests/ai/client/.

Existing Tool Considered

No new tool and no new code. The work uses the config fixture of #1310 and httpx2.MockTransport, which the client tests already use.

Activity

  1. added
    source/agent
    type/test
    scope/ai
    status/new
    value/low
    effort/low
    on Nov 6, 2026
  2. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

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

    • Type: type/test. The test prefix of the title gives the type.
    • Scope: scope/ai. The (ai) scope of the title gives the scope.
    • Priority: P3-Low. Test cleanup with no user-facing impact; part of a broader tracker but not blocking.
    • Value: Low. Improves test maintainability but has no direct effect on end users.
    • Effort: Low. Two small test files with three specific, well-scoped changes: one patch replacement, one public-API rewrite, one test move.
    • Related: test(ai): the remaining ai modules are tested through their public interfaces on edge fakes, and the legacy provider layer leaves src #1331, which asks for a different change. Both test AI modules through public interfaces, but #1331 covers other ai/ subpackages while this candidate fixes harness slot and agent test files.
  3. added
    priority/p3-low
    on Nov 6, 2026
  4. added
    status/in-review
    and removed
    status/new
    on Nov 6, 2026
  5. added a commit that references this issue on Nov 6, 2026
    4d4f531
  6. removed
    status/in-review
    on Nov 6, 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/lowpriority/p3-lowscope/aisource/agenttype/testvalue/low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions