Skip to content

fix(langchain): use runName argument in handleChainStart to fix unknown_chain spans #19555

Description

@github-actions

Note

The pull request "fix(langchain): use runName argument in handleChainStart to fix unknown_chain spans" was created by @priscilawebdev but did not reference an issue. Therefore this issue was created for better visibility in external tools like Linear.

handleChainStart in createLangChainCallbackHandler only read 4 of the 8 parameters
LangChain passes to the callback. The 8th argument, runName, carries the actual
node/run name (e.g. LangGraph node names), but the implementation never reached it.

chain.name is not a standard property on LangChain's Serialized type and is always
undefined, so every chain span fell back to 'unknown_chain' regardless of what the
actual chain or node was named.

The fix expands the signature to accept all 8 parameters and uses runName as the first
fallback before chain.name:

const chainName = runName || chain.name || 'unknown_chain';

This matches how handleLLMStart and handleChatModelStart already handle their
equivalent runName parameter (accepted but currently unused — chain spans are the
most impactful case since LangGraph passes node names there).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions