Repository navigation
refactor(ai): test-only model request hooks leave src - #3768
Merged
Merged
Conversation
ALLOW_MODEL_REQUESTS, ModelNotAllowedError, _RUN_MESSAGES_CAPTURE, _is_testing_mode_active and ai/agents/testing.py had no caller outside tests. The tests now answer from the model_fake fixture.
Owner
Author
|
Test and check results:
|
dan-petty
marked this pull request as ready for review
November 6, 2026 07:30
dan-petty
pushed a commit
that referenced
this pull request
Nov 6, 2026
🤖 I have created a release *beep* *boop* --- ## [0.67.2](v0.67.1...v0.67.2) (2026-11-06) ### Code Refactoring * **ai:** test-only model request hooks leave src ([#3768](#3768)) ([9b01821](9b01821)) * **tests:** one DNS seam with a shared fake and contract suite ([#3773](#3773)) ([10c7896](10c7896)), closes [#3752](#3752) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Product code in
srcheld switches that only tests used (#3759, child A of #1330). Tests double only edges, andsrcmust hold no test switch (ADR 0007).ALLOW_MODEL_REQUESTSwas a flag inai/agents/agent.pyand inai/agents/testing.py.PydanticAgent.runread both and raisedModelNotAllowedErrorfor a client that was not a home-madeTestModelorFunctionModel._is_testing_mode_activeinai/pydantic_ai_bridge.pyread the same flags, andresolve_pydantic_ai_modelreturned a pydantic-aiTestModelwhen it was true._RUN_MESSAGES_CAPTUREwas aContextVarthatPydanticAgentfilled at the end of a run, for the home-madecapture_run_messages.Nothing outside tests set a flag or read a capture. This change removes all of them. Tests use the
ModelFakeinstead.Closes #3759
Change:
openspec/changes/archive/2026-11-06-3759-remove-test-model-hooks/