Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (round 16): validate turn.mode in appendTurn
Adam Eivyada6a3a26a56
diff --git a/server/services/askConversations.js b/server/services/askConversations.jsindex bbe55a4b32..a32eea6dfe 100644--- a/server/services/askConversations.js+++ b/server/services/askConversations.js@@ -178,6 +178,12 @@ export async function appendTurn(conversationId, turn) {if (!turn || (turn.role !== 'user' && turn.role !== 'assistant')) {throw new Error('Turn must include role of "user" or "assistant"');}+ // Storage owns the persistence schema, so an invalid `turn.mode` shouldn't+ // be written to disk just because a future caller bypassed the route's+ // zod validation. Mirror the gate `createConversation` already enforces.+ if (turn.mode != null && !VALID_MODES.has(turn.mode)) {+ throw new Error(`Invalid mode: ${turn.mode}`);+ }const stamped = {id: turn.id || randomUUID(),role: turn.role,