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> fix(core): escape node metadata in Mermaid labels (#41512)
`draw_mermaid` writes node metadata into node labels as-is, so a list
value like LangGraph's `__tools` produces brackets that Mermaid can't
parse. Any graph with a `ToolNode`, or user metadata containing
brackets, fails to render.
## Changes
- String, number and bool values render as before; lists, tuples and
sets of those are joined with `, `, with sets sorted so output is stable
across runs.
- Dicts and nested values are left out of the label; a node with nothing
left gets no metadata section.
- Mermaid-significant characters (`#[](){}"<>|`) are replaced with
Mermaid entity codes.
## Release note
`draw_mermaid` and `draw_mermaid_png` no longer produce invalid Mermaid
for nodes with list, dict, or bracketed metadata.
## Test Plan
- [x] Unit tests: list, sorted set, dict, escaped string, all-omitted
metadata; existing snapshots unchanged
This PR was written with help from an AI agent.
🤖 Generated with [Claude Code](https://claude.com/claude-code) Latest Branches
0%
bengret/core/notification-message-factory 0%
dependabot/uv/libs/langchain_v1/authlib-1.9.1 0%
eyurtsev/core/v3-gateway-tracing © 2026 CodSpeed Technology