StreamProcessor discards metadata from REASONING_MESSAGE_START
维护者通常 1 天内回复
@tombeckenham 已经在做这个了。
开始于 2026年10月9日。
评估
这个 Issue 还没有评估数据。
描述
TanStack AI version
@tanstack/ai 0.66.0, installed from npm in an isolated directory.
The same behavior also occurs on main commit 96191eafee12040c78f849fe7d47220f64591684.
Framework/Library version
Node.js 26.6.0, with a bare StreamProcessor.
The reproduction does not need React, a provider, or an API key.
Describe the bug and the steps to reproduce it
Custom metadata on REASONING_MESSAGE_START does not survive conversion into a UIMessage.
The thinking text appears, but the resulting message has no metadata.
The reproduction uses one root run.
It compares the same metadata on two events:
- On
REASONING_MESSAGE_START: the metadata is lost. - On
REASONING_MESSAGE_CONTENT: the metadata is preserved.
Expected
The metadata remains available after processing the reasoning stream, consistently with the content-event case.
Actual
UIMessage.metadata is undefined when only the start event carries the metadata.
Steps
- Download the files from the reproduction gist.
- Run
npm install --ignore-scripts --no-audit --no-fund. - Run
npm run metadata.
The script first checks the content-event control.
That check passes.
The assertion for the start event then fails:
Metadata on START: undefined
Metadata on CONTENT: { source: 'reasoning', traceId: 'trace-1' }
AssertionError [ERR_ASSERTION]: Metadata on reasoning start is lost
Source
The dispatcher ignores REASONING_MESSAGE_START.
The content handler only merges metadata from the content event.
Please clarify the intended destination for reasoning-start metadata: the owning UIMessage or its ThinkingPart.
At present, neither exposes it.
Related issue
#1533 concerns reasoning ownership across different messages.
This report isolates metadata loss in one run.
Our local workaround copies the metadata onto reasoning content events.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
Complete runnable reproduction: metadata.mjs, package.json, and instructions
The package version is pinned to 0.66.0.
The second script in the gist provides an additional reproduction for #1533.
Screenshots or Videos (Optional)
No screenshot is needed for this framework-independent reproduction.
Do you intend to try to help solve this bug with your own PR?
Maybe, I'll investigate and start debugging.
No PR accompanies this report.
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct.
- I understand that if my bug cannot be reliably reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
- 主要语言
- TypeScript
- 星标
- 3.2k
- 派生
- 361
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 221
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TanStack/ai 的其他 Issue
-
fix(ai-anthropic): chat({ reasoning }) on Claude 4.6 sends a top-level effort and gets a 400可能已有人在做 @tombeckenham 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 20/100
维护者通常 1 天内回复
-
@tanstack/ai-anthropic: a stream that fails after message_start loses the call's input usage可能已有人在做 @AlemTuzlak 今天认领。 未关闭waiting-on: maintainer
维护者通常 1 天内回复
-
@tanstack/openai-base: Responses usage drops input_tokens_details.cache_write_tokens可能已有人在做 @tombeckenham 今天认领。 未关闭waiting-on: maintainer
维护者通常 1 天内回复
-
summarize() sends temperature 0.3 to models that reject sampling parameters (e.g. claude-sonnet-5-5)可能已有人在做 @jherr 于 2 天前认领。 未关闭has-pr waiting-on: maintainer
TanStack/ai#1703 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
ai-openrouter: malformed Chat Completions tool arguments execute as an empty object可能已有人在做 @tombeckenham 于 3 天前认领。 未关闭has-pr waiting-on: maintainer
维护者通常 1 天内回复
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 85/100
-
area:cowork area:desktop documentation enhancement platform:macos
难度 2/5 1-3 小时 新手友好度 68/100
anthropics/claude-code#101720 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
apache/rocketmq-dashboard#6610 ·
维护者通常 3 天内回复
-
Add: MS NOW未关闭check:passed streams:add
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
Global update drops overrideAccess, so Local API updateGlobal fails filterOptions validation (3.90 regression)可能已有人在做 @PINYOPATTANAWASANPORN 今天认领。 未关闭area: core Bug
难度 2/5 1-3 小时 新手友好度 76/100
payloadcms/payload#18674 · 1 条评论 ·
维护者通常 1 天内回复