diff --git a/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts index ee0822325..d4e4eb1e6 100644 --- a/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts +++ b/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts @@ -218,6 +218,23 @@ describe('assistantSlashCommands', () => { ); }); + it('drops the availability reason hint on enabled commands', () => { + const commands = filterAssistantSlashCommands('compact', undefined, { + availability: { + compact: { + disabled: false, + // The availability map always computes a fall-through reason; an + // enabled command must not display it as a false statement. + reason: 'Unavailable while another session action is running.', + }, + }, + }); + + expect(commands).toHaveLength(1); + expect(commands[0].disabled).toBe(false); + expect(commands[0].disabledReason).toBeUndefined(); + }); + it('exposes canonical and alias tokens for the picker', () => { const help = filterAssistantSlashCommands('commands')[0]; expect(getAssistantSlashCommandTokens(help)).toEqual(['help', 'commands']); diff --git a/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts b/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts index a3a20a30d..c8868ab29 100644 --- a/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts +++ b/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts @@ -248,7 +248,10 @@ const commandWithAvailability = ( return { ...command, disabled: state.disabled, - disabledReason: state.reason, + // The availability map computes a fall-through reason even when the + // command is enabled; carrying it through made the menu show false + // statements like "Forking is already running." on enabled commands. + disabledReason: state.disabled ? state.reason : undefined, }; };