Commit cb7b2eb
committed
🤖 fix: add contextUsage fields to MuxMessageSchema
The MuxMessageSchema metadata object was missing contextUsage and
contextProviderMetadata fields. When messages were serialized through
oRPC/Zod, these fields were silently stripped (Zod's default behavior).
This caused context usage to display cumulative usage (from the 'usage'
field) instead of last-step usage (from 'contextUsage'), resulting in
wildly inflated percentages (e.g., 944% instead of ~50%) after app restart.
The bug only appeared after restart because during live streaming, the
frontend received the fields before oRPC serialization. On reload, messages
pass through the schema and lose the fields.
_Generated with mux_1 parent ca4c4bf commit cb7b2eb
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
79 | 81 | | |
| 82 | + | |
| 83 | + | |
80 | 84 | | |
81 | 85 | | |
82 | 86 | | |
| |||
0 commit comments