litellm/tests/unit/proxy/anthropic_endpoints
Mateo Wang 386fb49dff
fix(responses): cache bridged system prompts on stored GPT-6.2 requests (#52906)
* fix(responses): cache bridged system prompts on stored GPT-6.2 requests

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

* fix(responses): skip a system prompt the stored chain already holds

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

* fix(responses): keep the stored chain lookup out of logging callbacks

The lookup that reads the start of a stored chain went through the logged
list_input_items entry points, so callbacks received the chain's stored
messages as a call of its own, even on a no-log request. It now runs as a
no-log subcall. Also narrows the lookup's error handling and drops two
mutable annotations so the strict lint and type discipline gates pass

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

* fix(responses): keep instructions on truncation auto and read Azure chains with AD credentials

A follow-up that sets truncation auto no longer reads the stored chain, since
truncation may cut the stored system message. The lookup also forwards the
deployment's Azure AD credentials, so token-only Azure deployments can read
the chain

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

* fix(responses): read the stored chain only from the provider of the request

A LiteLLM-encoded previous_response_id carries a provider that the listing call
follows, so an id naming another provider sent the request's credentials there.
The lookup now uses the provider's own id and is skipped, keeping instructions,
when the id names a different provider

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

* fix(responses): apply the request timeout to the stored chain lookup

Listing a response's input items dropped the timeout it was given, so the
lookup before a follow-up turn could wait past the caller's limit

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

* fix(responses): send the request's extra headers on the stored chain lookup

A gateway that authenticates by header rejected the lookup, so follow-up
turns kept sending the system prompt twice

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

* fix(responses): send only the caller's instructions on a follow-up whose chain holds the system prompt

A follow-up that carries both a system prompt and the caller's own instructions
sent them joined, so the stored system prompt was billed again. It now sends
only the caller's part, as the first turn did. The stored chain lookup also
uses the deployment's ssl_verify setting

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>
2026-11-19 14:03:43 -08:00
..
__init__.py test(proxy): move utils, agent_endpoints and endpoint tests into tests/unit/proxy (#44006) 2026-10-01 11:06:42 -07:00
test_answered_status.py fix(anthropic): answer an upstream Anthropic 529 as 529 overloaded_error on /v1/messages (#46063) 2026-11-03 17:37:09 -08:00
test_claude_code_marketplace.py fix(tests): repair the unit tests failing on main's full run (#52769) 2026-11-18 22:41:59 -08:00
test_claude_code_skill_access.py feat(auth): read projects, tags, access groups and object permissions through rust repositories (#52178) 2026-11-18 22:32:06 +00:00
test_endpoints.py fix(responses): cache bridged system prompts on stored GPT-6.2 requests (#52906) 2026-11-19 14:03:43 -08:00
test_gateway_endpoints.py feat(auth): decide key and JWT authentication in a Rust core (#51374) 2026-11-17 14:07:47 +09:00
test_skill_upload_archive.py test(skills): drop the archive rejection test whose zip-byte ids differ across xdist workers (#50118) 2026-11-04 22:12:55 +00:00
test_skills_endpoints.py test(proxy): move utils, agent_endpoints and endpoint tests into tests/unit/proxy (#44006) 2026-10-01 11:06:42 -07:00
test_streaming_model_restamp.py fix(streaming): keep merged think tags balanced and split SSE lines only on CR/LF (#48755) 2026-10-28 17:00:29 -07:00