Skip to content

Feature: 支持trace上报思考文本放<trace_think>块里#225

Merged
raychen911 merged 1 commit into
mainfrom
feature/trace_thought_tag
Jul 23, 2026
Merged

Feature: 支持trace上报思考文本放<trace_think>块里#225
raychen911 merged 1 commit into
mainfrom
feature/trace_thought_tag

Conversation

@weimch

@weimch weimch commented Jul 23, 2026

Copy link
Copy Markdown
Contributor
  • 方便区分思考文本和正常文本,同时保持兼容性

- 方便区分思考文本和正常文本,同时保持兼容性
@helloopenworld

Copy link
Copy Markdown
Contributor

AI Code Review

审查完成。下面是结论。

发现的问题

未发现明显阻塞问题。

本次变更新增 _join_parts_with_thought_tag 辅助函数,将模型思考(thought)片段用 <trace_think> 标签包裹后再 join,trace_runner/trace_cancellation/trace_agent 三处调用路径均统一替换为该函数,trace_agentoverride_messages 分支也做了等价改造(原先 not part.thought 跳过 thought,现在改为带标签保留),逻辑一致且边界处理(part.text or ""getattr(part, "thought", False))稳妥。新增两条测试覆盖了 runner 与 agent 的 thought 路径,断言符合实现。

💡 Suggestion

  • trpc_agent_sdk/telemetry/_trace.py:271-276trace_agentoverride_messages 分支手动内联了与 _join_parts_with_thought_tag 完全相同的 thought 包裹逻辑,建议复用该辅助函数(需注意此分支会过滤掉 part.text 为空的 part,而辅助函数保留空串——若行为有意保留差异可忽略,否则合并可减少重复维护成本)。

总结

整体风险低,逻辑正确、边界处理稳妥、测试覆盖了关键路径,不存在必须修复的问题。

测试建议

暂无额外测试建议。

@weimch
weimch force-pushed the feature/trace_thought_tag branch from 0c06ce1 to b393238 Compare July 23, 2026 08:33
@raychen911
raychen911 merged commit 86781c7 into main Jul 23, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants