Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Prefer existing outcome text in cached commit previews

dee2292fe89203e
diff --git a/desktop/lib/state/session_preview.dart b/desktop/lib/state/session_preview.dart
index ea2195c39..9543b59ae 100644
--- a/desktop/lib/state/session_preview.dart
+++ b/desktop/lib/state/session_preview.dart
@@ -33,6 +33,18 @@ class SessionPreview {
? requests.skip(1).firstOrNull
: null;
String? get response => completedText ?? savedText;
+ String? get responseExcerpt {
+ final text = response;
+ if (text == null || completedText != null || contextResponse == text)
+ return text;
+ // Cached fullText may include the "I'll commit" preamble before the final
+ // receipt. Keep the existing outcome paragraphs, not just the preamble.
+ final paragraphs = text.split(RegExp(r'\n\s*\n'));
+ return paragraphs
+ .skip(paragraphs.length > 2 ? paragraphs.length - 2 : 0)
+ .join('\n\n');
+ }
+
// A commit receipt often follows the actual explanation. Reuse an earlier
// existing response for compact group context, keeping the receipt available
// as the latest response in the full preview. This is text selection only.
diff --git a/desktop/lib/widgets/swarm_search_preview.dart b/desktop/lib/widgets/swarm_search_preview.dart
index 533845af8..977ae6241 100644
--- a/desktop/lib/widgets/swarm_search_preview.dart
+++ b/desktop/lib/widgets/swarm_search_preview.dart
@@ -384,7 +384,7 @@ class _AgentPreview extends StatelessWidget {
record?.interrupted == true
? 'Last response · interrupted'
: 'Latest response',
- response,
+ record?.responseExcerpt ?? response,
maxLines: record?.earlierResponses.isNotEmpty == true
? 6
: null,
diff --git a/desktop/test/session_preview_test.dart b/desktop/test/session_preview_test.dart
index 295d97b3a..58a4aee6d 100644
--- a/desktop/test/session_preview_test.dart
+++ b/desktop/test/session_preview_test.dart
@@ -58,7 +58,7 @@ void main() {
'events': [
{
'kind': 'summary',
- 'fullText': 'I’ll commit the prototype.\n\nCommitted and pushed.',
+ 'fullText': 'I’ll commit the prototype.\n\nPushing now.\n\nCommitted and pushed.\n\nThe shared comments are saved.',
},
{
'kind': 'summary',
@@ -79,7 +79,11 @@ void main() {
final preview = store.read(a)!;
expect(
preview.response,
- 'I’ll commit the prototype.\n\nCommitted and pushed.',
+ 'I’ll commit the prototype.\n\nPushing now.\n\nCommitted and pushed.\n\nThe shared comments are saved.',
+ );
+ expect(
+ preview.responseExcerpt,
+ 'Committed and pushed.\n\nThe shared comments are saved.',
);
expect(
preview.contextResponse,