diff --git a/crates/goose-server/src/routes/reply.rs b/crates/goose-server/src/routes/reply.rs index df33fd2ea4..0cc40535eb 100644 --- a/crates/goose-server/src/routes/reply.rs +++ b/crates/goose-server/src/routes/reply.rs @@ -79,8 +79,11 @@ fn track_tool_telemetry(content: &MessageContent, all_messages: &[Message]) { #[derive(Debug, Deserialize, Serialize, utoipa::ToSchema)] pub struct ChatRequest { user_message: Message, + /// Override the server's conversation history. Only use this when you need absolute control + /// over the conversation state (e.g., administrative tools). For normal operations, the server + /// is the source of truth - use truncate/fork endpoints to modify conversation history instead. #[serde(default)] - conversation_so_far: Option>, + override_conversation: Option>, session_id: String, recipe_name: Option, recipe_version: Option, @@ -240,7 +243,7 @@ pub async fn reply( let cancel_token = CancellationToken::new(); let user_message = request.user_message; - let conversation_so_far = request.conversation_so_far; + let override_conversation = request.override_conversation; let task_cancel = cancel_token.clone(); let task_tx = tx.clone(); @@ -285,7 +288,7 @@ pub async fn reply( retry_config: None, }; - let mut all_messages = match conversation_so_far { + let mut all_messages = match override_conversation { Some(history) => { let conv = Conversation::new_unvalidated(history); if let Err(e) = state @@ -489,7 +492,7 @@ mod tests { .body(Body::from( serde_json::to_string(&ChatRequest { user_message: Message::user().with_text("test message"), - conversation_so_far: None, + override_conversation: None, session_id: "test-session".to_string(), recipe_name: None, recipe_version: None, diff --git a/ui/desktop/openapi.json b/ui/desktop/openapi.json index 5ff80c10a4..832bd713af 100644 --- a/ui/desktop/openapi.json +++ b/ui/desktop/openapi.json @@ -3898,11 +3898,12 @@ "session_id" ], "properties": { - "conversation_so_far": { + "override_conversation": { "type": "array", "items": { "$ref": "#/components/schemas/Message" }, + "description": "Override the server's conversation history. Only use this when you need absolute control\nover the conversation state (e.g., administrative tools). For normal operations, the server\nis the source of truth - use truncate/fork endpoints to modify conversation history instead.", "nullable": true }, "recipe_name": { diff --git a/ui/desktop/src/api/types.gen.ts b/ui/desktop/src/api/types.gen.ts index 98ce500928..93e1677293 100644 --- a/ui/desktop/src/api/types.gen.ts +++ b/ui/desktop/src/api/types.gen.ts @@ -60,7 +60,12 @@ export type CallToolResponse = { }; export type ChatRequest = { - conversation_so_far?: Array | null; + /** + * Override the server's conversation history. Only use this when you need absolute control + * over the conversation state (e.g., administrative tools). For normal operations, the server + * is the source of truth - use truncate/fork endpoints to modify conversation history instead. + */ + override_conversation?: Array | null; recipe_name?: string | null; recipe_version?: string | null; session_id: string; diff --git a/ui/desktop/src/hooks/useChatStream.ts b/ui/desktop/src/hooks/useChatStream.ts index ef78641c77..c4732fbec0 100644 --- a/ui/desktop/src/hooks/useChatStream.ts +++ b/ui/desktop/src/hooks/useChatStream.ts @@ -590,7 +590,6 @@ export function useChatStream({ body: { session_id: sessionId, user_message: newMessage, - ...(hasExistingMessages && { conversation_so_far: currentState.messages }), }, throwOnError: true, signal: abortControllerRef.current.signal, @@ -771,7 +770,6 @@ export function useChatStream({ body: { session_id: targetSessionId, user_message: updatedUserMessage, - conversation_so_far: truncatedMessages, }, throwOnError: true, signal: abortControllerRef.current.signal,