Skip to content

fix(azure_storage): keep client call ids from sharing one Data Lake file - #44099

Merged
yucheng-berri merged 5 commits into
mainfrom
litellm_adls_keep_raw_client_call_id_names
Oct 2, 2026
Merged

yucheng-berri merged 5 commits into
mainfrom
litellm_adls_keep_raw_client_call_id_names

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • Two client call ids can share one Data Lake log file
  • svc/req-1 and svc_req-1 both became svc_req-1.json
  • The later request silently overwrites the earlier request's log

How it solves it:

User Flow

Before: a team that tags each request with its own x-litellm-call-id loses logs in Azure Data Lake

  1. The proxy admin turns on callbacks: ["azure_storage"] and points it at an ADLS Gen2 account
  2. A client sends POST https://litellm-domain/v1/embeddings with x-litellm-call-id: svc/req-1, then again with svc_req-1
  3. Both requests return 200
  4. The filesystem holds one file, svc_req-1.json, and the first request's log is gone

After: every call id leaves its own log file

  1. The proxy admin turns on callbacks: ["azure_storage"] and points it at an ADLS Gen2 account
  2. A client sends POST https://litellm-domain/v1/embeddings with x-litellm-call-id: svc/req-1, then again with svc_req-1
  3. Both requests return 200
  4. The filesystem holds svc/req-1.json and svc_req-1.json, each with its own request's log

Relevant issues

Fixes a regression from #43914

Screenshots / Proof of Fix

Four live proxies (2 workers each) with real Postgres and Redis, real OpenAI text-embedding-3-small and gpt-4.1-nano Responses calls, and a real ADLS Gen2 account with hierarchical namespace on. One proxy per tree per auth mode: the Entra bearer path and the account-key path, each writing to its own filesystem

model_list:
  - model_name: emb
    litellm_params:
      model: openai/text-embedding-3-small
  - model_name: resp-a
    litellm_params:
      model: openai/gpt-4.1-nano
litellm_settings:
  callbacks: ["azure_storage"]
for ID in "svc/r12-$PORT" "svc_r12-$PORT" "trace=r12-$PORT" "tracer12-$PORT" "dot/r12-$PORT" "dot/./r12-$PORT" "dbl//r12-$PORT"; do
  curl -s -o out.json -w '%{http_code}' localhost:$PORT/v1/embeddings -H "Authorization: Bearer $KEY" \
    -H "Content-Type: application/json" -H "x-litellm-call-id: $ID" -d '{"model":"emb","input":"hello"}'
done
curl -s localhost:$PORT/v1/responses -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"model":"resp-a","input":"say ok","max_output_tokens":16}'

The listing reads every object in the filesystem back from ADLS and prints the id stored inside it

Before (4b1d9bf)

Bearer path

  1. Every embedding request returns 200 with a 1536-dim embedding, and every Responses call returns 200 with a padded resp_...= id
  2. The filesystem lists 5 files for 7 ids, and svc/r12-4311 and tracer12-4311 have no log:
dbl__r12-4311.json     payload id='dbl//r12-4311'
dot_._r12-4311.json    payload id='dot/./r12-4311'
dot_r12-4311.json      payload id='dot/r12-4311'
svc_r12-4311.json      payload id='svc_r12-4311'
tracer12-4311.json     payload id='trace=r12-4311'

Account-key path

  1. Every embedding request returns 200 with a 1536-dim embedding, and every Responses call returns 200 with a padded resp_...= id
  2. The filesystem lists 5 files for 7 ids, and svc_r12-4312 and tracer12-4312 have no log because their look-alike ids took the file:
2026-10-01/dbl__r12-4312.json     payload id='dbl//r12-4312'
2026-10-01/dot_._r12-4312.json    payload id='dot/./r12-4312'
2026-10-01/dot_r12-4312.json      payload id='dot/r12-4312'
2026-10-01/svc_r12-4312.json      payload id='svc/r12-4312'
2026-10-01/tracer12-4312.json     payload id='trace=r12-4312'

After (4b96809)

Bearer path

  1. Every embedding request returns 200 with a 1536-dim embedding, and every Responses call returns 200 with a padded resp_...= id
  2. Each of the 7 ids has its own file holding its own log:
dbl__r12-4313.json     payload id='dbl//r12-4313'
dot/r12-4313.json      payload id='dot/r12-4313'
dot_._r12-4313.json    payload id='dot/./r12-4313'
svc/r12-4313.json      payload id='svc/r12-4313'
svc_r12-4313.json      payload id='svc_r12-4313'
trace=r12-4313.json    payload id='trace=r12-4313'
tracer12-4313.json     payload id='tracer12-4313'

