Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

MuxMetadata.mode is typed as string (for future custom modes), but the stats Zod schemas only accept "plan" | "exec" | undefined. The code was casting mode without validation, which TypeScript allowed but Zod rejected at runtime.

This caused ZodError spam on every stream delta event, since each delta triggers getSnapshot() which parses the schema.

Fix: Validate mode before storing/emitting - treat unknown modes as undefined for stats purposes.


Generated with mux • Model: anthropic:claude-opus-4-5 • Thinking: high

@ammar-agent ammar-agent force-pushed the fix/stats-tab-mode-validation branch from 21cd051 to 5c9de0b Compare December 20, 2025 20:49
MuxMetadata.mode is typed as string (for future custom modes), but the
stats Zod schemas only accept "plan" | "exec" | undefined. The code
was casting mode without validation, which TypeScript allowed but Zod
rejected at runtime.

This caused ZodError spam on every stream delta event, since each delta
triggers getSnapshot() which parses the schema.

Fix: validate mode before storing/emitting - treat unknown modes as
undefined for stats purposes.
@ammar-agent ammar-agent force-pushed the fix/stats-tab-mode-validation branch from 5c9de0b to addbac1 Compare December 21, 2025 02:24
@ammario ammario merged commit 133adb8 into main Dec 21, 2025
18 of 19 checks passed
@ammario ammario deleted the fix/stats-tab-mode-validation branch December 21, 2025 02:29
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.

2 participants