Repository navigation
Closed
Labels
effort/mediumEffort Mediumpriority/p2-mediumPriority P2: standard workscope/aiAI review pipeline, personas, prompts, LLM client, or RAGsource/agentFiled by an agenttype/refactorType refactor: a new structure, same behaviorvalue/mediumValue Medium
Description
Problem or Motivation
Child A of the tracker #1330. Product code in src holds switches that only tests use. This breaks the rule that tests double only edges and that src holds no test switch (ADR 0007).
Measured at origin/main 44d9196 (2026-11-06):
ALLOW_MODEL_REQUESTSis a module flag insrc/devops_cli/ai/agents/agent.py:91and insrc/devops_cli/ai/agents/testing.py:16.PydanticAgent.runreads both (agent.py:875-888) and raisesModelNotAllowedErrorfor a client that is not aTestModelorFunctionModel.src/devops_cli/ai/pydantic_ai_bridge.py:145_is_testing_mode_active()reads the same flags.resolve_pydantic_ai_modelreturns a pydantic-aiTestModelwhen it is true._RUN_MESSAGES_CAPTUREis aContextVarinai/agents/testing.py.agent.py:970and:996copy the messages of each run into it.src/devops_cli/ai/agents/testing.pyholds a home-madeTestModel,FunctionModel,AgentInfoandcapture_run_messages. Only tests use them.config/constants.py:156lists the module as a domain exception module, anddocs/ERRORS.md:83listsModelNotAllowedError.- Test files that use these names:
tests/ai/agents/test_ai_agent_capabilities.py,tests/ai/mcp/test_pydantic_ai_mcp.py,tests/ai/models/test_pydantic_ai_ollama.py,tests/invariants/test_architectural_invariants.py,tests/ai/client/test_gateway_caller_headers.py,tests/ai/test_pydantic_ai_profiles_and_providers.py,tests/roadmap/test_roadmap_implement_step_output_cap.py.
Proposed Solution & Architectural Design
Delete the hooks and move the tests to the model seam that exists.
- Delete
ai/agents/testing.py,ALLOW_MODEL_REQUESTSinagent.py, the check inPydanticAgent.run,_is_testing_mode_active, and the capture buffer inagent.py. - Remove
devops_cli.ai.agents.testingfromCONST_DOMAIN_EXCEPTION_MODULESand regeneratedocs/ERRORS.md. - Tests that used the home-made
TestModeluse themodel_fakefixture (tests/support/fakes/model.py). Tests that monkeypatched_is_testing_mode_activeto false drop that line, because it was already false. The test of the removed flag goes. The hermetic floor already fails a test that reaches a model without a fake, so no new fake and no new seam is needed. - No change to
resolve_pydantic_ai_model("test"):testis the name that pydantic-ai gives to its ownTestModel.
Out of scope: children B to F of #1330, and the hand-rolled loop that #2489 deletes.
Target Subsystem
AI & Agentic Review Pipeline
Existing Tool Considered
pydantic-ai TestModel and FunctionModel, and the project fake ModelFake (model_fake fixture), cover every use. No new code is built. The change deletes about 120 lines of own code.
Acceptance criteria
git grep -nE 'ALLOW_MODEL_REQUESTS|ModelNotAllowedError|MODEL_REQUESTS_DISABLED|_RUN_MESSAGES_CAPTURE|_is_testing_mode_active|agents\.testing' -- src tests docs ':!docs/agent/archive'returns no line.src/devops_cli/ai/agents/testing.pydoes not exist.- The seven test files above keep their behavior coverage on
model_fake. uv run devops cipasses.
Related
Related: #1330 (parent tracker), #2489 (deletes the hand-rolled agent loop).
Metadata
Metadata
Assignees
Labels
effort/mediumEffort Mediumpriority/p2-mediumPriority P2: standard workscope/aiAI review pipeline, personas, prompts, LLM client, or RAGsource/agentFiled by an agenttype/refactorType refactor: a new structure, same behaviorvalue/mediumValue Medium
Activity
dan-petty commentedon Nov 6, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
refactorprefix of the title gives the type.(ai)scope of the title gives the scope.It removes architectural violations but blocks no user-facing feature.It removes about 120 lines of test-only code and restores the ADR 0007 rule for src.It deletes one module, edits two files, and updates seven test files to use model_fake.Both target test-only code in src for ai/agents, but #1330 is the umbrella tracker and the candidate is its child A covering only model request hooks.devops-cli-service commentedon Nov 6, 2026
Released in v0.67.2: https://github.com/dan-petty/devops-cli/releases/tag/v0.67.2
devops-cli-service commentedon Nov 6, 2026
Live since 2026-11-06 08:16 UTC