Account-key path

  1. Every embedding request returns 200 with a 1536-dim embedding, and every Responses call returns 200 with a padded resp_...= id
  2. Each id has its own file, except trace=r12-4314, which SharedKey rejects as it did before fix(azure_storage): name Data Lake objects without base64 padding or slashes #43914 (see Caveats):
2026-10-01/dbl__r12-4314.json     payload id='dbl//r12-4314'
2026-10-01/dot/r12-4314.json      payload id='dot/r12-4314'
2026-10-01/dot_._r12-4314.json    payload id='dot/./r12-4314'
2026-10-01/svc/r12-4314.json      payload id='svc/r12-4314'
2026-10-01/svc_r12-4314.json      payload id='svc_r12-4314'
2026-10-01/tracer12-4314.json     payload id='tracer12-4314'

On both trees and both paths each filesystem also holds one resp_ file per Responses call, with the padding dropped as #43914 intended

Mutation check: applying the rewrite to every id again, dropping the resp_ condition, or narrowing the segment check to .. alone each turns the mapped unit test and the integration test red

Audit at 0add818

Merge base 4b1d9bf, head 0add818. Every cell runs the tests/integration harness with a real proxy on two workers, real Postgres and real Redis, with a scripted upstream and a wire-compatible Data Lake sink as the only doubles. The live rows are the four ADLS Gen2 proxies above

Cell Node Base Head (2 runs)
svc/req-1 vs svc_req-1, embeddings success test_client_call_ids_differing_only_by_slash_or_underscore_land_in_separate_files FAIL, one file flushed twice PASS, PASS
x vs ./x vs //x test_client_call_ids_with_dot_or_empty_segments_keep_their_own_files FAIL PASS, PASS
look-alike ids on upstream 500 test_failed_requests_with_look_alike_call_ids_keep_separate_failure_logs FAIL, overwrite PASS, PASS
look-alike ids on Redis cache hits test_cache_hits_with_look_alike_call_ids_keep_separate_logs FAIL PASS, PASS
256 char, oversized and blank ids test_longest_oversized_and_blank_call_ids_each_leave_one_log FAIL PASS, PASS
padded resp_ ids still rewritten test_responses_ids_with_base64_padding_land_under_adls_safe_names PASS PASS, PASS
parent segments keep main's name test_client_call_ids_with_parent_segments_stay_inside_the_log_directory PASS PASS, PASS
every surface, callback modes, sink 403 and 404, upstream 401, unknown model, missing filesystem, repeats, disabled callback, sibling file upload test_azure_storage_client_ttl.py (11 cells) PASS PASS, PASS
sink outage, slow sink, killed worker, restart before flush test_azure_storage_chaos.py (4 cells) PASS PASS, PASS
live bearer and account-key, real OpenAI and ADLS Gen2 four proxies above FAIL, 5 files for 7 ids PASS

The file name cells ran at 0add818, the only commit after 1e5587f, which changed nothing but their worker count. The TTL and chaos cells and the live rows are kept from 1e5587f and 4b96809, which carry the same product code

Type

🐛 Bug Fix

Caveats (if any)

Medium

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

Link to Devin session: https://app.devin.ai/sessions/8580345ed9ed42abbcd536b5745cabc1
Open in Devin Desktop: https://app.devin.ai/desktop/session/8580345ed9ed42abbcd536b5745cabc1?variant=devin
Requested by: @yucheng-berri

yucheng-berri and others added 3 commits October 1, 2026 22:58
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…n Data Lake file

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Changes how file names are generated for Azure storage logs.

The PR appears safe to merge based on the reviewed changes.

Summary

The PR preserves caller-supplied call IDs in Azure Data Lake filenames while retaining the rewrite for Responses IDs and unsafe path segments. The latest change runs the filename integration tests with two proxy workers.

Reviews (4) · Last reviewed commit: "test(azure_storage): run the Data Lake f..."

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@codspeed

codspeed Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_adls_keep_raw_client_call_id_names (0add818) with main (54a51c8)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (cc42a35) during the generation of this report, so 54a51c8 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@codecov

codecov Bot commented Oct 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…ta Lake file names

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai please review the current head 1e5587f

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

…orkers

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai please review the current head 0add818

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

2 issues from previous reviews remain unresolved.

Fix All in Cursor

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 0add818. Configure here.

@yucheng-berri
yucheng-berri merged commit 5a3a31e into main Oct 2, 2026
103 of 149 checks passed
@yucheng-berri
yucheng-berri deleted the litellm_adls_keep_raw_client_call_id_names branch October 2, 2026 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants