Latest Results
fix(core): preserve gateway tracing metadata in v3 streams (#41504)
Gateway-backed chat models using v3 streaming lose gateway tracing
metadata because the compatibility bridge folds `generation_info` into
public response metadata, then constructs a generation without it.
- Keep gateway metadata in a private stream accumulator and pass it to
tracing through `generation_info`.
- Exclude gateway metadata from public protocol events and assembled
messages while retaining ordinary response metadata.
- Report gateway metadata on failed v3 runs too. Error paths previously
sent an empty result to `on_llm_error`; they now carry metadata parsed
from the error's HTTP response (e.g. a 401 relayed by the gateway) or
collected from chunks received before the stream failed, matching the v1
`stream()` path. As on v1, failed v3 traces now include the error body,
response headers, and status code in their outputs.
- Cover sync/async direct streams and protocol-driven
`invoke`/`ainvoke`, including resolved gateway identity on traces, plus
sync/async failures before the first chunk and mid-stream.
<img width="2694" height="816" alt="image"
src="https://github.com/user-attachments/assets/cd308c99-ef9b-4ab5-bcec-8308522579e9"
/>
AI-assisted contribution.
Verified against the production LangSmith gateway: successful and failed
v3 runs now carry `ls_gateway_info` on their traces, matching `invoke`.
## Release note
Fix gateway tracing metadata for v3 chat-model streams, including failed
runs, without exposing gateway metadata in messages or streaming events.
## References
- [Slack
thread](https://langchain.slack.com/archives/C0984E1US9X/p1792797708390379?thread_ts=1792797708.390379&cid=C0984E1US9X)
Made by [Open SWE](https://github.com/langchain-ai/open-swe) · [view
thread](https://openswe.langchain.dev/agents/6b6f9c75-a618-5db4-a6a0-8f99ccb984b0)
· openai:gpt-6.1-sol (medium)
---------
Co-authored-by: Eugene Yurtsev <eyurtsev@users.noreply.github.com>
Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com> Latest Branches
-1%
0%
bengret/core/notification-message-factory 0%
dependabot/uv/libs/langchain_v1/authlib-1.9.1 © 2026 CodSpeed Technology