From a3b40faa10524121a1296b9dccd15c108b01a77b Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Thu, 22 Oct 2026 22:31:31 +0100 Subject: [PATCH] feat(app): /stop reports the web's accepted line --- .../chat/conversation/chat_composer_bar.dart | 13 ++++++++++++- .../conversation/chat_command_palette_test.dart | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/lib/features/chat/conversation/chat_composer_bar.dart b/app/lib/features/chat/conversation/chat_composer_bar.dart index b08e9e64..2c10e8af 100644 --- a/app/lib/features/chat/conversation/chat_composer_bar.dart +++ b/app/lib/features/chat/conversation/chat_composer_bar.dart @@ -32,6 +32,9 @@ const String chatCommandNoticeLabel = 'Command'; const String chatCommandFailedLabel = 'Command failed'; const String chatCommandDismissLabel = 'Dismiss command notice'; +/// The web's line after `/stop`'s interrupt was accepted. +const String chatStopCommandNotice = 'Stopping the running turn…'; + /// Shown while the reply says this prompt waits behind the running turn. const String chatQueuedNotice = 'Queued — it will send when the current turn finishes.'; @@ -292,7 +295,7 @@ class _ChatComposerBarState extends State { } else if (command.name == chatCommandStop) { _consumeCommandDraft(); if (widget.running) { - unawaited(widget.composer.stop()); + unawaited(_stopFromCommand()); } else { _showCommandNotice('No turn is running in this chat.', failed: true); } @@ -316,6 +319,14 @@ class _ChatComposerBarState extends State { _focus.requestFocus(); } + /// `/stop`'s accepted interrupt reports the web's line; a refusal is the + /// composer's own error. + Future _stopFromCommand() async { + await widget.composer.stop(); + if (!mounted || widget.composer.error != null) return; + _showCommandNotice(chatStopCommandNotice); + } + void _consumeCommandDraft() { _text.clear(); unawaited(widget.composer.setDraft('')); diff --git a/app/test/features/chat/conversation/chat_command_palette_test.dart b/app/test/features/chat/conversation/chat_command_palette_test.dart index 67e16054..b676873c 100644 --- a/app/test/features/chat/conversation/chat_command_palette_test.dart +++ b/app/test/features/chat/conversation/chat_command_palette_test.dart @@ -300,6 +300,7 @@ void main() { ]); expect(fieldText(tester), ''); expect(gateway.promptBodies, isEmpty); + expect(find.text('Stopping the running turn…'), findsOneWidget); }); testWidgets('a command picked from the palette is never sent either', (