First run: empty states with a next step, harness setup instead of errors

- One shared EmptyState (icon on a tonal disc, title, one line, primary
  action) that follows the design tokens; used by Runs (Start your first
  run), Pipelines (Browse templates), Schedules and the chat list (Start a
  chat).
- Chat on a server without an agent harness showed "Bad state: No saved
  machine is connected.": the federated list now keeps the server's own
  refusal, treats an omitted empty list as no chats, and the list shows a
  "Set up an agent" state with the harness setup command and Refresh. New
  chat shows the same step instead of a form that can only be refused.
- A run that fails because no harness CLI exists names the setup command
  beside the raw reason; error advice gains a noHarness kind.
- Templates opened before the app connected stayed on "Not connected";
  it now reads again when the connection arrives. The Pipelines empty state
  links to Templates, which had no entry point in the UI.
- The first-launch walkthrough waits briefly for the connection, so a
  connected web app is no longer told to connect; the empty-server check
  treats omitted lists and no chat harness as empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 23:29:23 +00:00
parent 9436067bf2
commit e72bee3faa
30 changed files with 696 additions and 111 deletions
@@ -146,4 +146,34 @@ void main() {
);
expect(find.text('Why it failed'), findsNothing);
});
testWidgets('a run that found no agent harness names the setup step', (
tester,
) async {
const reason =
'environment problem: model stage research: HARNESS TRANSPORT: '
'harness unreachable: cannot run the selected OpenCode CLI: exec: '
'"opencode": executable file not found in \$PATH';
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: RunFailureBanner(
run: _run('failed', {'failure_reason': reason}),
),
),
),
);
expect(find.byKey(runFailureHarnessHintKey), findsOneWidget);
expect(find.textContaining('pipelines harness setup'), findsOneWidget);
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: RunFailureBanner(
run: _run('failed', {'diagnostic': 'exit status 2'}),
),
),
),
);
expect(find.byKey(runFailureHarnessHintKey), findsNothing);
});
}
@@ -9,6 +9,7 @@ import 'package:pipelines_app/features/runs/ui/runs_controller.dart';
import 'package:pipelines_app/features/runs/ui/runs_filters.dart';
import 'package:pipelines_app/ui/status/run_status_icon.dart';
import 'package:pipelines_app/features/runs/ui/runs_list.dart';
import 'package:pipelines_app/ui/status/error_notice.dart';
class _Gateway implements ApiGateway {
final framesController = StreamController<JsonMap>.broadcast();
@@ -162,8 +163,10 @@ void main() {
gateway.reply = {'runs': []};
await controller.load();
await tester.pumpAndSettle();
expect(find.text('No runs yet.'), findsOneWidget);
expect(find.textContaining('Start one from Pipelines'), findsOneWidget);
expect(find.text('No runs yet'), findsOneWidget);
expect(find.textContaining('A run is a pipeline'), findsOneWidget);
// No New run seam in this fixture: the state offers no dead button.
expect(find.text('Start your first run'), findsNothing);
expect(find.text('No runs found.'), findsNothing);
expect(find.textContaining('offline'), findsNothing);
expect(tester.takeException(), isNull);
@@ -173,7 +176,7 @@ void main() {
controller.setStatus('failed');
await tester.pumpAndSettle();
expect(find.text('No runs found.'), findsOneWidget);
expect(find.text('No runs yet.'), findsNothing);
expect(find.text('No runs yet'), findsNothing);
expect(
find.text('Try changing or clearing the filters.'),
findsOneWidget,
@@ -183,6 +186,32 @@ void main() {
variant: TargetPlatformVariant.only(TargetPlatform.android),
);
testWidgets('an empty server offers the first run as the next step', (
tester,
) async {
gateway.failure = null;
gateway.gate = null;
gateway.reply = {'runs': []};
await controller.load();
var started = 0;
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: RunsList(
controller: controller,
onSelected: (_) {},
onNewRun: () => started++,
),
),
),
);
await tester.pumpAndSettle();
expect(find.byKey(runsEmptyKey), findsOneWidget);
expect(find.byType(ErrorNotice), findsNothing);
await tester.tap(find.text('Start your first run'));
expect(started, 1);
});
testWidgets(
'an empty server with a search query reads as no match, not no runs',
(tester) async {
@@ -200,7 +229,7 @@ void main() {
);
await tester.pumpAndSettle();
expect(find.text('No runs found.'), findsOneWidget);
expect(find.text('No runs yet.'), findsNothing);
expect(find.text('No runs yet'), findsNothing);
expect(
find.text('Try changing or clearing the filters.'),
findsOneWidget,