Skip to content

ci: crewai instrumentation tests failing on main (VCR cassette + OpenAI API connection error) #230

Description

@ralf0131

Problem

The loongsuite-instrumentation-crewai test suite is failing on the main branch. This is a pre-existing issue on main, not introduced by any specific PR.

Failing CI Runs

Run Branch Conclusion Date
#28212953288 main ❌ failure 2026-06-26 02:18 UTC
#28212331441 main ❌ failure 2026-06-26 02:00 UTC

Last passing run: #28080659127 on 2026-06-24 06:49 UTC ✅

Affected Versions

All Python versions: 3.10, 3.11, 3.12, 3.13 (Ubuntu)

Failure Details

1 failed, 47 passed — the failing test is:

FAILED instrumentation-loongsuite/loongsuite-instrumentation-crewai/tests/test_error_scenarios.py::TestErrorScenarios::test_api_key_missing

Error chain:

  1. VCR cassette overwrite failure:

    WARNING LiteLLM: Failed to fetch remote model cost map from
    https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json:
    Can't overwrite existing cassette
    (.../tests/cassettes/test_agent_workflow/TestAgentWorkflow.test_hierarchical_workflow.yaml)
    in your current record mode (<RecordMode.NONE: 'none'>).
    
  2. VCR matcher failures:

    Matchers failed:
    method - assertion failure
    host - assertion failure
    path - assertion failure
    
  3. OpenAI API connection error (fallback to live API):

    ERROR root:completion.py:1772 Failed to connect to OpenAI API: Connection error.
    ERROR root:completion.py:452 OpenAI API call failed: Failed to connect to OpenAI API: Connection error.
    ERROR crewai.flow.runtime:__init__.py:2978 Error executing listener call_llm_and_parse: Failed to connect to OpenAI API: Connection error.
    

Root Cause Hypothesis

The VCR cassette for test_agent_workflow.TestAgentWorkflow.test_hierarchical_workflow no longer matches the HTTP requests being made. When the cassette match fails, the test falls back to making a real OpenAI API call, which fails in CI (no network access to OpenAI API).

This likely started after one of these commits merged between 2026-06-24 and 2026-06-26:

A dependency update (likely crewai or litellm) may have changed the HTTP request format, causing the cassette matchers (method/host/path) to fail.

Suggested Fix

  1. Re-record the VCR cassette for test_hierarchical_workflow with the current dependency versions
  2. Or update the cassette matchers to be more lenient (e.g., match on uri instead of method + host + path)
  3. Or pin the crewai/litellm version to match the cassette recording

Impact

  • Blocks PRs that trigger the crewai test matrix (e.g., #229)
  • The test_api_key_missing test in test_error_scenarios.py is also failing as a side effect

Reported by github-manager-bot

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions