fix(trace): LLM_TTFT 父节点错误 + 前端未映射 ERROR/CANCELLED 状态#35
Open
melancholy154 wants to merge 1 commit into
Open
Conversation
后端:span.detach() 延迟到 awaitFirstPacket 之后执行,使 llm-first-packet 节点的 parentNodeId 正确指向具体的 provider 流式节点,而非 llm-stream-routing。 前端:STATUS_COLORS 补充 error 和 cancelled 状态映射,防止 故障转移场景下节点渲染崩溃。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
llm-first-packet(LLM_TTFT) 节点的parentNodeId错误指向llm-stream-routing,而非具体的 provider 流式节点ERROR/CANCELLED状态导致渲染崩溃Problem
后端:LLM_TTFT 父节点错误
AbstractOpenAIStyleChatClient.doStreamChat()在 finally 块中调用span.detach()弹出 LLM_PROVIDER 节点,但RoutingLLMService的awaitFirstPacket()(@RagTraceNode("llm-first-packet"))在 detach 之后才执行,导致 TTFT 节点的 parentNodeId 错误地指向llm-stream-routing:实际 trace 树:
前端:ERROR/CANCELLED 状态未映射
STATUS_COLORS只映射了success/failed/running/default,故障转移时 provider 节点状态为CANCELLED或ERROR,访问时导致页面崩溃。Fix
后端
doStreamChat不再在 finally 中 detach,改为通过StreamChatHandle将 span 携带返回StreamCancellationHandle新增default void detach() {}方法,向后兼容RoutingLLMService在awaitFirstPacket之后调handle.detach(),确保 TTFT 记录时 LLM_PROVIDER 节点仍在栈上前端
STATUS_COLORS补充error(红色)和cancelled(灰色)状态映射getStatusColors增加?? STATUS_COLORS.default兜底Test Plan
llm-first-packet的 parentNodeId 指向具体 provider 流式节点