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.
Summary
_ensure_model_wrappedNone check (7c84b727):_ensure_model_wrapped()calledtype(instance._model)without checking forNone, crashing withAttributeError: type object 'NoneType' has no attribute 'request'when an agent is created without a model parameter._is_patchedMRO inheritance bug (be713f48):_is_patched()usedgetattr()which walks the MRO, so wrappingWrapperModelfirst causedInstrumentedModelto appear already-patched (it inherited the flag from its parent). This meantInstrumentedModel.request()was never wrapped and the inner "chat" span was lost when logfire co-instruments pydantic_ai.test_pydantic_ai_logfirenox session that installs bothpydantic_aiandlogfireto verify they coexist correctly.Fixes #1324
Test plan
nox -s test_pydantic_ai_logfirepasses (2 spans: agent_run + chat)nox -s "test_pydantic_ai_integration(latest)"passes (50 tests + 369 core)nox -s pylintpasses🤖 Generated with Claude Code