diff --git a/instrumentation-loongsuite/loongsuite-instrumentation-crewai/CHANGELOG.md b/instrumentation-loongsuite/loongsuite-instrumentation-crewai/CHANGELOG.md index fc512751d..78fcfe435 100644 --- a/instrumentation-loongsuite/loongsuite-instrumentation-crewai/CHANGELOG.md +++ b/instrumentation-loongsuite/loongsuite-instrumentation-crewai/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Fixed + +- Keep incidental provider requests out of the CrewAI VCR cassettes so a + first-use model-metadata fetch cannot fail the recorded tests. + ([#270](https://github.com/alibaba/loongsuite-python/pull/270)) + ## Version 0.9.0 (2026-09-07) There are no changelog entries for this release. diff --git a/instrumentation-loongsuite/loongsuite-instrumentation-crewai/tests/conftest.py b/instrumentation-loongsuite/loongsuite-instrumentation-crewai/tests/conftest.py index 7f2e67f20..c89b9b2a8 100644 --- a/instrumentation-loongsuite/loongsuite-instrumentation-crewai/tests/conftest.py +++ b/instrumentation-loongsuite/loongsuite-instrumentation-crewai/tests/conftest.py @@ -12,8 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os + import pytest +# litellm fetches its model cost map from raw.githubusercontent.com the first time +# it is used. Under ``record_mode=none`` that request has no recorded counterpart, +# so VCR reports "Can't overwrite existing cassette" and its method/host/path +# matchers fail against the recorded api.openai.com interactions. Loading the +# bundled copy keeps the suite offline; litellm documents the switch in +# ``litellm.litellm_core_utils.get_model_cost_map``. +os.environ.setdefault("LITELLM_LOCAL_MODEL_COST_MAP", "True") + def scrub_response_headers(response): """Clean up common sensitive response headers before recording.""" @@ -48,4 +58,15 @@ def vcr_config(): ], "before_record_response": scrub_response_headers, "decode_compressed_response": True, + # Requests incidental to the code under test must not reach the + # cassettes, or they fail playback under ``record_mode=none``. The + # litellm package's own conftest ignores its telemetry hosts for the + # same reason. + "ignore_hosts": [ + "raw.githubusercontent.com", + "us.i.posthog.com", + "app.posthog.com", + "api.litellm.ai", + "telemetry.crewai.com", + ], }