Show running and failed run counts independently

Give the Runs tab separate activity and failure indicators so neither suppresses the other. Reuse known summaries and pushed updates, keep failed states separate from decisions and dismissal counts, and update across tabs even when total attention is unchanged.
This commit is contained in:
2026-11-11 22:10:37 +00:00
parent 9551eceaed
commit efca56e4e4
13 changed files with 415 additions and 99 deletions
+17 -14
View File
@@ -23,6 +23,8 @@ class AdaptiveShell extends StatefulWidget {
this.onClosePage,
this.onSearch,
this.attentionCount = 0,
this.runningRunCount,
this.failedRunCount,
this.listPaneWidthStore = const SharedPreferencesListPaneWidthStore(),
this.barActions = const [],
});
@@ -46,10 +48,13 @@ class AdaptiveShell extends StatefulWidget {
/// shell tests and compositions without routing keep their tab set only.
final VoidCallback? onSearch;
/// Runs needing the operator today, mirrored on the Runs tab in every mount
/// so it stays visible from any destination. Zero shows no badge.
/// Runs needing the operator today, retained in the tab's accessible label.
final int attentionCount;
/// App-wide counts when available; standalone screens publish their own.
final int? runningRunCount;
final int? failedRunCount;
@override
State<AdaptiveShell> createState() => _AdaptiveShellState();
}
@@ -109,7 +114,7 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
});
}
/// The destination's icon; only Runs carries the attention count.
/// Runs has independent status counts; Chat has its unread count.
Widget _icon(AppDestination destination, IconData data) {
Widget icon = Icon(data);
if (destination == AppDestination.chat) {
@@ -121,17 +126,15 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
);
}
if (destination != AppDestination.runs) return icon;
// One indicator: runs that need you outrank runs in progress, so the
// tab never wears two counts at once.
final attention = widget.attentionCount > 0;
return AttentionDestinationIcon(
count: widget.attentionCount,
child: ActivityBadge(
key: const ValueKey('shell.badge.runs.running'),
count: attention ? 0 : _bar.badge(destination, ShellBadgeKind.running),
label: 'runs in progress',
child: icon,
),
return RunsDestinationIcon(
running:
widget.runningRunCount ??
_bar.badge(destination, ShellBadgeKind.running),
failed:
widget.failedRunCount ??
_bar.badge(destination, ShellBadgeKind.failed),
attention: widget.attentionCount,
child: icon,
);
}
+52 -2
View File
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import '../features/attention/domain/attention_models.dart';
import '../ui/motion/motion.dart';
/// Mirrors the Runs-heading bell count onto the Runs destination icon.
/// A generic attention count, separate from the Runs tab's status counts.
///
/// The bell itself lives in the Runs heading, so without this the count would
/// be visible only on that destination; the web mirrors it on the rail and
@@ -44,7 +44,57 @@ class AttentionDestinationIcon extends StatelessWidget {
}
}
/// A small count on a tab icon: blue for activity (runs in progress, unread
/// Both status counts remain visible: failures never hide executing work.
class RunsDestinationIcon extends StatelessWidget {
const RunsDestinationIcon({
super.key,
required this.running,
required this.failed,
required this.child,
this.attention = 0,
});
final int running;
final int failed;
final int attention;
final Widget child;
@override
Widget build(BuildContext context) {
final colors = Theme.of(context).colorScheme;
final labels = [
if (running > 0) '$running runs in progress',
if (failed > 0) '$failed failed runs',
if (attention > 0) attentionBadgeLabel(attention),
];
return Semantics(
label: labels.join(', '),
child: ExcludeSemantics(
child: Tooltip(
message: labels.isEmpty ? 'Runs' : 'Runs: ${labels.join(', ')}',
excludeFromSemantics: true,
child: Badge.count(
key: const ValueKey('shell.badge.runs.failed'),
count: failed,
maxCount: 99,
isLabelVisible: failed > 0,
backgroundColor: colors.error,
textColor: colors.onError,
child: ActivityBadge(
key: const ValueKey('shell.badge.runs.running'),
count: running,
label: 'runs in progress',
bottom: true,
child: child,
),
),
),
),
);
}
}
/// A small primary-theme count on a tab icon for activity (runs in progress, unread
/// chats), so it reads apart from the red needs-you count.
class ActivityBadge extends StatelessWidget {
const ActivityBadge({
+3
View File
@@ -357,6 +357,9 @@ enum ShellBadgeKind {
/// Runs still executing.
running,
/// Runs whose server status is failed, independent of attention dismissal.
failed,
/// Chats with messages not yet seen.
unread,
}