AG-UI TOOL_CALL_RESULT metadata is dropped in the live stream reducer
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- typescript
調査の方向性
Read packages/ai/src/activities/chat/stream/processor.ts and packages/ai/src/activities/chat/stream/message-updaters.ts, then compare with the snapshot conversion in packages/ai/src/activities/chat/messages.ts. Check the existing tests for live tool result events and add coverage for metadata preservation on creation and update; done means live results retain metadata consistently with hydrated snapshots. An open linked pull request already covers this issue.
索引モデルが issue の本文から書いたものです。
説明
Summary
The live AG-UI TOOL_CALL_RESULT handling path drops the event's metadata when constructing the ToolResultPart.
This makes metadata behave inconsistently between live streaming and message snapshot/history hydration: a ToolMessage.metadata received in a MESSAGES_SNAPSHOT can be preserved, but the same metadata delivered on a live TOOL_CALL_RESULT is not available on the resulting UIMessage.parts entry.
Expected behavior
When a TOOL_CALL_RESULT event contains metadata, the resulting ToolResultPart should retain it:
{
type: 'tool-result',
toolCallId: 'call-123',
content: '...',
state: 'complete',
metadata: {
displayType: 'account-assets',
},
}
Actual behavior
In packages/ai/src/activities/chat/stream/processor.ts, handleToolCallResultEvent() receives the full event, but calls updateToolResultPart() without forwarding chunk.metadata.
In packages/ai/src/activities/chat/stream/message-updaters.ts, updateToolResultPart() constructs a ToolResultPart containing content, state, error, and outcome, but does not set metadata.
The public ToolResultPart type in packages/ai/src/types.ts already declares metadata?: Record<string, unknown>, and the snapshot conversion path in packages/ai/src/activities/chat/messages.ts preserves metadata from tool messages. So the type and snapshot path support this field, but the live event reducer currently drops it.
Reproduction
-
Stream an AG-UI
TOOL_CALL_RESULTevent with ametadataobject:{ "type": "TOOL_CALL_RESULT", "messageId": "assistant-1", "toolCallId": "call-123", "content": "{\"ok\":true}", "metadata": { "displayType": "account-assets" } } -
Observe the resulting
UIMessage.partsentry withtype === 'tool-result'. -
The
contentis present, butmetadatais missing.
Suggested fix
Forward the event metadata into updateToolResultPart() and persist it on the created ToolResultPart. Please also consider how metadata should be merged when an existing tool-result part is updated, so an update does not accidentally discard previously stored metadata.
Add a regression test covering:
- Live
TOOL_CALL_RESULT.metadatais retained inToolResultPart.metadata. - Snapshot/history hydration and live streaming produce consistent metadata.
- Updating an existing tool-result part does not unintentionally lose metadata.
Relevant code
- Live event handling
- Tool result updater
- ToolResultPart type
- Snapshot conversion preserves tool message metadata
Thanks!
- 主要言語
- TypeScript
- スター
- 3.3k
- フォーク
- 378
- 平均マージ
- 1日 2時間
- マージ済み PR(30日)
- 254
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TanStack/ai のほかの issue
-
openai-base: a Responses max_output_tokens cutoff ends as RUN_ERROR without usage instead of finishReason 'length'対応中かも @tombeckenham が 8 日前に担当しました。 オープンhas-pr waiting-on: maintainer
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
TanStack/ai#1916 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
ai-sandbox: encrypt snapshot blobs at rest with an encrypting blob store wrapper対応中かも @AlemTuzlak が 1 日前に担当しました。 オープンwaiting-on: maintainer
メンテナーはふだん 1 日以内に返信
-
Sandbox takeover: the saved transcript loses everything the first host delivered before the restart対応中かも @tombeckenham が 1 日前に担当しました。 オープンwaiting-on: maintainer
メンテナーはふだん 1 日以内に返信
-
withSandbox: each run's save drops the harness tool calls of earlier runs対応中かも @tombeckenham が 1 日前に担当しました。 オープンhas-pr waiting-on: maintainer
メンテナーはふだん 1 日以内に返信
-
ai-compaction: checkpoint never reused when the store returns message keys in another order対応中かも @tombeckenham が 1 日前に担当しました。 オープンhas-pr waiting-on: maintainer
メンテナーはふだん 1 日以内に返信
似ている issue
-
The sample email preview's ResizeObserver is never disconnected and keeps raising errors after leaving Settings対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
area:ui bug effort:S priority:P2
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Typo in WSL project description on Projects page対応中かも @akhil9tiet が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
microsoft/opensource.microsoft.com#1066 · コメント 1 件 ·
-
ArcGIS Maps SDK for JavaScript c-carousel calcite-design-tokens enhancement impact - p3 - not time sensitive needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Esri/calcite-design-system#15565 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
linkwarden/linkwarden#1891 ·
メンテナーはふだん 1 日以内に返信