From 564f48c1b133569452614c1849acf082745beef4 Mon Sep 17 00:00:00 2001 From: Jonathan Mieloo <32547391+jonathanlab@users.noreply.github.com> Date: Tue, 31 Mar 2026 10:45:14 +0200 Subject: [PATCH] Revert "feat(code): add /clear command to reset conversation history (#1248)" This reverts commit fefe98cbe83198695c1f8ea13ed9e4bf4c71ecba. --- .../features/message-editor/commands.ts | 13 ------------- .../features/sessions/service/service.ts | 18 +++--------------- .../src/adapters/claude/session/commands.ts | 1 - 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/apps/code/src/renderer/features/message-editor/commands.ts b/apps/code/src/renderer/features/message-editor/commands.ts index b1f7707cd..3cacc20f6 100644 --- a/apps/code/src/renderer/features/message-editor/commands.ts +++ b/apps/code/src/renderer/features/message-editor/commands.ts @@ -1,5 +1,4 @@ import type { AvailableCommand } from "@agentclientprotocol/sdk"; -import { getSessionService } from "@features/sessions/service/service"; import { ANALYTICS_EVENTS, type FeedbackType } from "@shared/types/analytics"; import { track } from "@utils/analytics"; import { toast } from "@utils/toast"; @@ -52,18 +51,6 @@ const commands: CodeCommand[] = [ makeFeedbackCommand("good", "good", "Positive"), makeFeedbackCommand("bad", "bad", "Negative"), makeFeedbackCommand("feedback", "general", "General"), - { - name: "clear", - description: "Clear conversation history and start fresh", - async execute(_args, ctx) { - if (!ctx.repoPath || !ctx.taskId) { - toast.error("Cannot clear: no active session"); - return; - } - await getSessionService().resetSession(ctx.taskId, ctx.repoPath); - toast.success("Conversation cleared"); - }, - }, ]; export const CODE_COMMANDS: AvailableCommand[] = commands.map((cmd) => ({ diff --git a/apps/code/src/renderer/features/sessions/service/service.ts b/apps/code/src/renderer/features/sessions/service/service.ts index 6200253c8..c9c289eed 100644 --- a/apps/code/src/renderer/features/sessions/service/service.ts +++ b/apps/code/src/renderer/features/sessions/service/service.ts @@ -1793,23 +1793,11 @@ export class SessionService { /** * Start a fresh session for a task, abandoning the old conversation. - * Tears down the current session and creates a new task run so that - * S3 logs start clean — old messages won't reappear on restart. + * Clears the backend sessionId so the next reconnect creates a new + * session instead of attempting to resume the stale one. */ async resetSession(taskId: string, repoPath: string): Promise { - const session = sessionStoreSetters.getSessionByTaskId(taskId); - if (!session) return; - - const { taskTitle } = session; - - await this.teardownSession(session.taskRunId); - - const auth = this.getAuthCredentials(); - if (!auth) { - throw new Error("Unable to reach server. Please check your connection."); - } - - await this.createNewLocalSession(taskId, taskTitle, repoPath, auth); + await this.reconnectInPlace(taskId, repoPath, null); } /** diff --git a/packages/agent/src/adapters/claude/session/commands.ts b/packages/agent/src/adapters/claude/session/commands.ts index 47037142c..889fc8166 100644 --- a/packages/agent/src/adapters/claude/session/commands.ts +++ b/packages/agent/src/adapters/claude/session/commands.ts @@ -2,7 +2,6 @@ import type { AvailableCommand } from "@agentclientprotocol/sdk"; import type { SlashCommand } from "@anthropic-ai/claude-agent-sdk"; const UNSUPPORTED_COMMANDS = [ - "clear", "context", "cost", "keybindings-help",