Skip to content

test(dspy): disable LM retries on the one-shot 401 cassette - #3830

Merged
caroger merged 1 commit into
mainfrom
fix/dspy-lm-error-vcr-retries
Sep 23, 2026
Merged

caroger merged 1 commit into
mainfrom
fix/dspy-lm-error-vcr-retries

Conversation

@caroger

@caroger caroger commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • TestLM.test_exception_event_recorded_on_lm_error replays a cassette with one 401. DSPy's LM retries three times by default, so LiteLLM POSTs chat/completions again, VCR raises cassette-already-consumed, and the span records that instead of the API-key error.
  • Pass num_retries=0 so the cassette matches the request.

This is the py310-ci-dspy / py314-ci-dspy failure that is currently blocking full-matrix Python CI (including #3716). Open PRs #3728 and #3818 do not cover this.

Test plan

  • uvx --with tox-uv tox run -e py310-ci-dspy in this worktree: 28 passed, 1 skipped
  • Confirm py310-ci-dspy and py314-ci-dspy are green on this PR

DSPy defaults to three LiteLLM retries, which posts chat/completions again after the cassette's single 401 and fails VCR replay.
@github-actions

Copy link
Copy Markdown
Contributor

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@caroger
caroger merged commit 263a2cb into main Sep 23, 2026
24 checks passed
@caroger
caroger deleted the fix/dspy-lm-error-vcr-retries branch September 23, 2026 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants