Skip to content

fix(ci): make litellm_internal_staging green (logging test + Bedrock Opus 4.7 self-heal)#29344

Merged
mateo-berri merged 2 commits into
litellm_internal_stagingfrom
litellm_fix_staging_ci
May 30, 2026
Merged

fix(ci): make litellm_internal_staging green (logging test + Bedrock Opus 4.7 self-heal)#29344
mateo-berri merged 2 commits into
litellm_internal_stagingfrom
litellm_fix_staging_ci

Conversation

@mateo-berri

@mateo-berri mateo-berri commented May 30, 2026

Copy link
Copy Markdown
Collaborator

Relevant issues

litellm_internal_staging CI was red. GitHub Actions was fully green, but the CircleCI build_and_test workflow on staging HEAD (f11c12d, pipeline #79824) had two failing jobs: logging_testing and llm_translation_testing. This PR fixes both. (Supersedes #29341, which was on a claude/ branch the CircleCI branch filter skips; moved here to a litellm_* branch so CircleCI runs.)

What this fixes

1. logging_testing.

#28909 hardened log_db_metrics to emit a minimal, non-sensitive event_metadata (only table_name when present, otherwise None) instead of dumping function_name, function_kwargs, and function_args onto the span; the function name still rides on the separate call_type argument. test_log_db_redis_services.py was not updated and still asserted "function_name" in event_metadata, so on the no-table_name path event_metadata is None and the assertion raised TypeError: argument of type 'NoneType' is not iterable.

This updates test_log_db_metrics_success to assert event_metadata is None for that path and adds test_log_db_metrics_event_metadata_is_safe, a regression guard that only the table name surfaces and that sensitive kwargs (tokens, prisma client) are never dumped.

2. llm_translation_testing.

All 8 failures were test_reasoning_effort_grid[bedrock_converse-bedrock-claude-opus-4-7-*] with BedrockException - {"message":"anthropic.claude-opus-4-7 is not available for this account..."}. The revert in #29326 dropped the workaround for the unentitled Opus cells on the assumption that the reactivated Bedrock account (888602223428) carries flagship Opus. Live Bedrock converse calls with that account (in both us-east-1 and us-west-2) confirm us.anthropic.claude-opus-4-6-v1 works but us.anthropic.claude-opus-4-7 returns "is not available for this account", so opus-4-7 is genuinely unentitled there and access requires an AWS Sales request rather than self-serve. The CircleCI AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY already point at 888602223428, so no credential rotation was needed.

Rather than restore the old xfail (which keeps reporting the cells as expected failures even after access is granted, so the wire translation never gets verified again), the bedrock-claude-opus-4-7 cell now runs the call and skips only when Bedrock replies "is not available for this account". The moment opus-4-7 is entitled, the same cells run their full wire assertions with no test edit. A focused unit test (test_model_unavailable_tolerates_only_the_declared_error) pins the tolerance predicate so any other failure still surfaces loudly and the available path still asserts.

Stacked PR

#29327 (Opus 4.8 reasoning-effort grid) branches off this PR. Its Bedrock opus-4-8 cell reuses this self-heal path; its Azure and Vertex opus-4-8 cells use a separate fail_reason xfail until a Foundry deployment exists and Vertex availability is confirmed.

Pre-Submission checklist

  • I have added meaningful tests
  • My PR passes all unit tests
  • My PR's scope is as isolated as possible
  • I have requested a Greptile review

Proof of Fix

CI-only test fix; the proof is the two previously-red CircleCI jobs turning green on this PR's branch. With opus-4-7 still unentitled on the CI account, the 8 bedrock-claude-opus-4-7 cells now report as skipped (bedrock-claude-opus-4-7: is not available for this account) instead of failing the suite, and logging_testing passes.

Before (staging HEAD pipeline #79824):

FAILED .../test_log_db_redis_services.py::test_log_db_metrics_success - TypeError: NoneType not iterable   (1 failed)
FAILED .../test_reasoning_effort_grid[bedrock_converse-bedrock-claude-opus-4-7-*] - "opus-4-7 is not available for this account"   (8 failed)

The CircleCI run on this PR's latest commit is the live proof.

CI (LiteLLM team)

  • Branch creation CI run: Link:
  • CI run for the last commit: Link:
  • Merge / cherry-pick CI run: Links:

Type

🐛 Bug Fix
✅ Test

Changes

tests/logging_callback_tests/test_log_db_redis_services.py: align event_metadata assertions with the redacted contract from #28909 and add a redaction regression test.

tests/llm_translation/reasoning_effort_grid/grid_spec.py and test_reasoning_effort_grid.py: replace the opus-4-7 xfail with a self-heal unavailable_error guard that skips only on Bedrock's "is not available for this account" reply and otherwise runs the full assertions, plus a unit test for the tolerance predicate.

…edaction

PR #28909 hardened log_db_metrics to emit a minimal, non-sensitive
event_metadata (only table_name when present, otherwise None) instead of
dumping function_name, function_kwargs, and function_args onto the span. The
test in test_log_db_redis_services was not updated and still asserted
"function_name" in event_metadata, which raised TypeError (argument of type
'NoneType' is not iterable) and turned the logging_testing CI job red on
litellm_internal_staging.

Update test_log_db_metrics_success to assert event_metadata is None when no
table_name is passed, and add test_log_db_metrics_event_metadata_is_safe as a
regression guard verifying that only the table name surfaces and that sensitive
kwargs (tokens, prisma client) are never dumped.
@greptile-apps

greptile-apps Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes two failing CircleCI jobs on litellm_internal_staging — a broken assertion in the DB-metrics test suite and 8 unentitled Bedrock Opus 4.7 cells incorrectly failing instead of xfailing.

  • test_log_db_redis_services.py: Updates test_log_db_metrics_success to assert event_metadata is None (matching the redacted contract introduced in feat(otel): typed semconv-aligned OpenTelemetry instrumentation #28909) and adds test_log_db_metrics_event_metadata_is_safe, a regression guard verifying only table_name surfaces and sensitive kwargs like tokens and Prisma clients are not leaked onto spans.
  • grid_spec.py + test_reasoning_effort_grid.py: Restores the ModelEntry.fail_reason field and adds an imperative pytest.xfail() guard so the 8 bedrock-claude-opus-4-7 cells report as expected failures (with a clear removal condition) rather than crashing the suite.

Confidence Score: 5/5

Safe to merge — both changes are test-only, all new assertions reflect the current production contract, and no production code is modified.

All three files are in the test layer and touch no production code. The modified assertion in test_log_db_metrics_success correctly tracks the documented behavior change from #28909 rather than weakening coverage, and the new test_log_db_metrics_event_metadata_is_safe test adds stronger regression protection for the sensitive-kwarg leak path. The fail_reason / xfail mechanism is minimal and well-scoped, with a clear removal condition embedded in the reason string itself.

No files require special attention.

Important Files Changed

Filename Overview
tests/llm_translation/reasoning_effort_grid/grid_spec.py Restores fail_reason: Optional[str] = None field to ModelEntry and marks the unentitled bedrock-claude-opus-4-7 cell with an xfail reason; all instances use keyword args so field insertion order is safe.
tests/llm_translation/reasoning_effort_grid/test_reasoning_effort_grid.py Adds pytest.xfail(model.fail_reason) guard before API calls; placement is correct — fires after env-var skip checks and before any network call, so the 8 unentitled Opus 4.7 cells report as xfail instead of failing the suite.
tests/logging_callback_tests/test_log_db_redis_services.py Aligns test_log_db_metrics_success to the post-#28909 contract (event_metadata is None on the no-table_name path) and adds test_log_db_metrics_event_metadata_is_safe as a regression guard that the table name surfaces but sensitive kwargs (token, prisma_client) do not.

Reviews (1): Last reviewed commit: "test(bedrock): restore opus-4-7 xfail wo..." | Re-trigger Greptile

The bedrock-claude-opus-4-7 converse cells are unentitled on the Bedrock CI
account, so they were marked xfail. xfail keeps reporting them as expected
failures even after access is granted, so the wire translation never gets
verified again. Now the cell makes the call and skips only when Bedrock
replies "is not available for this account"; the moment the model is
entitled the same cells run their full assertions with no edit.

A focused unit test pins the tolerance predicate so any other failure still
surfaces loudly and the available path still runs the assertions.
@mateo-berri mateo-berri force-pushed the litellm_fix_staging_ci branch from 96dc86c to 1015f9e Compare May 30, 2026 19:52
@codecov

codecov Bot commented May 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mateo-berri mateo-berri changed the title fix(ci): make litellm_internal_staging green (logging_testing + Bedrock Opus 4.7 xfail) fix(ci): make litellm_internal_staging green (logging test + Bedrock Opus 4.7 self-heal) May 30, 2026
@mateo-berri mateo-berri merged commit bfbb5d2 into litellm_internal_staging May 30, 2026
119 checks passed
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
…Opus 4.7 self-heal) (BerriAI#29344)

* test(logging): align DB metrics event_metadata assertions with safe redaction

PR BerriAI#28909 hardened log_db_metrics to emit a minimal, non-sensitive
event_metadata (only table_name when present, otherwise None) instead of
dumping function_name, function_kwargs, and function_args onto the span. The
test in test_log_db_redis_services was not updated and still asserted
"function_name" in event_metadata, which raised TypeError (argument of type
'NoneType' is not iterable) and turned the logging_testing CI job red on
litellm_internal_staging.

Update test_log_db_metrics_success to assert event_metadata is None when no
table_name is passed, and add test_log_db_metrics_event_metadata_is_safe as a
regression guard verifying that only the table name surfaces and that sensitive
kwargs (tokens, prisma client) are never dumped.

* test(bedrock): self-heal opus-4-7 grid cells when unentitled on CI

The bedrock-claude-opus-4-7 converse cells are unentitled on the Bedrock CI
account, so they were marked xfail. xfail keeps reporting them as expected
failures even after access is granted, so the wire translation never gets
verified again. Now the cell makes the call and skips only when Bedrock
replies "is not available for this account"; the moment the model is
entitled the same cells run their full assertions with no edit.

A focused unit test pins the tolerance predicate so any other failure still
surfaces loudly and the available path still runs the assertions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants