From 4a410b844b53391bda550fac5e0073c2cecf684f Mon Sep 17 00:00:00 2001 From: 686f6c61 Date: Thu, 27 Aug 2026 10:39:13 +0200 Subject: [PATCH] fix(desktop): make /clear start a new session like /new Help advertises /clear as start a new session, but desktop treated it as a TUI-only screen clear so history and context usage never reset. Alias it onto the existing /new action. Stop/interrupt is unchanged. --- apps/desktop/src/lib/desktop-slash-commands.test.ts | 9 ++++++++- apps/desktop/src/lib/desktop-slash-commands.ts | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/lib/desktop-slash-commands.test.ts b/apps/desktop/src/lib/desktop-slash-commands.test.ts index fed673d9e8..9225b43dab 100644 --- a/apps/desktop/src/lib/desktop-slash-commands.test.ts +++ b/apps/desktop/src/lib/desktop-slash-commands.test.ts @@ -180,6 +180,12 @@ describe('desktop slash command curation', () => { it('allows aliases to execute without cluttering the popover', () => { expect(isDesktopSlashSuggestion('/reset')).toBe(false) expect(isDesktopSlashCommand('/reset')).toBe(true) + // Help advertises `/clear` as "start a new session". On the TUI that + // also clears the terminal screen; on desktop it must take the same + // path as `/new` instead of being marked terminal-only (#95779). + expect(isDesktopSlashSuggestion('/clear')).toBe(false) + expect(isDesktopSlashCommand('/clear')).toBe(true) + expect(resolveDesktopCommand('/clear')?.surface).toEqual({ kind: 'action', action: 'new' }) }) it('surfaces an alias the user typed exactly, gated on desktop availability (#57641)', () => { @@ -297,9 +303,10 @@ describe('desktop slash command curation', () => { it('resolves commands and aliases to their declared surface', () => { expect(resolveDesktopCommand('/new')?.surface).toEqual({ kind: 'action', action: 'new' }) expect(resolveDesktopCommand('/reset')?.surface).toEqual({ kind: 'action', action: 'new' }) + expect(resolveDesktopCommand('/clear')?.surface).toEqual({ kind: 'action', action: 'new' }) expect(resolveDesktopCommand('/resume')?.surface).toEqual({ kind: 'picker', picker: 'session' }) expect(resolveDesktopCommand('/usage')?.surface).toEqual({ kind: 'exec' }) - expect(resolveDesktopCommand('/clear')?.surface).toEqual({ kind: 'unavailable', reason: 'terminal' }) + expect(desktopSlashUnavailableMessage('/clear')).toBeNull() // Skill / quick commands aren't in the registry. expect(resolveDesktopCommand('/gif-search')).toBeNull() }) diff --git a/apps/desktop/src/lib/desktop-slash-commands.ts b/apps/desktop/src/lib/desktop-slash-commands.ts index 0618257748..a5e0409bc3 100644 --- a/apps/desktop/src/lib/desktop-slash-commands.ts +++ b/apps/desktop/src/lib/desktop-slash-commands.ts @@ -178,7 +178,7 @@ const rpc = ( */ const DESKTOP_COMMAND_SPECS: readonly DesktopCommandSpec[] = [ // Local client actions - { name: '/new', description: 'Start a new desktop chat', aliases: ['/reset'], surface: action('new') }, + { name: '/new', description: 'Start a new desktop chat', aliases: ['/reset', '/clear'], surface: action('new') }, { name: '/stop', description: 'Stop the active turn and background processes',